diff options
author | Norbert Preining <norbert@preining.info> | 2021-12-12 03:01:11 +0000 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2021-12-12 03:01:11 +0000 |
commit | 9ed1a61f45b05f58016912a6bd6c13daab6db9eb (patch) | |
tree | 0c77bf9276a99c43b069307630529d8ef5148a94 /macros/luatex/latex/datestamp/datestamp.dtx | |
parent | 73df0102afe7e9fee9026c69fb805ab5fa138b49 (diff) |
CTAN sync 202112120301
Diffstat (limited to 'macros/luatex/latex/datestamp/datestamp.dtx')
-rw-r--r-- | macros/luatex/latex/datestamp/datestamp.dtx | 127 |
1 files changed, 81 insertions, 46 deletions
diff --git a/macros/luatex/latex/datestamp/datestamp.dtx b/macros/luatex/latex/datestamp/datestamp.dtx index 39494d88d9..7e9861f42e 100644 --- a/macros/luatex/latex/datestamp/datestamp.dtx +++ b/macros/luatex/latex/datestamp/datestamp.dtx @@ -1,23 +1,23 @@ % \iffalse meta-comment % % File: datestamp.dtx -% ---------------------------------------------------- -% Package: datestamp -% Version: v0.1 (22 October, 2021) -% Author: निरंजन -% Description: Fixed date-stamps with LuaLaTeX. -% Repository: https://gitlab.com/niruvt/datestamp -% License: GPLv3+, GFDLv1.3+ -% ---------------------------------------------------- +% ---------------------------------------------------------- +% Package: datestamp +% Version: v0.2 (08 December, 2021) +% Author: निरंजन +% Description: Fixed date-stamps with LuaLaTeX. +% Repository: http://savannah.nongnu.org/projects/datestamp +% License: GPLv3+, GFDLv1.3+ +% ---------------------------------------------------------- % -% LaTeX Package datestamp v0.1 -% © 2021 निरंजन +% LaTeX Package datestamp v0.2 +% Copyright © 2021 निरंजन % % This program is free software: you can redistribute it % and/or modify it under the terms of the GNU General Public -% License as published by the Free Software Foundation, either -% version 3 of the License, or (at your option) any later -% version. +% License as published by the Free Software Foundation, +% either version 3 of the License, or (at your option) any +% later version. % % This program is distributed in the hope that it will be % useful, but WITHOUT ANY WARRANTY; without even the implied @@ -40,22 +40,22 @@ \iffalse %</internal> %<*readme> ----------------------------------------------------------- +----------------------------------------------------------- Package: datestamp -Version: v0.1 (22 October, 2021) +Version: v0.2(08 December, 2021) Author: निरंजन Description: Fixed date-stamps with LuaLaTeX -Repository: https://gitlab.com/niruvt/datestamp +Repository: http://savannah.nongnu.org/projects/datestamp License: GPLv3+, GFDLv1.3+ ----------------------------------------------------------- +----------------------------------------------------------- %</readme> %<*internal> \fi %</internal> %<*driver|package> \def\datestampname{datestamp} -\def\datestampversion{0.1} -\def\datestampdate{2021-10-22} +\def\datestampversion{0.2} +\def\datestampdate{2021-12-08} \def\datestampdescription{% Fixed date-stamps with LuaLaTeX.% } @@ -91,17 +91,17 @@ License: GPLv3+, GFDLv1.3+ % \fi % \title{The \pkg{\datestampname} package} % \author{{\devanagari निरंजन}} -% \date^^A +% \date % {^^A -% Version \datestampversion\ --- \datestampdate\\[1ex]^^A -% {^^A -% \small\faIcon{link}\quad -% \url{https://ctan.org/pkg/datestamp}^^A -% }\\^^A -% {^^A -% \small\faIcon{gitlab}\quad -% \url{https://gitlab.com/niruvt/datestamp}^^A -% }^^A +% Version \datestampversion\ --- \datestampdate\\[1ex]^^A +% {^^A +% \small\faIcon{link}\quad +% \url{https://ctan.org/pkg/datestamp}^^A +% }\\^^A +% {^^A +% \small\faIcon{bug}\quad +% \url{http://savannah.nongnu.org/bugs/?group=datestamp}^^A +% }^^A % } % % \maketitle @@ -114,7 +114,7 @@ License: GPLv3+, GFDLv1.3+ % Lua\LaTeX\ provided a smooth interface for achieving % this and thus this package was developed. % \end{abstract} -% +% \section{Documentation} % \begin{function}{\adddatestamp} % \begin{syntax} % \cs{adddatestamp} \marg{key} @@ -134,12 +134,29 @@ License: GPLv3+, GFDLv1.3+ % One can fool the program by writing a file like this % themselves! % \end{function} +% \begin{function}{\addmonthstamp} +% \begin{syntax} +% \cs{addmonthstamp} \marg{key} +% \end{syntax} +% Similar to \cs{adddatestamp}, this command prints a +% fixed month-stamp. +% \end{function} +% \begin{function}{\addyearstamp} +% \begin{syntax} +% \cs{addyearstamp} \marg{key} +% \end{syntax} +% This command prints a fixed year-stamp. +% \end{function} % \vfill +% +% \hrule +% +% \medskip % {^^A % \setlength{\parindent}{0pt} % \LaTeX\ package \pkg{datestamp} % -% © 2021 {\devanagari निरंजन} +% Copyright © 2021 {\devanagari निरंजन} % % Permission is granted to copy, distribute and/or % modify this document under the terms of the GNU Free @@ -158,20 +175,21 @@ License: GPLv3+, GFDLv1.3+ % \begin{macrocode} %<@@=datestamp> %<*package> -\ProvidesPackage{datestamp}[2021/10/22 v0.1 +\ProvidesPackage{datestamp}[2021/12/08 v0.2 Fixed date-stamps with LuaLaTeX.] % \end{macrocode} % Load package \pkg{xparse} for declaring the robust command -% \cs{adddatestamp}. Call \cs{directlua} \& open a file in -% append mode so that it will be created if doesn't exist -% \& only appended if exists. The following code creates a -% file with extension \verb|.ds| \& the name of the root +% \cs{luacodefordatestamp}. This is a generic \& internal +% command. We will Call \cs{directlua} \& open a file in +% append mode so that it will be created if doesn't exist \& +% just appended if exists. The following code creates a file +% with the extension \verb|.ds| \& the name of the root % file. Note that using \verb|a+| mode also enables the % \verb|read| mode. % \begin{macrocode} \RequirePackage{xparse} -\NewDocumentCommand{\adddatestamp}{ m }{ - \directlua{ +\NewDocumentCommand{\luacodefordatestamp}{ m m }{% + \directlua{% dsfile = io.open("\jobname.ds", "a+") % \end{macrocode} % Now we store the content of the \verb|.ds| file in a @@ -184,14 +202,11 @@ Fixed date-stamps with LuaLaTeX.] % if it is present, our code does nothing. It adds the key % followed by the \verb|=| sign and the date to the % \verb|.ds| file if the key is absent. We close the file -% when this job is done \& we end the if-conditional. Note -% that Lua itself is writing some Lua-code\footnote{The -% output of this process produces the actual syntax of Lua.} -% ;-) +% when this job is done \& we end the if-conditional. % \begin{macrocode} if string.find(dscontent, "#1") then else - dsfile:write("#1 = \string\"\today\string\"\string\n") + dsfile:write("#1 = \string\"#2\string\"\string\n") io.close(dsfile) end % \end{macrocode} @@ -201,18 +216,38 @@ Fixed date-stamps with LuaLaTeX.] % \begin{macrocode} dofile("\jobname.ds") % \end{macrocode} -% Finally we print the dates by calling the key as a Lua -% variable. +% Finally we print the date by calling the key as a Lua +% variable (which is by the way our \TeX-argument XD). % \begin{macrocode} tex.sprint(#1) - } + }% } % \end{macrocode} +% After creating this generic internal command, we use it +% for producing various stamps. i.e.\ date, month \& year. I +% am using the default \TeX-commands for producing them as +% these commands have great localization-support. +% \begin{macrocode} +\NewDocumentCommand{\adddatestamp}{ m }{% + \luacodefordatestamp{#1}{\today}% +}% +\NewDocumentCommand{\addyearstamp}{ m }{% + \luacodefordatestamp{#1}{\the\year}% +}% +\NewDocumentCommand{\addmonthstamp}{ m }{% + \luacodefordatestamp{#1}{\the\month}% +}% +\NewDocumentCommand{\adddaystamp}{ m }{% + \luacodefordatestamp{#1}{\the\day}% +}% +% \end{macrocode} +% End of the package. % \begin{macrocode} %</package> % \end{macrocode} % \end{implementation} % \newpage +% \phantomsection % \addcontentsline{toc}{section}{GNU Free Documentation License} % \include{gfdl-tex.tex} % \Finale |