Debian Codegraph @

texmf-dist/source/latex/datetime2-slovene/datetime2-slovene.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) 2015-2019 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{fontspec}
32 \usepackage[colorlinks,
33 bookmarks,
34 hyperindex=false,
35 pdfauthor={Nicola L.C. Talbot},
36 pdftitle={datetime2.sty Slovene Module}]{hyperref}
37
38 \setmainfont{Liberation Serif}
39 \setmonofont{Liberation Mono}
40
41 \CheckSum{253}
42
43 \renewcommand*{\usage}[1]{\hyperpage{#1}}
44 \renewcommand*{\main}[1]{\hyperpage{#1}}
45 \IndexPrologue{\section*{\indexname}\markboth{\indexname}{\indexname}}
46 \setcounter{IndexColumns}{2}
47
48 \newcommand*{\sty}[1]{\textsf{#1}}
49 \newcommand*{\opt}[1]{\texttt{#1}\index{#1=\texttt{#1}|main}}
50
51 \RecordChanges
52 \PageIndex
53 \CodelineNumbered
54
55 \begin{document}
56 \DocInput{datetime2-slovene.dtx}
57 \end{document}
58 %</driver>
59 %\fi
60 %
61 %\MakeShortVerb{"}
62 %
63 %\title{Slovene Module for datetime2 Package}
64 %\author{Nicola L. C. Talbot (inactive)}
65 %\date{2019-10-04 (v1.1)}
66 %\maketitle
67 %
68 %This module is currently unmaintained and may be subject to change.
69 %If you want to volunteer to take over maintanance, contact me at
70 %\url{http://www.dickimaw-books.com/contact.html}
71 %
72 %\begin{abstract}
73 %This is the Slovene language module for the \sty{datetime2}
74 %package. If you want to use the settings in this module you must
75 %install it in addition to installing \sty{datetime2}. If you use
76 %\sty{babel} or \sty{polyglossia}, you will need this module to
77 %prevent them from redefining \cs{today}. The \sty{datetime2}
78 % \opt{useregional} setting must be set to "text" or "numeric"
79 % for the language styles to be set.
80 % Alternatively, you can set the style in the document using
81 % \cs{DTMsetstyle}, but this may be changed by \cs{date}\meta{language}
82 % depending on the value of the \opt{useregional} setting.
83 %\end{abstract}
84 %
85 %I've copied the date style from \texttt{babel-slovene}'s \cs{today}.
86 %
87 %I don't know if these settings are correct as I can't speak Slovene.
88 %In particular, I don't know if the "slovene" time style is
89 %correct. Currently this just uses the "default" time style. Please
90 %be aware that this may change. Whoever takes over maintanance
91 %of this module may can change it as appropriate.
92 %
93 %The new maintainer should add the line:
94 %\begin{verbatim}
95 % The Current Maintainer of this work is Name.
96 %\end{verbatim}
97 %to the preamble part in \texttt{datetime2-slovene.ins} where Name
98 %is the name of the maintainer(s) and replace
99 %the `inactive' status to `maintained'.
100 %
101 %Currently there is only a regionless style.
102 %
103 %\StopEventually{%
104 %\clearpage
105 %\phantomsection
106 %\addcontentsline{toc}{section}{Change History}%
107 %\PrintChanges
108 %\addcontentsline{toc}{section}{\indexname}%
109 %\PrintIndex}
110 %\section{The Code}
111 %\iffalse
112 % \begin{macrocode}
113 %<*datetime2-slovene-utf8.ldf>
114 % \end{macrocode}
115 %\fi
116 %\subsection{UTF-8}
117 %This file contains the settings that use UTF-8 characters. This
118 %file is loaded if XeLaTeX or LuaLaTeX are used. Please make sure
119 %your text editor is set to UTF-8 if you want to view this code.
120 %
121 %(This file doesn't actually contain non-ASCII characters at
122 %present, but is provided in case week day names or archaic month
123 %names are added, which
124 %may contain non-ASCII characters.)
125 %\changes{1.0}{2015-04-01}{Initial release}
126 % Identify module
127 % \begin{macrocode}
128 \ProvidesDateTimeModule{slovene-utf8}[2019/10/04 v1.1]
129 % \end{macrocode}
130 %\begin{macro}{\DTMsloveneordinal}
131 % \begin{macrocode}
132 \newcommand*{\DTMsloveneordinal}[1]{%
133 \number#1.%
134 }
135 % \end{macrocode}
136 %\end{macro}
137 %
138 %\begin{macro}{\DTMslovenemonthname}
139 % Slovene month names.
140 % \begin{macrocode}
141 \newcommand*{\DTMslovenemonthname}[1]{%
142 \ifcase#1
143 \or
144 januar%
145 \or
146 februar%
147 \or
148 marec%
149 \or
150 april%
151 \or
152 maj%
153 \or
154 junij%
155 \or
156 julij%
157 \or
158 avgust%
159 \or
160 september%
161 \or
162 oktober%
163 \or
164 november%
165 \or
166 december%
167 \fi
168 }
169 % \end{macrocode}
170 %\end{macro}
171 %
172 %\begin{macro}{\DTMsloveneMonthname}
173 % As above but capitalize.
174 % \begin{macrocode}
175 \newcommand*{\DTMsloveneMonthname}[1]{%
176 \ifcase#1
177 \or
178 Januar%
179 \or
180 Februar%
181 \or
182 Marec%
183 \or
184 April%
185 \or
186 Maj%
187 \or
188 Junij%
189 \or
190 Julij%
191 \or
192 Avgust%
193 \or
194 September%
195 \or
196 Oktober%
197 \or
198 November%
199 \or
200 December%
201 \fi
202 }
203 % \end{macrocode}
204 %\end{macro}
205 %
206 %If abbreviated dates are supported, short month names should be
207 %likewise provided.
208 %
209 %\iffalse
210 % \begin{macrocode}
211 %</datetime2-slovene-utf8.ldf>
212 % \end{macrocode}
213 %\fi
214 %\iffalse
215 % \begin{macrocode}
216 %<*datetime2-slovene-ascii.ldf>
217 % \end{macrocode}
218 %\fi
219 %\subsection{ASCII}
220 %This file contains the settings that use \LaTeX\ commands for
221 %non-ASCII characters. This should be input if neither XeLaTeX nor
222 %LuaLaTeX are used. Even if the user has loaded \sty{inputenc} with
223 %"utf8", this file should still be used not the
224 %\texttt{datetime2-slovene-utf8.ldf} file as the non-ASCII
225 %characters are made active in that situation and would need
226 %protecting against expansion.
227 %\changes{1.0}{2015-04-01}{Initial release}
228 % Identify module
229 % \begin{macrocode}
230 \ProvidesDateTimeModule{slovene-ascii}[2019/10/04 v1.1]
231 % \end{macrocode}
232 %
233 %If abbreviated dates are supported, short month names should be
234 %likewise provided.
235 %\begin{macro}{\DTMsloveneordinal}
236 % \begin{macrocode}
237 \newcommand*{\DTMsloveneordinal}[1]{%
238 \number#1.%
239 }
240 % \end{macrocode}
241 %\end{macro}
242 %
243 %\begin{macro}{\DTMslovenemonthname}
244 % Slovene month names.
245 % \begin{macrocode}
246 \newcommand*{\DTMslovenemonthname}[1]{%
247 \ifcase#1
248 \or
249 januar%
250 \or
251 februar%
252 \or
253 marec%
254 \or
255 april%
256 \or
257 maj%
258 \or
259 junij%
260 \or
261 julij%
262 \or
263 avgust%
264 \or
265 september%
266 \or
267 oktober%
268 \or
269 november%
270 \or
271 december%
272 \fi
273 }
274 % \end{macrocode}
275 %\end{macro}
276 %
277 %\begin{macro}{\DTMsloveneMonthname}
278 % As above but capitalize.
279 % \begin{macrocode}
280 \newcommand*{\DTMsloveneMonthname}[1]{%
281 \ifcase#1
282 \or
283 Januar%
284 \or
285 Februar%
286 \or
287 Marec%
288 \or
289 April%
290 \or
291 Maj%
292 \or
293 Junij%
294 \or
295 Julij%
296 \or
297 Avgust%
298 \or
299 September%
300 \or
301 Oktober%
302 \or
303 November%
304 \or
305 December%
306 \fi
307 }
308 % \end{macrocode}
309 %\end{macro}
310 %
311 %
312 %\iffalse
313 % \begin{macrocode}
314 %</datetime2-slovene-ascii.ldf>
315 % \end{macrocode}
316 %\fi
317 %
318 %\subsection{Main Slovene Module (\texttt{datetime2-slovene.ldf})}
319 %\changes{1.0}{2015-04-01}{Initial release}
320 %
321 %\iffalse
322 % \begin{macrocode}
323 %<*datetime2-slovene.ldf>
324 % \end{macrocode}
325 %\fi
326 %
327 % Identify Module
328 % \begin{macrocode}
329 \ProvidesDateTimeModule{slovene}[2019/10/04 v1.1]
330 % \end{macrocode}
331 % Need to find out if XeTeX or LuaTeX are being used.
332 % \begin{macrocode}
333 \RequirePackage{ifxetex,ifluatex}
334 % \end{macrocode}
335 % XeTeX and LuaTeX natively support UTF-8, so load
336 % \texttt{slovene-utf8} if either of those engines are used
337 % otherwise load \texttt{slovene-ascii}.
338 % \begin{macrocode}
339 \ifxetex
340 \RequireDateTimeModule{slovene-utf8}
341 \else
342 \ifluatex
343 \RequireDateTimeModule{slovene-utf8}
344 \else
345 \RequireDateTimeModule{slovene-ascii}
346 \fi
347 \fi
348 % \end{macrocode}
349 %
350 % Define the \texttt{slovene} style.
351 % The time style is the same as the "default" style
352 % provided by \sty{datetime2}. This may need correcting. For
353 % example, if a 12 hour style similar to the "englishampm" (from the
354 % "english-base" module) is required.
355 %
356 % Allow the user a way of configuring the "slovene" and
357 % "slovene-numeric" styles. This doesn't use the package wide
358 % separators such as
359 % \cs{dtm@datetimesep} in case other date formats are also required.
360 %\begin{macro}{\DTMslovenedaymonthsep}
361 % The separator between the day and month for the text format.
362 % \begin{macrocode}
363 \newcommand*{\DTMslovenedaymonthsep}{%
364 \DTMtexorpdfstring{\protect~}{\space}}
365 % \end{macrocode}
366 %\end{macro}
367 %
368 %\begin{macro}{\DTMslovenemonthyearsep}
369 % The separator between the month and year for the text format.
370 % \begin{macrocode}
371 \newcommand*{\DTMslovenemonthyearsep}{\space}
372 % \end{macrocode}
373 %\end{macro}
374 %
375 %\begin{macro}{\DTMslovenedatetimesep}
376 % The separator between the date and time blocks in the full format
377 % (either text or numeric).
378 % \begin{macrocode}
379 \newcommand*{\DTMslovenedatetimesep}{\space}
380 % \end{macrocode}
381 %\end{macro}
382 %
383 %\begin{macro}{\DTMslovenetimezonesep}
384 % The separator between the time and zone blocks in the full format
385 % (either text or numeric).
386 % \begin{macrocode}
387 \newcommand*{\DTMslovenetimezonesep}{\space}
388 % \end{macrocode}
389 %\end{macro}
390 %
391 %\begin{macro}{\DTMslovenedatesep}
392 % The separator for the numeric date format.
393 % \begin{macrocode}
394 \newcommand*{\DTMslovenedatesep}{.}
395 % \end{macrocode}
396 %\end{macro}
397 %
398 %\begin{macro}{\DTMslovenetimesep}
399 % The separator for the numeric time format.
400 % \begin{macrocode}
401 \newcommand*{\DTMslovenetimesep}{:}
402 % \end{macrocode}
403 %\end{macro}
404 %
405 %Provide keys that can be used in \cs{DTMlangsetup} to set these
406 %separators.
407 % \begin{macrocode}
408 \DTMdefkey{slovene}{daymonthsep}{\renewcommand*{\DTMslovenedaymonthsep}{#1}}
409 \DTMdefkey{slovene}{monthyearsep}{\renewcommand*{\DTMslovenemonthyearsep}{#1}}
410 \DTMdefkey{slovene}{datetimesep}{\renewcommand*{\DTMslovenedatetimesep}{#1}}
411 \DTMdefkey{slovene}{timezonesep}{\renewcommand*{\DTMslovenetimezonesep}{#1}}
412 \DTMdefkey{slovene}{datesep}{\renewcommand*{\DTMslovenedatesep}{#1}}
413 \DTMdefkey{slovene}{timesep}{\renewcommand*{\DTMslovenetimesep}{#1}}
414 % \end{macrocode}
415 %
416 % TODO: provide a boolean key to switch between full and abbreviated
417 % formats if appropriate. (I don't know how the date should be
418 % abbreviated.)
419 %
420 % Define a boolean key that determines if the time zone mappings
421 % should be used.
422 % \begin{macrocode}
423 \DTMdefboolkey{slovene}{mapzone}[true]{}
424 % \end{macrocode}
425 % The default is to use mappings.
426 % \begin{macrocode}
427 \DTMsetbool{slovene}{mapzone}{true}
428 % \end{macrocode}
429 %
430 % Define a boolean key that determines if the day of month should be
431 % displayed.
432 % \begin{macrocode}
433 \DTMdefboolkey{slovene}{showdayofmonth}[true]{}
434 % \end{macrocode}
435 % The default is to show the day of month.
436 % \begin{macrocode}
437 \DTMsetbool{slovene}{showdayofmonth}{true}
438 % \end{macrocode}
439 %
440 % Define a boolean key that determines if the year should be
441 % displayed.
442 % \begin{macrocode}
443 \DTMdefboolkey{slovene}{showyear}[true]{}
444 % \end{macrocode}
445 % The default is to show the year.
446 % \begin{macrocode}
447 \DTMsetbool{slovene}{showyear}{true}
448 % \end{macrocode}
449 %
450 % Define the "slovene" style. (TODO: implement day of week?)
451 % \begin{macrocode}
452 \DTMnewstyle
453 {slovene}% label
454 {% date style
455 \renewcommand*\DTMdisplaydate[4]{%
456 \DTMifbool{slovene}{showdayofmonth}
457 {%
458 \DTMsloveneordinal{##3}%
459 \DTMslovenedaymonthsep
460 }%
461 {}%
462 \DTMslovenemonthname{##2}%
463 \DTMifbool{slovene}{showyear}%
464 {%
465 \DTMslovenemonthyearsep
466 \number##1 % space intended
467 }%
468 {}%
469 }%
470 \renewcommand*\DTMDisplaydate[4]{%
471 \DTMifbool{slovene}{showdayofmonth}
472 {%
473 \DTMsloveneordinal{##3}%
474 \DTMslovenedaymonthsep
475 \DTMslovenemonthname{##2}%
476 }%
477 {%
478 \DTMsloveneMonthname{##2}%
479 }%
480 \DTMifbool{slovene}{showyear}%
481 {%
482 \DTMslovenemonthyearsep
483 \number##1 % space intended
484 }%
485 {}%
486 }%
487 }%
488 {% time style (use default)
489 \DTMsettimestyle{default}%
490 }%
491 {% zone style
492 \DTMresetzones
493 \DTMslovenezonemaps
494 \renewcommand*{\DTMdisplayzone}[2]{%
495 \DTMifbool{slovene}{mapzone}%
496 {\DTMusezonemapordefault{##1}{##2}}%
497 {%
498 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
499 \ifDTMshowzoneminutes\DTMslovenetimesep\DTMtwodigits{##2}\fi
500 }%
501 }%
502 }%
503 {% full style
504 \renewcommand*{\DTMdisplay}[9]{%
505 \ifDTMshowdate
506 \DTMdisplaydate{##1}{##2}{##3}{##4}%
507 \DTMslovenedatetimesep
508 \fi
509 \DTMdisplaytime{##5}{##6}{##7}%
510 \ifDTMshowzone
511 \DTMslovenetimezonesep
512 \DTMdisplayzone{##8}{##9}%
513 \fi
514 }%
515 \renewcommand*{\DTMDisplay}[9]{%
516 \ifDTMshowdate
517 \DTMDisplaydate{##1}{##2}{##3}{##4}%
518 \DTMslovenedatetimesep
519 \fi
520 \DTMdisplaytime{##5}{##6}{##7}%
521 \ifDTMshowzone
522 \DTMslovenetimezonesep
523 \DTMdisplayzone{##8}{##9}%
524 \fi
525 }%
526 }%
527 % \end{macrocode}
528 %
529 % Define numeric style.
530 % \begin{macrocode}
531 \DTMnewstyle
532 {slovene-numeric}% label
533 {% date style
534 \renewcommand*\DTMdisplaydate[4]{%
535 \DTMifbool{slovene}{showdayofmonth}%
536 {%
537 \number##3 % space intended
538 \DTMslovenedatesep
539 }%
540 {}%
541 \number##2 % space intended
542 \DTMifbool{slovene}{showyear}%
543 {%
544 \DTMslovenedatesep
545 \number##1 % space intended
546 }%
547 {}%
548 }%
549 \renewcommand*{\DTMDisplaydate}{\DTMdisplaydate}%
550 }%
551 {% time style
552 \renewcommand*\DTMdisplaytime[3]{%
553 \number##1 % space intended
554 \DTMslovenetimesep\DTMtwodigits{##2}%
555 \ifDTMshowseconds\DTMslovenetimesep\DTMtwodigits{##3}\fi
556 }%
557 }%
558 {% zone style
559 \DTMresetzones
560 \DTMslovenezonemaps
561 \renewcommand*{\DTMdisplayzone}[2]{%
562 \DTMifbool{slovene}{mapzone}%
563 {\DTMusezonemapordefault{##1}{##2}}%
564 {%
565 \ifnum##1<0 \else+\fi\DTMtwodigits{##1}%
566 \ifDTMshowzoneminutes\DTMslovenetimesep\DTMtwodigits{##2}\fi
567 }%
568 }%
569 }%
570 {% full style
571 \renewcommand*{\DTMdisplay}[9]{%
572 \ifDTMshowdate
573 \DTMdisplaydate{##1}{##2}{##3}{##4}%
574 \DTMslovenedatetimesep
575 \fi
576 \DTMdisplaytime{##5}{##6}{##7}%
577 \ifDTMshowzone
578 \DTMslovenetimezonesep
579 \DTMdisplayzone{##8}{##9}%
580 \fi
581 }%
582 \renewcommand*{\DTMDisplay}{\DTMdisplay}%
583 }
584 % \end{macrocode}
585 %
586 %\begin{macro}{\DTMslovenezonemaps}
587 % The time zone mappings are set through this command, which can be
588 % redefined if extra mappings are required or mappings need to be
589 % removed.
590 % \begin{macrocode}
591 \newcommand*{\DTMslovenezonemaps}{%
592 \DTMdefzonemap{01}{00}{CET}%
593 \DTMdefzonemap{02}{00}{CEST}%
594 }
595 % \end{macrocode}
596 %\end{macro}
597
598 % Switch style according to the \opt{useregional} setting.
599 % \begin{macrocode}
600 \DTMifcaseregional
601 {}% do nothing
602 {\DTMsetstyle{slovene}}%
603 {\DTMsetstyle{slovene-numeric}}
604 % \end{macrocode}
605 %
606 % Redefine \cs{dateslovene} (or \cs{date}\meta{dialect}) to prevent
607 % \sty{babel} from resetting \cs{today}. (For this to work,
608 % \sty{babel} must already have been loaded if it's required.)
609 %\changes{1.1}{2019-10-04}{removed spurious space}
610 % \begin{macrocode}
611 \ifcsundef{date\CurrentTrackedDialect}
612 {%
613 \ifundef\dateslovene
614 {% do nothing
615 }%
616 {%
617 \def\dateslovene{%
618 \DTMifcaseregional
619 {}% do nothing
620 {\DTMsetstyle{slovene}}%
621 {\DTMsetstyle{slovene-numeric}}%
622 }%
623 }%
624 }%
625 {%
626 \csdef{date\CurrentTrackedDialect}{%
627 \DTMifcaseregional
628 {}% do nothing
629 {\DTMsetstyle{slovene}}%
630 {\DTMsetstyle{slovene-numeric}}%
631 }%
632 }%
633 % \end{macrocode}
634 %\iffalse
635 % \begin{macrocode}
636 %</datetime2-slovene.ldf>
637 % \end{macrocode}
638 %\fi
639 %\Finale
640 \endinput