aboutsummaryrefslogtreecommitdiffstats
path: root/pelican-bootstrap3/templates/includes/cc-license.html
diff options
context:
space:
mode:
authorDaan Debie <debie.daan@gmail.com>2014-01-27 23:38:37 +0100
committerDaan Debie <debie.daan@gmail.com>2014-01-27 23:39:08 +0100
commitfd1a4eaba46c1def74bd6905bce15c61bb326ed5 (patch)
treea768a44479fcec3e04307f4035b30a689ae6d826 /pelican-bootstrap3/templates/includes/cc-license.html
parentc35cbabcaf4807b9474203a2fbd809883b08ad50 (diff)
downloadpelican-themes-fd1a4eaba46c1def74bd6905bce15c61bb326ed5.zip
pelican-themes-fd1a4eaba46c1def74bd6905bce15c61bb326ed5.tar.gz
pelican-themes-fd1a4eaba46c1def74bd6905bce15c61bb326ed5.tar.bz2
Updated pelican-bootstrap to v1.2
Diffstat (limited to 'pelican-bootstrap3/templates/includes/cc-license.html')
-rw-r--r--pelican-bootstrap3/templates/includes/cc-license.html64
1 files changed, 64 insertions, 0 deletions
diff --git a/pelican-bootstrap3/templates/includes/cc-license.html b/pelican-bootstrap3/templates/includes/cc-license.html
new file mode 100644
index 0000000..5c44993
--- /dev/null
+++ b/pelican-bootstrap3/templates/includes/cc-license.html
@@ -0,0 +1,64 @@
+{# ------------------------------------------------------------------------ #}
+{# Creative Commons license mark generator for Jinja2 templates, including #}
+{# Pelican-generated static sites (or blogs). #}
+{# ------------------------------------------------------------------------ #}
+{# To use, put this file in a location where your template can import it. #}
+{# Then import into the template, for example like this: #}
+{# {% from '/path/to/where/you/placed/the/file' import cc_license_mark %} #}
+{# Then call as simply as {{ cc_license_mark("CC-BY") }}. #}
+{# #}
+{# If full attribution markup is desired in a Pelican template, the #}
+{# attr_props dict can be defaulted to the following when calling the macro:#}
+{# attr_props={'title':SITENAME,'name':AUTHOR,'url':SITEURL}
+{# ------------------------------------------------------------------------ #}
+{# Generate a license mark for Creative Commons licensed content. #}
+{# Choose the license either by name (CC-BY, CC-BY-SA, CC-BY-NC-SA, or #}
+{# CC-BY-NC-ND), or by its features (allow derivatives: Yes, No, ShareAlike;#}
+{# allow commercial reuse: Yes, No). Name, if provided, takes precedence, #}
+{# and case is ignored. #}
+{# #}
+{# Optional: #}
+{# br_after_icon: if true put a line break after the license icon #}
+{# attr_markup: if true create markup for fulll attribution #}
+{# attr_props: if attr_markup, a dict with title, name, and url keys #}
+{# specifying how under which title, to which creator, and #}
+{# to which URL to attribute the work #}
+{# The parameters all mirror the Creative Commone license chooser: #}
+{# http://creativecommons.org/choose/ #}
+{# ------------------------------------------------------------------------ #}
+{# Copyright (c) 1994 Hilmar Lapp, hlapp@drycafe.net. #}
+{# Licensed under the terms of the MIT License. #}
+{# Source at http://github.com/hlapp/cc-tools. Please fork & contribute. #}
+{# ------------------------------------------------------------------------ #}
+{% macro cc_license_mark(cc_name,
+ derivatives, commercial,
+ br_after_icon=false,
+ attr_markup=false,
+ attr_props={}) %}
+ {% if cc_name %}
+ {% set cc_name = cc_name|lower|replace("cc-","") %}
+ {% else %}
+ {% set cc_name = "by" %}
+ {% set cc_title_suffix = "" %}
+ {% if (not commercial) or (commercial|lower == "no") %}
+ {% set cc_name = cc_name ~ "-nc" %}
+ {% set cc_title_suffix = "-NonCommercial" %}
+ {% endif %}
+ {% if derivatives|lower == "no" %}
+ {% set cc_name = cc_name ~ "-nd" %}
+ {% set cc_title_suffix = cc_title_suffix ~ "-NoDerivatives" %}
+ {% elif derivatives|lower == "sharealike" %}
+ {% set cc_name = cc_name ~ "-sa" %}
+ {% set cc_title_suffix = cc_title_suffix ~ "-ShareAlike" %}
+ {% endif %}
+ {% endif %}
+ {% set cc_title, cc_uri, cc_icon = ("Creative Commons Attribution 4.0 InternationalCCSUFFIX License","http://creativecommons.org/licenses/CCNAME/4.0/","http://i.creativecommons.org/l/CCNAME/4.0/80x15.png") %}
+ <a rel="license" href="{{ cc_uri|replace('CCNAME',cc_name) }}"><img alt="Creative Commons License" style="border-width:0" src="{{ cc_icon|replace('CCNAME',cc_name) }}" /></a>
+ {% if br_after_img %}<br/>{% endif %}
+ {% if attr_markup %}
+ &quot;<span xmlns:dct="http://purl.org/dc/terms/" property="dct:title">{{ attr_props['title'] }}</span>&quot; by <a xmlns:cc="http://creativecommons.org/ns#" href="{{ attr_props['url'] }}" property="cc:attributionName" rel="cc:attributionURL">{{ attr_props['name'] }}</a> is
+ {% else %}
+ Content
+ {% endif %}
+ licensed under a <a rel="license" href="{{ cc_uri|replace('CCNAME',cc_name) }}">{{ cc_title|replace('CCSUFFIX',cc_title_suffix) }}</a>, except where indicated otherwise.
+{% endmacro %}