<commit_before>class JekyllCreativeCommons < Liquid::Tag
  Syntax = /\/\/creativecommons.org\/(licenses|publicdomain)\/([a-z\-]*)\/(\d\.?\d)?\//

  def initialize(tag_name, license, tokens)
    if !(license =~ Syntax) then
      raise "No license url provided in the \"license\" tag"
    end
    @license_url   = license
    @license_class = $2
    license_ver    = $3
    jurisdiction   = "International"
    case @license_class
      when "by-nc-sa"
        license_name = "Creative Commons Attribution-NonCommercial-ShareAlike"
      when "by-nc-nd"
        license_name = "Creative Commons Attribution-NonCommercial-NoDerivs"
      when "by-nc"
        license_name = "Creative Commons Attribution-NonCommercial"
      when "by-sa"
        license_name = "Creative Commons Attribution-ShareAlike"
      when "by-nd"
        license_name = "Creative Commons Attribution-NoDerivs"
      when "by"
        license_name = "Creative Commons Attribution"
    end
    if @license_class == "mark" and $1 == "publicdomain"
      @license_name  = "free of known copyright restrictions."
    else
      @license_name  = "#{license_name} #{license_ver} #{jurisdiction} License"
    end
  end

  def render(context)
    page_link = context["page.title"]
    unless ((author_name = context["page.author.name"]))
      unless ((author_name = context["page.author"]))
        author_name = nil
      end
    end
    unless (author_name == nil)
      author_link = " by <a href='#{@author_url}'>#{author_name}</a>"
    else
      author_link = ""
    end
    unless @license_class == "mark"
      license_prolog = "is licensed under a"
    else
      license_prolog = "is"
    end
"""
<a href='#{@license_url}' id='license' class='#{@license_class}'></a>
<span class='licensetext'>
<span property='dct:title' rel='dct:type'>#{page_link}</span>#{author_link}
#{license_prolog}
<a rel='license' itemprop='license' href='#{@license_url}'>#{@license_name}</a>
</span>
"""
  end
end

Liquid::Template.register_tag('license', JekyllCreativeCommons)<commit_msg>Strip newlines<commit_after>class JekyllCreativeCommons < Liquid::Tag
  Syntax = /\/\/creativecommons.org\/(licenses|publicdomain)\/([a-z\-]*)\/(\d\.?\d)?\//

  def initialize(tag_name, license, tokens)
    if !(license =~ Syntax) then
      raise "No license url provided in the \"license\" tag"
    end
    @license_url   = license
    @license_class = $2
    license_ver    = $3
    jurisdiction   = "International"
    case @license_class
      when "by-nc-sa"
        license_name = "Creative Commons Attribution-NonCommercial-ShareAlike"
      when "by-nc-nd"
        license_name = "Creative Commons Attribution-NonCommercial-NoDerivs"
      when "by-nc"
        license_name = "Creative Commons Attribution-NonCommercial"
      when "by-sa"
        license_name = "Creative Commons Attribution-ShareAlike"
      when "by-nd"
        license_name = "Creative Commons Attribution-NoDerivs"
      when "by"
        license_name = "Creative Commons Attribution"
    end
    if @license_class == "mark" and $1 == "publicdomain"
      @license_name  = "free of known copyright restrictions."
    else
      @license_name  = "#{license_name} #{license_ver} #{jurisdiction} License"
    end
  end

  def render(context)
    page_link = context["page.title"]
    unless ((author_name = context["page.author.name"]))
      unless ((author_name = context["page.author"]))
        author_name = nil
      end
    end
    unless (author_name == nil)
      author_link = " by <a href='#{@author_url}'>#{author_name}</a>"
    else
      author_link = ""
    end
    unless @license_class == "mark"
      license_prolog = "is licensed under a"
    else
      license_prolog = "is"
    end
"""
<a href='#{@license_url}' id='license' class='#{@license_class}'></a>
<span class='licensetext'>
<span property='dct:title' rel='dct:type'>#{page_link}</span>#{author_link}
 #{license_prolog}
 <a rel='license' itemprop='license' href='#{@license_url}'>#{@license_name}</a>
</span>
""".delete "\n"
  end
end

Liquid::Template.register_tag('license', JekyllCreativeCommons)
{'fraction_non_alphanumeric': 0.1440078105931169, 'fraction_numerical': 0.001464486209421528, 'mean_word_length': 3.309148264984227, 'pattern_counts': {'":': 0, '<': 25, '<?xml version=': 0, '>': 23, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1051575', 'n_tokens_mistral': 1360, 'n_tokens_neox': 1346, 'n_words': 292}