summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/lualatex/datestamp/datestamp.sty
blob: c9323fc2d6bead8f9cd77dc54c11d88a56723736 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
%%
%% This is file `datestamp.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% datestamp.dtx  (with options: `package')
%% -----------------------------------------------------------
%% Package:     datestamp
%% Version:     v0.3 (14 December, 2021)
%% Author:      निरंजन
%% Description: Fixed date-stamps with LuaLaTeX.
%% Repository:  http://puszcza.gnu.org.ua/projects/datestamp
%% License:     GPLv3+, GFDLv1.3+
%% -----------------------------------------------------------
%% 
%% LaTeX Package datestamp v0.3
%% 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.
%% 
%% 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.
%% ----------------------------------------------------------
\def\datestampname{datestamp}
\def\datestampversion{0.3}
\def\datestampdate{2021-12-14}
\def\datestampdescription{%
  Fixed date-stamps with LuaLaTeX.%
}
\ProvidesPackage{datestamp}[2021/12/14 v0.3
Fixed date-stamps with LuaLaTeX.]
\RequirePackage{xparse}
\NewDocumentCommand{\luacodefordatestamp}{ m m }{%
  \directlua{%
    dsfile = io.open("\jobname.ds", "a+")
    dscontent = dsfile:read "*a"
    if string.find(dscontent, "#1") then
    else
      dsfile:write("#1 = \string\"#2\string\"\string\n")
      io.close(dsfile)
    end
    dofile("\jobname.ds")
    tex.sprint(#1)
  }%
}
\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}%
}%
\endinput
%%
%% End of file `datestamp.sty'.