summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
diff options
context:
space:
mode:
Diffstat (limited to 'Master/texmf-dist/tex/latex/doclicense/doclicense.sty')
-rw-r--r--Master/texmf-dist/tex/latex/doclicense/doclicense.sty115
1 files changed, 74 insertions, 41 deletions
diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense.sty b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
index e277e15c0c1..fc6103d6780 100644
--- a/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
+++ b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
@@ -1,16 +1,17 @@
%% See file 'doclicense.dtx' for copyright and license.
\NeedsTeXFormat{LaTeX2e}[1998/12/01]
\ProvidesPackage{doclicense}
- [2020/04/12 v1.10.1 Support for putting documents under a license]
+ [2020/05/27 v2.0.0 Support for putting documents under a license]
+
%% ^^A nag warned about the center environment and it really messes up spacing.
%% Parameters (((
\RequirePackage{kvoptions}
-\DeclareStringOption[CC]{type}
-\DeclareStringOption[by-sa]{modifier}
+\DeclareStringOption{type}
+\DeclareStringOption{modifier}
\DeclareStringOption{version}
\DeclareStringOption{lang}
-\DeclareStringOption{imagemodifier}
+\DeclareStringOption[-88x31]{imagemodifier}% chktex 29
\DeclareStringOption[right]{imageposition}
\DeclareStringOption[10em]{imagewidth}
\DeclareStringOption[2em]{imagedistance}
@@ -21,13 +22,13 @@
%% Dependencies (((
\RequirePackage{xifthen}
+\RequirePackage{xstring}
\RequirePackage{etoolbox} %% \ifcsdef
\RequirePackage{xspace}
\RequirePackage{verbatim}
-%% )))
%% Custom enumerate list with adjusted labels
-%% that match the license text convetions
+%% that match the license text conventions
\newenvironment{doclicense@enumerate}{%
\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}%
@@ -83,6 +84,43 @@
}
%% )))
+%% Deprecation handling (((
+\ifthenelse{
+ \equal{\doclicense@type}{}
+}{
+ \PackageWarning{doclicense}{%
+ "type" package option missing. % chktex 18
+ This option is now required and the fallback to "CC" is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+ \renewcommand{\doclicense@type}{CC}
+}{}
+
+\ifthenelse{
+ \equal{\doclicense@modifier}{}
+}{
+ \PackageWarning{doclicense}{%
+ "modifier" package option missing. % chktex 18
+ This option is now required and the fallback to "by-sa" is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+ \renewcommand{\doclicense@modifier}{by-sa}
+}{}
+
+\ifthenelse{
+ \equal{\doclicense@version}{}
+}{
+ \PackageWarning{doclicense}{%
+ "version" package option missing. % chktex 18
+ This option is now required and the fallback is deprecated. % chktex 18
+ In an upcoming major version of doclicense, this will be a package error.
+ Please explicitly pick a license of your choosing.
+ }
+}{}
+%% )))
+
%% Declare variables (((
\newcommand{\doclicense@baseUrlCC}{https://creativecommons.org}
\newcommand{\doclicense@versionFallback}{}
@@ -95,7 +133,7 @@
}
\newcommand{\doclicense@icon}{%
\PackageError{doclicense}{Icon not defined}
- {Please check the documentation of doclicense to see what you can do about it.}%
+ {Please check the manual of doclicense to see what you can do about it.}%
}
\newcommand{\doclicense@modifier@uppercase}{\texorpdfstring{%
\MakeUppercase{\doclicense@modifier}%
@@ -148,11 +186,11 @@
}
\newcommand{\doclicenseFullTextFileName}{%
doclicense-\doclicense@type-\doclicense@modifier-\doclicense@versionUsed-latex}
-\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}
+\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}% chktex 27
\newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support
\newcommand{\doclicenseThis}{%
- \setlength{\doclicense@hsize}{\textwidth-\doclicense@imagewidth-\doclicense@imagedistance}%
+ \setlength{\doclicense@hsize}{\linewidth-\doclicense@imagewidth-\doclicense@imagedistance}%
\ifthenelse{\equal{\doclicense@imageposition}{left}}{%
\begin{center}
\begin{minipage}{\doclicense@imagewidth}
@@ -194,13 +232,14 @@
\ifthenelse{\equal{\doclicense@lang}{}}{%
\renewcommand{\doclicense@lang}{\languagename}}{}
\IfFileExists{doclicense-\doclicense@lang.ldf}{%
- \input{doclicense-\doclicense@lang.ldf}
+ \input{doclicense-\doclicense@lang.ldf}% chktex 27
}{%
\PackageWarning{doclicense}{%
No language definition for \doclicense@lang found.
- Please add one and submit a patch. Using English as fallback.}
+ Please add one and submit a patch. Using English as fallback.
+ }
\renewcommand{\doclicense@lang}{english}
- \input{doclicense-\doclicense@lang.ldf}
+ \input{doclicense-\doclicense@lang.ldf}% chktex 27
}
\ifthenelse{\equal{\doclicense@imagemodifier}{-us}}{%
\@namedef{doclicense@imagemodifier}{}
@@ -245,46 +284,39 @@
}
\ifthenelse{\equal{\doclicense@modifier}{by}}{%
\renewcommand{\doclicense@icon}{\ccby}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-sa}}{%
\renewcommand{\doclicense@icon}{\ccbysa}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nd}}{%
\renewcommand{\doclicense@icon}{\ccbynd}
- \renewcommand{\doclicense@imagemodifier}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc}}{%
\renewcommand{\doclicense@icon}{\ccbync}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@icon}{\ccbynceu}
}{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncjp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-sa}}{
\renewcommand{\doclicense@icon}{\ccbyncsa}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@icon}{\ccbyncsaeu}
}{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncsajp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{by-nc-nd}}{
\renewcommand{\doclicense@icon}{\ccbyncnd}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
- \renewcommand{\doclicense@icon}{\ccbyncndeu}
- }{}
- \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{%
+ \IfBeginWith{\doclicense@imagemodifier}{-jp}{%
\renewcommand{\doclicense@icon}{\ccbyncndjp}
}{}
}{}
\ifthenelse{\equal{\doclicense@modifier}{zero}}{%
\renewcommand{\doclicense@icon}{\cczero}
- \renewcommand{\doclicense@imagemodifier}{}
\doclicense@setVersion[1.0]
\edef\doclicenseURL{%
\doclicense@baseUrlCC/%
@@ -293,33 +325,34 @@
\doclicense@versionUsed\doclicense@UrlLangPart}
}{}
\ifthenelse{\equal{\doclicense@modifier}{pd}}{
- \renewcommand{\doclicense@icon}{\ccpd}
- \renewcommand{\doclicense@imagemodifier}{}
- \doclicense@setVersion[null]
- \edef\doclicenseURL{%
- \doclicense@baseUrlCC/%
- licenses/publicdomain%
- \doclicense@UrlLangPart}
+ \PackageError{doclicense}{CC PD license removed as of version 2.0.0}{
+ Creative Commons PD has been replaced by CC-zero.
+ Please update your license choice.
+ }%
}{}
+ \IfSubStr{\doclicense@modifier}{nc}{}{
+ %% eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
+ \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{%
+ \renewcommand{\doclicense@imagemodifier}{}
+ }{}
+ }
\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.%
- }%
+ \PackageError{doclicense}{License long name not defined}{%
+ Please check the manual 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.%
- }%
+ \PackageError{doclicense}{License unknown}{%
+ Please check the manual of doclicense
+ to see what you can do about it.%
+ }%
}{}%
}
%% )))