diff options
author | Karl Berry <karl@freefriends.org> | 2021-10-22 21:38:24 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2021-10-22 21:38:24 +0000 |
commit | abde33f8241a26a6b42ff9a290306966536c55cf (patch) | |
tree | e5039a06f5fa85882ed807481053b226285a1b4c /Master/texmf-dist/source/lualatex/datestamp | |
parent | 714e4e72525ca89ed873ed0d03d7ba3fe97caf61 (diff) |
datestamp (22oct21)
git-svn-id: svn://tug.org/texlive/trunk@60841 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Master/texmf-dist/source/lualatex/datestamp')
-rw-r--r-- | Master/texmf-dist/source/lualatex/datestamp/datestamp.dtx | 218 | ||||
-rw-r--r-- | Master/texmf-dist/source/lualatex/datestamp/datestamp.ins | 55 |
2 files changed, 273 insertions, 0 deletions
diff --git a/Master/texmf-dist/source/lualatex/datestamp/datestamp.dtx b/Master/texmf-dist/source/lualatex/datestamp/datestamp.dtx new file mode 100644 index 00000000000..39494d88d9b --- /dev/null +++ b/Master/texmf-dist/source/lualatex/datestamp/datestamp.dtx @@ -0,0 +1,218 @@ +% \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+ +% ---------------------------------------------------- +% +% LaTeX Package datestamp v0.1 +% © 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. +% +% This program is distributed in the hope that it will be +% useful, but WITHOUT ANY WARRANTY; without even the implied +% warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +% PURPOSE. See the GNU General Public License for more +% details. +% +% You should have received a copy of the GNU General Public +% License along with this program. If not, see +% <https://www.gnu.org/licenses/>. +% +% The current maintainer of this work is निरंजन. +% +% This work consists of the files datestamp.dtx +% datestamp.ins +% and the derived file datestamp.sty. +% \fi +% \iffalse +%<*internal> +\iffalse +%</internal> +%<*readme> +---------------------------------------------------------- +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+ +---------------------------------------------------------- +%</readme> +%<*internal> +\fi +%</internal> +%<*driver|package> +\def\datestampname{datestamp} +\def\datestampversion{0.1} +\def\datestampdate{2021-10-22} +\def\datestampdescription{% + Fixed date-stamps with LuaLaTeX.% +} +%</driver|package> +%<*driver> +\documentclass{l3doc} +\usepackage{xcolor} +\usepackage{fontawesome5} +\usepackage{fancyvrb} +\usepackage{hyperref} +\hypersetup{% + unicode,% + colorlinks,% + urlcolor=blue!60!black,% + linkcolor=blue!60!black,% + citecolor=green!60!black,% + pdftitle={The datestamp package},% + pdfauthor={निरंजन},% + pdfsubject={\datestampdescription} +}% +\usepackage{fontspec} +\newfontfamily\devanagari[% + Script=Devanagari,% + Scale=0.8% +]% +{Shobhika} +\newcommand\textcode[1]{\Verb|#1|} + +\begin{document} + \DocInput{\datestampname.dtx} +\end{document} +%</driver> +% \fi +% \title{The \pkg{\datestampname} package} +% \author{{\devanagari निरंजन}} +% \date^^A +% {^^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 +% } +% +% \maketitle +% +% \begin{documentation} +% \begin{abstract} +% \href{https://tex.stackexchange.com/q/611721/174620}% +% {This} question on SE inspired me to write a code +% which can store and recall dates whenever needed. +% Lua\LaTeX\ provided a smooth interface for achieving +% this and thus this package was developed. +% \end{abstract} +% +% \begin{function}{\adddatestamp} +% \begin{syntax} +% \cs{adddatestamp} \marg{key} +% \end{syntax} +% This command takes one mandatory argument which is the +% key that we set for printing the date. The key is +% printed in the auxiliary file with extension +% \verb|.ds|. If in case one loses their auto-generated +% \verb|.ds| file, they can simply write one with +% whichever dates of their choice. e.g.\ A sample +% \verb|.ds| file might look like the following. +% \begin{verbatim} +% firstdate = "August 21, 2021" +% seconddate = "September 21, 2021" +% thirddate = "October 22, 2021" +% \end{verbatim} +% One can fool the program by writing a file like this +% themselves! +% \end{function} +% \vfill +% {^^A +% \setlength{\parindent}{0pt} +% \LaTeX\ package \pkg{datestamp} +% +% © 2021 {\devanagari निरंजन} +% +% Permission is granted to copy, distribute and/or +% modify this document under the terms of the GNU Free +% Documentation License, Version 1.3 or any later +% version published by the Free Software Foundation; +% with no Invariant Sections, no Front-Cover Texts, and +% no Back-Cover Texts. A copy of the license is included +% in the section entitled ``GNU Free Documentation +% License''. +% }% +% \end{documentation} +% \newpage +% \begin{implementation} +% \section{Implementation} +% Provide package with its basic information. +% \begin{macrocode} +%<@@=datestamp> +%<*package> +\ProvidesPackage{datestamp}[2021/10/22 v0.1 +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 +% file. Note that using \verb|a+| mode also enables the +% \verb|read| mode. +% \begin{macrocode} +\RequirePackage{xparse} +\NewDocumentCommand{\adddatestamp}{ m }{ + \directlua{ + dsfile = io.open("\jobname.ds", "a+") +% \end{macrocode} +% Now we store the content of the \verb|.ds| file in a +% variable named \verb|dscontent|. +% \begin{macrocode} + dscontent = dsfile:read "*a" +% \end{macrocode} +% We first check if the key used in the argument of +% \cs{adddatestamp} is already present in our aux file and +% 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.} +% ;-) +% \begin{macrocode} + if string.find(dscontent, "#1") then + else + dsfile:write("#1 = \string\"\today\string\"\string\n") + io.close(dsfile) + end +% \end{macrocode} +% With \verb|dofile| command we execute the \verb|.ds| file +% as a Lua code. With this our keys automatically become Lua +% variables which store the dates. +% \begin{macrocode} + dofile("\jobname.ds") +% \end{macrocode} +% Finally we print the dates by calling the key as a Lua +% variable. +% \begin{macrocode} + tex.sprint(#1) + } +} +% \end{macrocode} +% \begin{macrocode} +%</package> +% \end{macrocode} +% \end{implementation} +% \newpage +% \addcontentsline{toc}{section}{GNU Free Documentation License} +% \include{gfdl-tex.tex} +% \Finale diff --git a/Master/texmf-dist/source/lualatex/datestamp/datestamp.ins b/Master/texmf-dist/source/lualatex/datestamp/datestamp.ins new file mode 100644 index 00000000000..291552f7a7b --- /dev/null +++ b/Master/texmf-dist/source/lualatex/datestamp/datestamp.ins @@ -0,0 +1,55 @@ +% File: datestamp.ins +\input l3docstrip.tex + +\keepsilent +\askforoverwritefalse + +\preamble +---------------------------------------------------------- +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+ +---------------------------------------------------------- + +LaTeX Package datestamp v0.1 +© 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. + +This program is distributed in the hope that it will be +useful, but WITHOUT ANY WARRANTY; without even the implied +warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR +PURPOSE. See the GNU General Public License for more +details. + +You should have received a copy of the GNU General Public +License along with this program. If not, see +<https://www.gnu.org/licenses/>. + +The current maintainer of this work is निरंजन. + +This work consists of the files datestamp.dtx + datestamp.ins +and the derived file datestamp.sty. +---------------------------------------------------------- +\endpreamble + +\usedir{tex/latex/\jobname} +\generate{ + \file{\jobname.sty}{\from{\jobname.dtx}{package}} +} + +\nopreamble\nopostamble +\usedir{doc/latex/\jobname} +\generate{ + \file{README.txt}{\from{\jobname.dtx}{readme}} +} + +\endbatchfile |