diff options
Diffstat (limited to 'Master/texmf-dist/source/latex/doclicense')
-rw-r--r-- | Master/texmf-dist/source/latex/doclicense/doclicense.dtx | 104 |
1 files changed, 70 insertions, 34 deletions
diff --git a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx index 6227d0987f2..e75464b7613 100644 --- a/Master/texmf-dist/source/latex/doclicense/doclicense.dtx +++ b/Master/texmf-dist/source/latex/doclicense/doclicense.dtx @@ -27,7 +27,7 @@ %<package>\NeedsTeXFormat{LaTeX2e}[1998/12/01] %<package>\ProvidesPackage{doclicense} %<*package> - [2015/04/06 v1.1 Support for putting documents under a license] + [2015/05/16 v1.2 Support for putting documents under a license] %</package> % %<*driver> @@ -114,6 +114,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % \changes{0.10}{2015/02/13}{Added support for hyperxmp} % \changes{1.0}{2015/03/30}{Removed space before quotes (Example: \enquote{CC } $\rightarrow$ \enquote{CC})} % \changes{1.1}{2015/04/06}{Added support for Creative Commons 4.0 and added \cmd{\doclicenseImageFileName}} +% \changes{1.2}{2015/04/06}{Allow \cmd{\doclicenseModifier} to be used with hyperref. Fixed \cmd{\doclicenseIcon} macro, added missing image and wrote test framework. Added notes about how to add translations. Added Spanish translation.} % % \DoNotIndex{\RequirePackage, \DeclareOption, \ProcessOptions} % \DoNotIndex{\PackageWarning, \MessageBreak} @@ -200,7 +201,13 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % If this parameter is omitted, then this package will default to % \cmd{\languagename} which is normally set by packages like % \PrintPackage{babel} or \PrintPackage{polyglossia}. -% Currently only English and German are supported. +% +% Supported languages: +% \begin{eqlist} +% \item[English] Added by \href{https://github.com/ypid}{Robin Schneider}. +% \item[German] Added by \href{https://github.com/ypid}{Robin Schneider}. +% \item[Spanish] Added by \href{https://github.com/elsudano}{Carlos}. +% \end{eqlist} % % Default image width for the license image. % \DescribePara{imagewidth} @@ -319,13 +326,13 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % \item[by-nd@3.0] \@nameuse{doclicense@lang@lic@CC@by-nd@3.0} % \item[by-nc@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc@3.0} % \item[by-nc-sa@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@3.0} -% \item[by-nc-nc@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@3.0} +% \item[by-nc-nd@3.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@3.0} % \item[by@4.0] \@nameuse{doclicense@lang@lic@CC@by@4.0} % \item[by-sa@4.0] \@nameuse{doclicense@lang@lic@CC@by-sa@4.0} % \item[by-nd@4.0] \@nameuse{doclicense@lang@lic@CC@by-nd@4.0} % \item[by-nc@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc@4.0} % \item[by-nc-sa@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-sa@4.0} -% \item[by-nc-nc@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@4.0} +% \item[by-nc-nd@4.0] \@nameuse{doclicense@lang@lic@CC@by-nc-nd@4.0} % \end{eqlist} % \makeatother % @@ -335,6 +342,19 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % to modify the .sty file, make sure that you make your changes in the .dtx % file instead, as the .sty file is automatically generated. % +% In case you want to add a translation for your language then just copy the +% file \path{doclicense-english.ldf} and replace the \enquote{english} in +% the filename with your language code (same as the language code used by +% \PrintPackage{babel}) and translate the file. +% If there are multiple language +% codes which should map to same translation then have a look at the file +% \path{doclicense-american.ldf}. +% +% When you are done and tested your translation (modify and run the +% \path{run_tests} script) then please send me the translated file(s) either +% via Email or preferably by opening a pull request on GitHub so that I can +% include them in the next release. +% % \StopEventually{} % % \newpage @@ -346,7 +366,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % This package depends on these packages. % \begin{macrocode} -%% Dependencies {{{ +%% Dependencies ((( \RequirePackage{kvoptions} \RequirePackage{xifthen} \RequirePackage{etoolbox} %% \ifcsdef @@ -366,19 +386,19 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} } }{} } -%% }}} +%% ))) % \end{macrocode} % \subsection{Declaring the options} % \begin{macrocode} -%% Parameters {{{ +%% Parameters ((( \DeclareStringOption[CC]{type} \DeclareStringOption[by-sa]{modifier} \DeclareStringOption{version} \DeclareStringOption{lang} \DeclareStringOption{imagemodifier} \DeclareStringOption[10em]{imagewidth} -%% }}} +%% ))) % \end{macrocode} % To test if all parameters are valid the macro |\ProcessLocalKeyvalOptions*| @@ -389,7 +409,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % \end{macrocode} % \subsection{Declare variables and macros} % \begin{macrocode} -%% Declare variables {{{ +%% Declare variables ((( \newcommand{\doclicense@baseUrlCC}{https://creativecommons.org} \newcommand{\doclicense@versionFallback}{} \newcommand{\doclicense@versionUsed}{} @@ -403,18 +423,19 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \PackageError{doclicense}{Icon not defined} {Please check the documentation of doclicense to see what you can do about it.}% } -%% }}} +\newcommand{\doclicense@modifier@uppercase}{\texorpdfstring{\MakeUppercase{\doclicense@modifier}}{\doclicense@modifier}} +%% ))) % \end{macrocode} % \subsection{Macro user macros} % \begin{macrocode} -%% User macros {{{ +%% User macros ((( \newcommand{\doclicenseType}{\doclicense@type\xspace} \newcommand{\doclicenseLongType}{} -\newcommand{\doclicenseModifier}{\MakeUppercase{\doclicense@modifier}\xspace} +\newcommand{\doclicenseModifier}{\doclicense@modifier@uppercase\xspace} \newcommand{\doclicenseVersion}{\doclicense@versionUsed\xspace} \newcommand{\doclicenseName}{% - \doclicense@type~\MakeUppercase{\doclicense@modifier}~\doclicense@versionUsed\xspace% + \doclicense@type~\doclicense@modifier@uppercase~\doclicense@versionUsed\xspace% } \newcommand{\doclicenseNameRef}{\href{\doclicenseURL}{\doclicenseName}\xspace} \newcommand{\doclicenseLongName}{\doclicenseLongType\space\doclicense@longName\xspace} @@ -457,7 +478,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \end{minipage} \end{center} } -%% }}} +%% ))) % \end{macrocode} % \subsection{Language selection} @@ -465,7 +486,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} % should be stored there or can be changed there. Note that one could redefine % macros like \cmd{\doclicenseLongText} if necessary. % \begin{macrocode} -%% Language support {{{ +%% Language support ((( \ifthenelse{\equal{\doclicense@lang}{}}{% \renewcommand{\doclicense@lang}{\languagename}}{} \IfFileExists{doclicense-\doclicense@lang.ldf}{% @@ -481,12 +502,12 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \@namedef{doclicense@imagemodifier}{} }{} -%% }}} +%% ))) % \end{macrocode} % \subsection{Internals} % \begin{macrocode} -%% Set license {{{ +%% Set license ((( \newcommand{\doclicense@setVersion}[1][]{% \ifthenelse{\equal{#1}{}}{}{% \renewcommand{\doclicense@versionFallback}{#1} @@ -498,7 +519,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} } } \newcommand{\doclicense@set}{% - %% CC {{{ + %% CC ((( \ifthenelse{\equal{\doclicense@type}{CC}}{% \renewcommand{\doclicenseLongType}{Creative Commons\xspace} @@ -509,16 +530,7 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \ifthenelse{\equal{\doclicense@lang@lic@CC@code}{}}{% \edef\doclicense@UrlLangPart{} }{% - \ifthenelse{% - %% German only: Version 3.0 and version 4.0 use a different different URL schema. - \equal{\doclicense@lang@lic@CC@code}{de}% - \AND% - \equal{\doclicense@versionUsed}{4.0}% - }{% - \edef\doclicense@UrlLangPart{/\doclicense@lang@translation@lic@CC@code} - }{% - \edef\doclicense@UrlLangPart{/\doclicense@lang@lic@CC@code} - } + \edef\doclicense@UrlLangPart{/deed.\doclicense@lang@lic@CC@code} } } \ifcsdef{doclicenseURL}{}{% @@ -529,6 +541,10 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} \doclicense@versionUsed\doclicense@UrlLangPart% } } + \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}{} @@ -539,12 +555,32 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} }{} \ifthenelse{\equal{\doclicense@modifier}{by-nc}}{% \renewcommand{\doclicense@icon}{\ccbync} + \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{% + \renewcommand{\doclicense@icon}{\ccbynceu} + }{} + \ifthenelse{\equal{\doclicense@imagemodifier}{-jp}}{% + \renewcommand{\doclicense@icon}{\ccbyncjp} + }{} \renewcommand{\doclicense@imagemodifier}{} }{} - \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}{by-nc-sa}}{ + \renewcommand{\doclicense@icon}{\ccbyncsa} + \ifthenelse{\equal{\doclicense@imagemodifier}{-eu}}{% + \renewcommand{\doclicense@icon}{\ccbyncsaeu} + }{} + \ifthenelse{\equal{\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}}{% + \renewcommand{\doclicense@icon}{\ccbyncndjp} + }{} + }{} \ifthenelse{\equal{\doclicense@modifier}{zero}}{% \renewcommand{\doclicense@icon}{\cczero} \renewcommand{\doclicense@imagemodifier}{} @@ -573,13 +609,13 @@ corresponds to \PackageName~\fileversion, dated \filedate.}} } \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% % \end{macrocode} |