summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
diff options
context:
space:
mode:
authorKarl Berry <karl@freefriends.org>2021-03-14 22:51:48 +0000
committerKarl Berry <karl@freefriends.org>2021-03-14 22:51:48 +0000
commit61214586c288947b3272b5551d439dc8a9eb7c86 (patch)
treed9fac085f8f49442f371917a04313764b8ca71e6 /Master/texmf-dist/tex/latex/doclicense/doclicense.sty
parent11cb80cef7eaad10df3ed09d6d5a50ad2c055881 (diff)
doclicense (14mar21)
git-svn-id: svn://tug.org/texlive/trunk@58350 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/tex/latex/doclicense/doclicense.sty')
-rw-r--r--Master/texmf-dist/tex/latex/doclicense/doclicense.sty75
1 files changed, 38 insertions, 37 deletions
diff --git a/Master/texmf-dist/tex/latex/doclicense/doclicense.sty b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
index b33f93a854d..1a34bc17db7 100644
--- a/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
+++ b/Master/texmf-dist/tex/latex/doclicense/doclicense.sty
@@ -1,11 +1,16 @@
-%% See file 'doclicense.dtx' for copyright and license.
+% SPDX-FileCopyrightText: 2015-2021 Robin Schneider <ypid@riseup.net>
+%
+% SPDX-License-Identifier: LPPL-1.3c
+%
+% This work consists of all files listed in manifest.txt.
+% For more details about the licensing, refer to the README.md file.
+% If you don't have those files, you can find them at: https://ctan.org/pkg/doclicense
+
\NeedsTeXFormat{LaTeX2e}[1998/12/01]
\ProvidesPackage{doclicense}
- [2020/09/25 v2.2.1 Support for putting documents under a license]
+ [2021/03/13 v2.3.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{type}
\DeclareStringOption{modifier}
@@ -16,19 +21,16 @@
\DeclareStringOption[10em]{imagewidth}
\DeclareStringOption[2em]{imagedistance}
\DeclareStringOption{hyphenation}
-%% )))
+\DeclareBoolOption[true]{hyperxmp}
\ProcessLocalKeyvalOptions*
-%% Dependencies (((
\RequirePackage{xifthen}
\RequirePackage{xstring}
-\RequirePackage{etoolbox} %% \ifcsdef
+\RequirePackage{etoolbox} % \ifcsdef
\RequirePackage{xspace}
\RequirePackage{verbatim}
-%% Custom enumerate list with adjusted labels
-%% that match the license text conventions
\newenvironment{doclicense@enumerate}{%
\begin{enumerate}
\renewcommand{\labelenumi}{(\alph{enumi})}%
@@ -49,10 +51,10 @@
}
\AtEndPreamble{%
\@ifpackageloaded{csquotes}{
- %% csquotes has already been loaded so we are fine.
+ % csquotes has already been loaded so we are fine.
}{
\ifcsdef{enquote}{
- %% \enquote is defined but not by csquotes.
+ % \enquote is defined but not by csquotes.
\@ifpackageloaded{biblatex}{
\PackageError{doclicense}{The enquote macro is defined by biblatex}
{This package assumes that the enquote macro is defined by the
@@ -70,29 +72,37 @@
}
}
\@ifpackageloaded{ccicons}{}{\RequirePackage{ccicons}}
- %% For \doclicenseIcon
+ % For \doclicenseIcon
\@ifpackageloaded{graphicx}{}{\RequirePackage{graphicx}}
- %% For \doclicenseImage
+ % For \doclicenseImage
\@ifpackageloaded{hyperref}{}{\RequirePackage{hyperref}}
\@ifpackageloaded{hyperxmp}{
- %% The following options are only defined when the hyperxmp package was loaded.
+ % The following options are only defined when the hyperxmp package was loaded.
\hypersetup{
pdfcopyright = {\doclicenseLongText},
pdflicenseurl = {\doclicenseURL},
}
}{}
}
-\IfFileExists{hyperxmp.sty}{
- \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}}
-}{
- \PackageWarning{doclicense}{%
- The hyperxmp package is missing so no license metadata can be embedded
- into the PDF. Consider installing hyperxmp.% chktex 13
+\ifdoclicense@hyperxmp
+ \@ifpackageloaded{pdfx}{%
+ \PackageWarning{doclicense}{%
+ The pdfx package was detected. Therefore the mechanism to add license
+ metadata won't work. Ensure to setup \string\Copyright\space and
+ corresponding settings to your xmpdata-file.
}
-}
-%% )))
+ }{
+ \IfFileExists{hyperxmp.sty}{
+ \@ifpackageloaded{hyperxmp}{}{\RequirePackage{hyperxmp}}
+ }{
+ \PackageWarning{doclicense}{%
+ The hyperxmp package is missing so no license metadata can be embedded
+ into the PDF. Consider installing hyperxmp.% chktex 13
+ }
+ }
+ }
+\fi
-%% Deprecation handling (((
\ifthenelse{
\equal{\doclicense@type}{}
}{
@@ -127,9 +137,7 @@
Please explicitly pick a license of your choosing.
}
}{}
-%% )))
-%% Declare variables (((
\@namedef{doclicense@lang@lic@CC}{Creative Commons}%
\newcommand{\doclicense@baseUrlCC}{https://creativecommons.org}
\newcommand{\doclicense@versionFallback}{}
@@ -149,9 +157,7 @@
}{%
\doclicense@modifier}%
}
-%% )))
-%% User macros (((
\newcommand{\doclicenseType}{\doclicense@type\xspace}
\newcommand{\doclicenseLongType}{}
\newcommand{\doclicenseModifier}{\doclicense@modifier@uppercase\xspace}
@@ -197,7 +203,7 @@
doclicense-\doclicense@type-\doclicense@modifier-\doclicense@versionUsed-latex}
\newcommand{\doclicenseFullText}{\input{\doclicenseFullTextFileName}}% chktex 27
-\newcommand{\doclicenseLicense}{\doclicenseThis} %% legacy support
+\newcommand{\doclicenseLicense}{\doclicenseThis} % legacy support
\newcommand{\doclicenseThis}{%
\setlength{\doclicense@hsize}{\linewidth-\doclicense@imagewidth-\doclicense@imagedistance}%
\ifthenelse{\equal{\doclicense@imageposition}{left}}{%
@@ -235,9 +241,7 @@
% }
}
}
-%% )))
-%% Language support (((
\ifthenelse{\equal{\doclicense@lang}{}}{%
\renewcommand{\doclicense@lang}{\languagename}}{}
\IfFileExists{doclicense-\doclicense@lang.ldf}{%
@@ -254,9 +258,7 @@
\@namedef{doclicense@imagemodifier}{-88x31}% chktex 29
}{}
-%% )))
-%% Set license (((
\newcommand{\doclicense@setVersion}[1][]{%
\ifthenelse{\equal{#1}{}}{}{%
\renewcommand{\doclicense@versionFallback}{#1}
@@ -268,14 +270,14 @@
}
}
\newcommand{\doclicense@set}{%
- %% CC (((
+ % CC (((
\ifthenelse{\equal{\doclicense@type}{CC}}{%
\renewcommand{\doclicenseLongType}{\doclicense@lang@lic@CC\xspace}
\renewcommand{\doclicenseTypeIcon}{\ccLogo\xspace}
\doclicense@setVersion[3.0]
- %% Allow to predefine the following macros in ldf files.
+ % Allow to predefine the following macros in ldf files.
\ifcsdef{doclicense@UrlLangPart}{}{%
\ifthenelse{\equal{\doclicense@lang@lic@CC@code}{}}{%
\edef\doclicense@UrlLangPart{}
@@ -343,7 +345,7 @@
}%
}{}
\IfSubStr{\doclicense@modifier}{nc}{}{
- %% eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
+ % eu (Euro) does only exist for nc (non commercial) so if not nc then reset -eu.
\IfBeginWith{\doclicense@imagemodifier}{-eu}{%
\renewcommand{\doclicense@imagemodifier}{-88x31}% chktex 29
}{}
@@ -362,7 +364,7 @@
}
\setboolean{doclicense@licenseKnown}{true}
- }{}%% )))
+ }{}% )))
\ifthenelse{\not\boolean{doclicense@licenseKnown}}{%
\PackageError{doclicense}{License unknown}{%
Please check the manual of doclicense
@@ -370,7 +372,6 @@
}%
}{}%
}
-%% )))
\doclicense@set%
\endinput