diff options
author | Karl Berry <karl@freefriends.org> | 2015-02-06 23:29:07 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2015-02-06 23:29:07 +0000 |
commit | 62a844580979e6895e4bb224b769e6178fafa88e (patch) | |
tree | 4de71f2891a39bb432b0f55196f7da273cbda59c /Master/texmf-dist/tex/latex/doclicense | |
parent | 970ab76da64fc81430c87913150c65dad35e7665 (diff) |
doclicense (6feb15)
git-svn-id: svn://tug.org/texlive/trunk@36224 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/doclicense')
11 files changed, 234 insertions, 0 deletions
diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-UKenglish.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-UKenglish.ldf new file mode 100644 index 00000000000..3c6a45f4611 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-UKenglish.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-USenglish.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-USenglish.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-USenglish.ldf new file mode 100644 index 00000000000..3c6a45f4611 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-USenglish.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-USenglish.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-american.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-american.ldf new file mode 100644 index 00000000000..6cdb358fbb0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-american.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-american.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-australian.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-australian.ldf new file mode 100644 index 00000000000..c40d1caae90 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-australian.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-australian.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-british.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-british.ldf new file mode 100644 index 00000000000..e2aa01ec43f --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-british.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-british.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-canadian.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-canadian.ldf new file mode 100644 index 00000000000..855aa5718ee --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-canadian.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-canadian.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-english.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-english.ldf new file mode 100644 index 00000000000..d294f4390a4 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-english.ldf @@ -0,0 +1,20 @@ +\ProvidesFile{doclicense-english.ldf} + +\edef\doclicense@lang@thisDoc{This work is licensed under a}% +\edef\doclicense@lang@word@license{license}% +\edef\doclicense@lang@code{en}% + +\edef\doclicense@lang@lic@CC@code{}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-sa@3.0\endcsname{Attribution-ShareAlike 3.0 Unported}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nd@3.0\endcsname{Attribution-NoDerivs 3.0 Unported}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc@3.0\endcsname{Attribution-NonCommercial 3.0 Unported}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-sa@3.0\endcsname{Attribution-NonCommercial-ShareAlike 3.0 Unported}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-nd@3.0\endcsname{Attribution-NonCommercial-NoDerivs 3.0 Unported}% +\expandafter\edef\csname doclicense@lang@lic@CC@zero@1.0\endcsname{CC0 1.0 Universal}% +\expandafter\edef\csname doclicense@lang@lic@CC@pd@1.0\endcsname{Copyright-Only Dedication}% + +\expandafter\edef\csname doclicense@lang@lic@CC@by-sa@4.0\endcsname{Attribution-ShareAlike 4.0 International}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nd@4.0\endcsname{Attribution-NoDerivatives 4.0 International}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc@4.0\endcsname{Attribution-NonCommercial 4.0 International}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-sa@4.0\endcsname{Attribution-NonCommercial-ShareAlike 4.0 International}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-nd@4.0\endcsname{Attribution-NonCommercial-NoDerivatives 4.0 International}% diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-german.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-german.ldf new file mode 100644 index 00000000000..4b15649f0fd --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-german.ldf @@ -0,0 +1,14 @@ +\ProvidesFile{doclicense-german.ldf} + +\edef\doclicense@lang@thisDoc{Dieses Werk ist lizenziert unter einer}% +\edef\doclicense@lang@word@license{Lizenz}% +\edef\doclicense@lang@code{de}% + +\edef\doclicense@lang@lic@CC@code{deed.de}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-sa@3.0\endcsname{Namensnennung - Weitergabe unter gleichen Bedingungen 3.0 Deutschland}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nd@3.0\endcsname{Namensnennung-Keine Bearbeitung 3.0 Deutschland}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc@3.0\endcsname{Namensnennung-Nicht kommerziell 3.0 Deutschland}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-sa@3.0\endcsname{Namensnennung - Nicht-kommerziell - Weitergabe unter gleichen Bedingungen 3.0 Deutschland}% +\expandafter\edef\csname doclicense@lang@lic@CC@by-nc-nd@3.0\endcsname{Namensnennung - Nicht-kommerziell - Keine Bearbeitung 3.0 Deutschland}% +\expandafter\edef\csname doclicense@lang@lic@CC@zero@1.0\endcsname{CC0 1.0 Universell}% +% \expandafter\edef\csname doclicense@lang@lic@CC@pd@1.0\endcsname{Copyright-Only Dedication}% Based on US right. Use Zero in no-US countries. diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-newzealand.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-newzealand.ldf new file mode 100644 index 00000000000..9775602edc1 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-newzealand.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-newzealand.ldf} + +\input{doclicense-english.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense-ngerman.ldf b/Master/texmf-dist/tex/latex/doclicense/doclicense-ngerman.ldf new file mode 100644 index 00000000000..5f4247c1db0 --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense-ngerman.ldf @@ -0,0 +1,3 @@ +\ProvidesFile{doclicense-ngerman.ldf} + +\input{doclicense-german.ldf} diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense.sty b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty new file mode 100644 index 00000000000..e63c59e191c --- /dev/null +++ b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty @@ -0,0 +1,176 @@ +%% See file 'doclicense.dtx' for copyright and license. +\NeedsTeXFormat{LaTeX2e}[1998/12/01] +\ProvidesPackage{doclicense} + [2015/02/06 v0.8 Set and print the license of a document] + +%% Dependencies {{{ +\RequirePackage{kvoptions} +\RequirePackage{xifthen} +\RequirePackage{etoolbox} %% \ifcsdef +\RequirePackage{xspace} +\AtEndPreamble{% + \@ifpackageloaded{csquotes}{}{\RequirePackage{csquotes}} + \@ifpackageloaded{ccicons}{}{\RequirePackage{ccicons}} + %% For \doclicenseIcon + \@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}} + %% For \doclicenseImage + \@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}} +} +%% }}} + +%% Parameters {{{ +\DeclareStringOption[CC]{type} +\DeclareStringOption[by-sa]{modifier} +\DeclareStringOption{version} +\DeclareStringOption{lang} +\DeclareStringOption[10em]{imagewidth} +%% }}} + +\ProcessLocalKeyvalOptions* +%% Declare variables {{{ +\newcommand{\doclicense@baseUrlCC}{https://creativecommons.org} +\newcommand{\doclicense@versionFallback}{} +\newcommand{\doclicense@versionUsed}{} +\newboolean{doclicense@licenseKnown} +\newlength{\doclicense@hsize} +\newcommand{\doclicense@longName}{% + \csname doclicense@lang@lic@\doclicense@type @\doclicense@modifier @\doclicense@versionUsed\endcsname +} +\newcommand{\doclicense@icon}{% + \PackageError{doclicense}{Icon not defined} + {Please check the documentation of doclicense to see what you can do about it.}% +} +%% }}} + +%% User macros {{{ +\newcommand{\doclicenseType}{\doclicense@type\xspace} +\newcommand{\doclicenseLongType}{} +\newcommand{\doclicenseModifier}{\MakeUppercase{\doclicense@modifier}\xspace} +\newcommand{\doclicenseVersion}{\doclicense@versionUsed\xspace} +\newcommand{\doclicenseName}{\doclicense@type~\doclicense@modifier~\doclicense@versionUsed\xspace} +\newcommand{\doclicenseNameRef}{\href{\doclicenseURL}{\doclicenseName}\xspace} +\newcommand{\doclicenseLongName}{\doclicenseLongType\space\doclicense@longName\xspace} +\newcommand{\doclicenseLongNameRef}{\href{\doclicenseURL}{\doclicenseLongName}} +\newcommand{\doclicenseText}{% + \doclicense@lang@thisDoc\space + \href{\doclicenseURL}{\enquote{\doclicenseName}} \doclicense@lang@word@license.\xspace +} +\newcommand{\doclicenseLongText}{% + \doclicense@lang@thisDoc\space + \href{\doclicenseURL}{\doclicenseLongType\space\enquote{\doclicense@longName}} + \doclicense@lang@word@license.\xspace +} +\newcommand{\doclicenseIcon}{\doclicense@icon\xspace} +\newcommand{\doclicenseImage}[1][]{% + \setkeys{doclicense}{#1} + \href{\doclicenseURL}{% + \includegraphics[width=\doclicense@imagewidth]% + {doclicense-\doclicense@type-\doclicense@modifier}% + } +} + +\newcommand{\doclicenseLicense}{ + \setlength{\doclicense@hsize}{\textwidth-\doclicense@imagewidth-2em} + \ifthenelse{\lengthtest{\hsize > \vsize}}{%% landscape + \setlength{\doclicense@hsize}{\doclicense@hsize-10em} + }{} + \begin{center} + \begin{minipage}{\doclicense@hsize} + \doclicenseLongText% + \end{minipage} + \hfill + \begin{minipage}{\doclicense@imagewidth} + \doclicenseImage% + \end{minipage} + \end{center} +} +%% }}} + +%% Language support {{{ +\ifthenelse{\equal{\doclicense@lang}{}}{% + \renewcommand{\doclicense@lang}{\languagename}}{} +\IfFileExists{doclicense-\doclicense@lang.ldf}{% + \input{doclicense-\doclicense@lang.ldf} +}{% + \PackageWarning{doclicense}{No language definition for \doclicense@lang not found. Please add one and submit a patch. Using English as fallback.} + \renewcommand{\doclicense@lang}{english} + \input{doclicense-\doclicense@lang.ldf} +} + +%% }}} + +%% Set license {{{ +\newcommand{\doclicense@setVersion}[1][]{% + \ifthenelse{\equal{#1}{}}{}{% + \renewcommand{\doclicense@versionFallback}{#1} + } + \ifthenelse{\equal{\doclicense@version}{}}{% + \renewcommand{\doclicense@versionUsed}{\doclicense@versionFallback} + }{% + \renewcommand{\doclicense@versionUsed}{\doclicense@version} + } +} +\newcommand{\doclicense@set}{% + %% CC {{{ + \ifthenelse{\equal{\doclicense@type}{CC}}{% + \renewcommand{\doclicenseLongType}{Creative Commons\xspace} + + \ifthenelse{\equal{\doclicense@lang@lic@CC@code}{}}{% + \edef\doclicense@UrlLangPart{} + }{% + \edef\doclicense@UrlLangPart{/\doclicense@lang@lic@CC@code} + } + \doclicense@setVersion[3.0] + \edef\doclicenseURL{% + \doclicense@baseUrlCC/% + licenses/% + \doclicense@modifier/% + \doclicense@versionUsed\doclicense@UrlLangPart} + \ifthenelse{\equal{\doclicense@modifier}{by-sa}} + {\renewcommand{\doclicense@icon}{\ccbysa}}{} + \ifthenelse{\equal{\doclicense@modifier}{by-nd}} + {\renewcommand{\doclicense@icon}{\ccbynd}}{} + \ifthenelse{\equal{\doclicense@modifier}{by-nc}} + {\renewcommand{\doclicense@icon}{\ccbync}}{} + \ifthenelse{\equal{\doclicense@modifier}{by-nc-sa}} + {\renewcommand{\doclicense@icon}{\ccbync}}{} + \ifthenelse{\equal{\doclicense@modifier}{by-nc-nd}} + {\renewcommand{\doclicense@icon}{\ccbync}}{} + \ifthenelse{\equal{\doclicense@modifier}{zero}}{% + \renewcommand{\doclicense@icon}{\cczero} + \doclicense@setVersion[1.0] + \edef\doclicenseURL{% + \doclicense@baseUrlCC/% + publicdomain/% + \doclicense@modifier/% + \doclicense@versionUsed\doclicense@UrlLangPart} + }{} + \ifthenelse{\equal{\doclicense@modifier}{pd}}{ + \renewcommand{\doclicense@icon}{\ccpd} + \doclicense@setVersion[1.0] + \edef\doclicenseURL{% + \doclicense@baseUrlCC/% + licenses/publicdomain/% + \doclicense@versionUsed\doclicense@UrlLangPart} + }{} + + \ifcsdef{doclicense@lang@lic@\doclicense@type% + @\doclicense@modifier @\doclicense@versionUsed}{}{% + + \PackageError{doclicense}{License long name not defined}% + {Please check the documentation of doclicense to see what you can do about it.}% + } + + \setboolean{doclicense@licenseKnown}{true} + }{}%% }}} + \ifthenelse{\not\boolean{doclicense@licenseKnown}}{% + \PackageError{doclicense}{License unknown}% + {Please check the documentation of doclicense to see what you can do about it.}% + }{}% +} +%% }}} + +\doclicense@set% +\endinput +%% +%% End of file `doclicense.sty'. |