From b4bba11d3c2bb06a2785b2b7e87779ec05501680 Mon Sep 17 00:00:00 2001 From: ivanhercaz Date: Thu, 12 Dec 2019 17:28:08 +0000 Subject: [PATCH 1/2] :sparkles: Add CC Zero to the cc_license_mark macro In getpelican/pelican-themes#530 is reported that the cc_license_mark macro, written in templates/includes/cc-license.html, doesn't get the correct url and image when CC_LICENSE is set to "zero" or "cc0". That's because the format of the url is different. This change add an if to know if it is a CC Public Domain (Zero) mark before to set the license. --- .../templates/includes/cc-license.html | 42 ++++++++++--------- 1 file changed, 23 insertions(+), 19 deletions(-) diff --git a/pelican-bootstrap3/templates/includes/cc-license.html b/pelican-bootstrap3/templates/includes/cc-license.html index 84f204d55..d2a98d9e0 100644 --- a/pelican-bootstrap3/templates/includes/cc-license.html +++ b/pelican-bootstrap3/templates/includes/cc-license.html @@ -35,25 +35,29 @@ br_after_icon=false, attr_markup=false, attr_props={}) %} - {% if cc_name %} - {% set cc_name = cc_name|lower|replace("cc-","") %} - {% set cc_title_suffix = cc_name|replace("by", "")|replace("-nc","-NonCommercial")|replace("-nd","-NoDerivatives")|replace("-sa","-ShareAlike") %} - {% 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 AttributionCCSUFFIX 4.0 International License","https://creativecommons.org/licenses/CCNAME/4.0/","//i.creativecommons.org/l/CCNAME/4.0/80x15.png") %} + {% if cc_name|lower == "zero" or cc_name|lower == "cc0" or cc_name|lower == "cc-zero" %} + {% set cc_title, cc_uri, cc_icon = ("CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", "https://creativecommons.org/publicdomain/zero/1.0/", "https://licensebuttons.net/p/zero/1.0/80x15.png") %} + {% else %} + {% if cc_name %} + {% set cc_name = cc_name|lower|replace("cc-","") %} + {% set cc_title_suffix = cc_name|replace("by", "")|replace("-nc","-NonCommercial")|replace("-nd","-NoDerivatives")|replace("-sa","-ShareAlike") %} + {% 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 AttributionCCSUFFIX 4.0 International License","https://creativecommons.org/licenses/CCNAME/4.0/","//i.creativecommons.org/l/CCNAME/4.0/80x15.png") %} + {% endif %} Creative Commons License {% if br_after_img %}
{% endif %} {% if attr_markup %} From d2f5226b92a28271a953a5957f2f9e0395702cec Mon Sep 17 00:00:00 2001 From: ivanhercaz Date: Fri, 13 Dec 2019 11:47:56 +0000 Subject: [PATCH 2/2] :pencil: Write documentation about CC_LICENSE Write documentation for the new feature of the macro that shows the license according to what is set in CC_LICENSE. --- pelican-bootstrap3/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pelican-bootstrap3/README.md b/pelican-bootstrap3/README.md index d99000405..a51b09919 100644 --- a/pelican-bootstrap3/README.md +++ b/pelican-bootstrap3/README.md @@ -299,7 +299,7 @@ If you're using reStructuredText for writing articles and pages, you can include You can optionally declare a [Creative Commons license](https://creativecommons.org) for the content of your site. It will appear in the site's footer. To enable, use one of the following two ways for configuration. -* To choose the license by name, set `CC_LICENSE` to the common abbreviated name of the license: `"CC-BY"` (require attribution), `"CC-BY-SA"` (require ShareAlike), `"CC-BY-ND"` (NoDerivatives) , `"CC-BY-NC"` (require attribution, no commercial reuse), `"CC-BY-NC-SA"` (require ShareAlike, no commercial reuse), or `"CC-BY-NC-ND"` (NoDerivatives, no commercial reuse). +* To choose the license by name, set `CC_LICENSE` to the common abbreviated name of the license: "CC0" or "zero" (public domain mark), `"CC-BY"` (require attribution), `"CC-BY-SA"` (require ShareAlike), `"CC-BY-ND"` (NoDerivatives) , `"CC-BY-NC"` (require attribution, no commercial reuse), `"CC-BY-NC-SA"` (require ShareAlike, no commercial reuse), or `"CC-BY-NC-ND"` (NoDerivatives, no commercial reuse). * Alternatively, choose the licence by features: * `CC_LICENSE_DERIVATIVES` - `"yes"` if permitted, `"no"` if not permitted, and `"ShareAlike"` if derivatives must be shared under the same terms. * `CC_LICENSE_COMMERCIAL` - `"yes"` if commercial reuse is permitted, and `"no"` otherwise.