mirror of
https://github.com/greflm13/StaticGalleryBuilder.git
synced 2026-02-05 02:59:27 +00:00
- added support for CreativeCommons Licenses (cc0, cc-by, cc-by-sa, cc-by-nd, cc-by-nc, cc-by-nc-sa, cc-by-nc-nd) - added command line option for Author - added command line option for title - added navbar
139 lines
7.4 KiB
Python
139 lines
7.4 KiB
Python
def licenseswitch(cclicense: str):
|
|
switch = {
|
|
"cc-zero": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is marked with
|
|
<a href="https://creativecommons.org/publicdomain/zero/1.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC0 1.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/zero.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by-sa": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by-sa/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY-SA 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/sa.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by-nd": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by-nd/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY-ND 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/nd.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by-nc": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by-nc/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY-NC 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/nc.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by-nc-sa": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by-nc-sa/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY-NC-SA 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/nc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/sa.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
"cc-by-nc-nd": """
|
|
<div class="license" xmlns:cc="http://creativecommons.org/ns#" xmlns:dct="http://purl.org/dc/terms/">
|
|
<a property="dct:title" rel="cc:attributionURL" href="$webroot">$title</a> by <span property="cc:attributionName">$author</span> is licensed under
|
|
<a href="https://creativecommons.org/licenses/by-nc-nd/4.0/" target="_blank" rel="license noopener noreferrer" style="display: inline-block"
|
|
>CC BY-NC-ND 4.0<img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/cc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/by.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/nc.svg"
|
|
alt="" /><img
|
|
style="height: 22px !important; margin-left: 3px; vertical-align: text-bottom"
|
|
src="https://mirrors.creativecommons.org/presskit/icons/nd.svg"
|
|
alt=""
|
|
/></a>
|
|
</div>
|
|
""",
|
|
}
|
|
|
|
return switch.get(cclicense, "")
|
|
|
|
|
|
def licenseurlswitch(cclicense: str):
|
|
switch = {
|
|
"cc-zero": "https://creativecommons.org/publicdomain/zero/1.0/",
|
|
"cc-by": "https://creativecommons.org/licenses/by/4.0/",
|
|
"cc-by-sa": "https://creativecommons.org/licenses/by-sa/4.0/",
|
|
"cc-by-nd": "https://creativecommons.org/licenses/by-nd/4.0/",
|
|
"cc-by-nc": "https://creativecommons.org/licenses/by-nc/4.0/",
|
|
"cc-by-nc-sa": "https://creativecommons.org/licenses/by-nc-sa/4.0/",
|
|
"cc-by-nc-nd": "https://creativecommons.org/licenses/by-nc-nd/4.0/",
|
|
}
|
|
|
|
return switch.get(cclicense, "")
|