Debian Codegraph @

texmf-dist/source/latex/datetime2-bahasai/datetime2-bahasai.dtx

raw
1 %\iffalse
2 %<*package>
3 %% \CharacterTable
4 %% {Upper-case \A\B\C\D\E\F\G\H\I\J\K\L\M\N\O\P\Q\R\S\T\U\V\W\X\Y\Z
5 %% Lower-case \a\b\c\d\e\f\g\h\i\j\k\l\m\n\o\p\q\r\s\t\u\v\w\x\y\z
6 %% Digits \0\1\2\3\4\5\6\7\8\9
7 %% Exclamation \! Double quote \" Hash (number) \#
8 %% Dollar \$ Percent \% Ampersand \&
9 %% Acute accent \' Left paren \( Right paren \)
10 %% Asterisk \* Plus \+ Comma \,
11 %% Minus \- Point \. Solidus \/
12 %% Colon \: Semicolon \; Less than \<
13 %% Equals \= Greater than \> Question mark \?
14 %% Commercial at \@ Left bracket \[ Backslash \\
15 %% Right bracket \] Circumflex \^ Underscore \_
16 %% Grave accent \` Left brace \{ Vertical bar \|
17 %% Right brace \} Tilde \~}
18 %</package>
19 %\fi
20 % \iffalse
21 % Doc-Source file to use with LaTeX2e
22 % Copyright (C) 2018 Nicola Talbot, all rights reserved.
23 % (New maintainer add relevant lines here.)
24 % \fi
25 % \iffalse
26 %<*driver>
27 \documentclass{ltxdoc}
28
29 \usepackage{alltt}
30 \usepackage{graphicx}
31 \usepackage[utf8]{inputenc}
32 \usepackage[T1]{fontenc}
33 \usepackage[colorlinks,
34 bookmarks,
35 hyperindex=false,
36 pdfauthor={Nicola L.C. Talbot},
37 pdftitle={datetime2.sty Bahasai Module}]{hyperref}
38
39
40 \CheckSum{173}
41
42 \renewcommand*{\usage}[1]{\hyperpage{#1}}
43 \renewcommand*{\main}[1]{\hyperpage{#1}}
44 \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}}
45 \setcounter{IndexColumns}{2}
46
47 \newcommand*{\sty}[1]{\textsf{#1}}
48 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}}
49
50 \RecordChanges
51 \PageIndex
52 \CodelineNumbered
53
54 \begin{document}
55 \DocInput{datetime2-bahasai.dtx}
56 \end{document}
57 %</driver>
58 %\fi
59 %
60 %\MakeShortVerb{"}
61 %
62 %\title{Bahasai Module for datetime2 Package}
63 %\author{Nicola L. C. Talbot (inactive)}
64 %\date{2018-01-10 (v1.01)}
65 %\maketitle
66 %
67 %This module is currently unmaintained and may be subject to change.
68 %If you want to volunteer to take over maintenance, contact me at
69 %\url{http://www.dickimaw-books.com/contact.html}
70 %
71 %\begin{abstract}
72 %This is the Bahasai language module for the \sty{datetime2}
73 %package. If you want to use the settings in this module you must
74 %install it in addition to installing \sty{datetime2}. If you use
75 %\sty{babel} or \sty{polyglossia}, you will need this module to
76 %prevent them from redefining \cs{today}. The \sty{datetime2}
77 % \opt{useregional} setting must be set to "text" or "numeric"
78 % for the language styles to be set.
79 % Alternatively, you can set the style in the document using
80 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
81 % depending on the value of the \opt{useregional} setting.
82 %\end{abstract}
83 %
84 %I've copied the date style from \texttt{babel-bahasai}'s \cs{today}.
85 %
86 %I don't know if these settings are correct.
87 %In particular, I don't know if the "bahasai" time style is
88 %correct. Currently this just uses the "default" time style. Please
89 %be aware that this may change. Whoever takes over maintanance
90 %of this module may can change it as appropriate.
91 %
92 %The new maintainer should add the line:
93 %\begin{verbatim}
94 % The Current Maintainer of this work is Name.
95 %\end{verbatim}
96 %to the preamble part in \texttt{datetime2-bahasai.ins} where Name
97 %is the name of the maintainer(s) and replace
98 %the `inactive' status to `maintained'.
99 %
100 %Currently there is only a regionless style.
101 %
102 %\StopEventually{%
103 %\clearpage
104 %\phantomsection
105 %\addcontentsline{toc}{section}{Change History}%
106 %\PrintChanges
107 %\addcontentsline{toc}{section}{\indexname}%
108 %\PrintIndex}
109 %\section{The Code}
110 %At the moment there is only the one ".ldf" file.
111 %
112 %\subsection{Main Bahasai Module (\texttt{datetime2-bahasai.ldf})}
113 %\changes{1.0}{2015-03-29}{Initial release}
114 %
115 %\iffalse
116 % \begin{macrocode}
117 %<*datetime2-bahasai.ldf>
118 % \end{macrocode}
119 %\fi
120 %
121 % Identify Module
122 % \begin{macrocode}
123 \ProvidesDateTimeModule{bahasai}[2018/01/10 v1.01]
124 % \end{macrocode}
125 %\begin{macro}{\DTMbahasaiordinal}
126 % I don't know if this is correct, but it's provided in case
127 % a suffix is required.
128 % \begin{macrocode}
129 \newcommand*{\DTMbahasaiordinal}[1]{%
130 \number#1 % space intended
131 }
132 % \end{macrocode}
133 %\end{macro}
134 %
135 %\begin{macro}{\DTMbahasaimonthname}
136 % Bahasai month names.
137 % \begin{macrocode}
138 \newcommand*{\DTMbahasaimonthname}[1]{%
139 \ifcase#1
140 \or
141 Januari%
142 \or
143 Pebruari%
144 \or
145 Maret%
146 \or
147 April%
148 \or
149 Mei%
150 \or
151 Juni%
152 \or
153 Juli%
154 \or
155 Agustus%
156 \or
157 September%
158 \or
159 Oktober%
160 \or
161 Nopember%
162 \or
163 Desember%
164 \fi
165 }
166 % \end{macrocode}
167 %\end{macro}
168 %
169 %
170 % Define the \texttt{bahasai} style.
171 % The time style is the same as the "default" style
172 % provided by \sty{datetime2}. This may need correcting. For
173 % example, if a 12 hour style similar to the "englishampm" (from the
174 % "english-base" module) is required.
175 %
176 % Allow the user a way of configuring the "bahasai" and
177 % "bahasai-numeric" styles. This doesn't use the package wide
178 % separators such as
179 % \cs{dtm@datetimesep} in case other date formats are also required.
180 %\begin{macro}{\DTMbahasaidaymonthsep}
181 % The separator between the day and month for the text format.
182 % \begin{macrocode}
183 \newcommand*{\DTMbahasaidaymonthsep}{%
184 \DTMtexorpdfstring{\protect~}{\space}}
185 % \end{macrocode}
186 %\end{macro}
187 %
188 %\begin{macro}{\DTMbahasaimonthyearsep}
189 % The separator between the month and year for the text format.
190 % \begin{macrocode}
191 \newcommand*{\DTMbahasaimonthyearsep}{\space}
192 % \end{macrocode}
193 %\end{macro}
194 %
195 %\begin{macro}{\DTMbahasaidatetimesep}
196 % The separator between the date and time blocks in the full format
197 % (either text or numeric).
198 % \begin{macrocode}
199 \newcommand*{\DTMbahasaidatetimesep}{\space}
200 % \end{macrocode}
201 %\end{macro}
202 %
203 %\begin{macro}{\DTMbahasaitimezonesep}
204 % The separator between the time and zone blocks in the full format
205 % (either text or numeric).
206 % \begin{macrocode}
207 \newcommand*{\DTMbahasaitimezonesep}{\space}
208 % \end{macrocode}
209 %\end{macro}
210 %
211 %\begin{macro}{\DTMbahasaidatesep}
212 % The separator for the numeric date format.
213 % \begin{macrocode}
214 \newcommand*{\DTMbahasaidatesep}{/}
215 % \end{macrocode}
216 %\end{macro}
217 %
218 %\begin{macro}{\DTMbahasaitimesep}
219 % The separator for the numeric time format.
220 % \begin{macrocode}
221 \newcommand*{\DTMbahasaitimesep}{:}
222 % \end{macrocode}
223 %\end{macro}
224 %
225 %Provide keys that can be used in \cs{DTMlangsetup} to set these
226 %separators.
227 % \begin{macrocode}
228 \DTMdefkey{bahasai}{daymonthsep}{\renewcommand*{\DTMbahasaidaymonthsep}{#1}}
229 \DTMdefkey{bahasai}{monthyearsep}{\renewcommand*{\DTMbahasaimonthyearsep}{#1}}
230 \DTMdefkey{bahasai}{datetimesep}{\renewcommand*{\DTMbahasaidatetimesep}{#1}}
231 \DTMdefkey{bahasai}{timezonesep}{\renewcommand*{\DTMbahasaitimezonesep}{#1}}
232 \DTMdefkey{bahasai}{datesep}{\renewcommand*{\DTMbahasaidatesep}{#1}}
233 \DTMdefkey{bahasai}{timesep}{\renewcommand*{\DTMbahasaitimesep}{#1}}
234 % \end{macrocode}
235 %
236 % TODO: provide a boolean key to switch between full and abbreviated
237 % formats if appropriate. (I don't know how the date should be
238 % abbreviated.)
239 %
240 % Define a boolean key that determines if the time zone mappings
241 % should be used.
242 % \begin{macrocode}
243 \DTMdefboolkey{bahasai}{mapzone}[true]{}
244 % \end{macrocode}
245 % The default is to use mappings.
246 % \begin{macrocode}
247 \DTMsetbool{bahasai}{mapzone}{true}
248 % \end{macrocode}
249 %
250 % Define a boolean key that determines if the day of month should be
251 % displayed.
252 % \begin{macrocode}
253 \DTMdefboolkey{bahasai}{showdayofmonth}[true]{}
254 % \end{macrocode}
255 % The default is to show the day of month.
256 % \begin{macrocode}
257 \DTMsetbool{bahasai}{showdayofmonth}{true}
258 % \end{macrocode}
259 %
260 % Define a boolean key that determines if the year should be
261 % displayed.
262 % \begin{macrocode}
263 \DTMdefboolkey{bahasai}{showyear}[true]{}
264 % \end{macrocode}
265 % The default is to show the year.
266 % \begin{macrocode}
267 \DTMsetbool{bahasai}{showyear}{true}
268 % \end{macrocode}
269 %
270 % Define the "bahasai" style. (TODO: implement day of week?)
271 % \begin{macrocode}
272 \DTMnewstyle
273 {bahasai}% label
274 {% date style
275 \renewcommand*\DTMdisplaydate[4]{%
276 \DTMifbool{bahasai}{showdayofmonth}
277 {\DTMbahasaiordinal{##3}\DTMbahasaidaymonthsep}%
278 {}%
279 \DTMbahasaimonthname{##2}%
280 \DTMifbool{bahasai}{showyear}%
281 {%
282 \DTMbahasaimonthyearsep
283 \number##1 % space intended
284 }%
285 {}%
286 }%
287 \renewcommand*\DTMDisplaydate{\DTMdisplaydate}%
288 }%
289 {% time style (use default)
290 \DTMsettimestyle{default}%
291 }%
292 {% zone style
293 \DTMresetzones
294 \DTMbahasaizonemaps
295 \renewcommand*{\DTMdisplayzone}[2]{%
296 \DTMifbool{bahasai}{mapzone}%
297 {\DTMusezonemapordefault{##1}{##2}}%
298 {%
299 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
300 \ifDTMshowzoneminutes\DTMbahasaitimesep\DTMtwodigits{##2}\fi
301 }%
302 }%
303 }%
304 {% full style
305 \renewcommand*{\DTMdisplay}[9]{%
306 \ifDTMshowdate
307 \DTMdisplaydate{##1}{##2}{##3}{##4}%
308 \DTMbahasaidatetimesep
309 \fi
310 \DTMdisplaytime{##5}{##6}{##7}%
311 \ifDTMshowzone
312 \DTMbahasaitimezonesep
313 \DTMdisplayzone{##8}{##9}%
314 \fi
315 }%
316 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
317 }%
318 % \end{macrocode}
319 %
320 % Define numeric style.
321 % \begin{macrocode}
322 \DTMnewstyle
323 {bahasai-numeric}% label
324 {% date style
325 \renewcommand*\DTMdisplaydate[4]{%
326 \DTMifbool{bahasai}{showdayofmonth}%
327 {%
328 \number##3 % space intended
329 \DTMbahasaidatesep
330 }%
331 {}%
332 \number##2 % space intended
333 \DTMifbool{bahasai}{showyear}%
334 {%
335 \DTMbahasaidatesep
336 \number##1 % space intended
337 }%
338 {}%
339 }%
340 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
341 }%
342 {% time style
343 \renewcommand*\DTMdisplaytime[3]{%
344 \number##1
345 \DTMbahasaitimesep\DTMtwodigits{##2}%
346 \ifDTMshowseconds\DTMbahasaitimesep\DTMtwodigits{##3}\fi
347 }%
348 }%
349 {% zone style
350 \DTMresetzones
351 \DTMbahasaizonemaps
352 \renewcommand*{\DTMdisplayzone}[2]{%
353 \DTMifbool{bahasai}{mapzone}%
354 {\DTMusezonemapordefault{##1}{##2}}%
355 {%
356 \ifnum##1<0\else+\fi\DTMtwodigits{##1}%
357 \ifDTMshowzoneminutes\DTMbahasaitimesep\DTMtwodigits{##2}\fi
358 }%
359 }%
360 }%
361 {% full style
362 \renewcommand*{\DTMdisplay}[9]{%
363 \ifDTMshowdate
364 \DTMdisplaydate{##1}{##2}{##3}{##4}%
365 \DTMbahasaidatetimesep
366 \fi
367 \DTMdisplaytime{##5}{##6}{##7}%
368 \ifDTMshowzone
369 \DTMbahasaitimezonesep
370 \DTMdisplayzone{##8}{##9}%
371 \fi
372 }%
373 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
374 }
375 % \end{macrocode}
376 %
377 %\begin{macro}{\DTMbahasaizonemaps}
378 % The time zone mappings are set through this command, which can be
379 % redefined if extra mappings are required or mappings need to be
380 % removed. This currently has no mappings.
381 % \begin{macrocode}
382 \newcommand*{\DTMbahasaizonemaps}{%
383 }
384 % \end{macrocode}
385 %\end{macro}
386
387 % Switch style according to the \opt{useregional} setting.
388 % \begin{macrocode}
389 \DTMifcaseregional
390 {}% do nothing
391 {\DTMsetstyle{bahasai}}
392 {\DTMsetstyle{bahasai-numeric}}
393 % \end{macrocode}
394 %
395 % Redefine \cs{datebahasai} (or \cs{date}\meta{dialect}) to prevent
396 % \sty{babel} from resetting \cs{today}. (For this to work,
397 % \sty{babel} must already have been loaded if it's required.)
398 %\changes{1.01}{2018-01-10}{removed spurious space}
399 % \begin{macrocode}
400 \ifcsundef{date\CurrentTrackedDialect}
401 {%
402 \ifundef\datebahasai
403 {% do nothing
404 }%
405 {%
406 \def\datebahasai{%
407 \DTMifcaseregional
408 {}% do nothing
409 {\DTMsetstyle{bahasai}}%
410 {\DTMsetstyle{bahasai-numeric}}%
411 }%
412 }%
413 }%
414 {%
415 \csdef{date\CurrentTrackedDialect}{%
416 \DTMifcaseregional
417 {}% do nothing
418 {\DTMsetstyle{bahasai}}%
419 {\DTMsetstyle{bahasai-numeric}}%
420 }%
421 }%
422 % \end{macrocode}
423 %\iffalse
424 % \begin{macrocode}
425 %</datetime2-bahasai.ldf>
426 % \end{macrocode}
427 %\fi
428 %\Finale
429 \endinput