summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/projlib/projlib-draft.sty
blob: 9c9fd22e01b454e9de61b3e9e8aee6e3f8750d6d (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
%%
%% This is file `projlib-draft.sty',
%% generated with the docstrip utility.

%% Copyright (C) 2021-2022 by Jinwen XU
%% 
%% This is part of the ProjLib Toolkit.
%% 
%% This work may be distributed and/or modified under the conditions of the
%% LaTeX Project Public License, either version 1.3c of this license or (at
%% your option) any later version. The latest version of this license is in
%% 
%%     http://www.latex-project.org/lppl.txt
%% 
%% and version 1.3c or later is part of all distributions of LaTeX version
%% 2005/12/01 or later.
%% 
\NeedsTeXFormat{LaTeX2e}[2020-10-01]
\RequirePackage{l3keys2e}
\ProvidesExplPackage
  {projlib-draft}
  {2022/03/11} {}
  {Useful commands during draft stage}

\keys_define:nn { projlib-draft }
  {
    , draft   .bool_set:N   = \l__projlib_draft_fast_bool
    , draft   .initial:n    = { false }
    , fast    .bool_set:N   = \l__projlib_draft_fast_bool
    , unknown .code:n       = {}
  }
\ProcessKeysOptions { projlib-draft }

\RequirePackage { projlib-language }
\RequirePackage { xcolor }

\bool_if:NTF \l__projlib_draft_fast_bool
  {
    \NewDocumentCommand \projlib_draft_plain_box { O{-paper} m }
      {
        \group_begin:
          \color { #1 }
          \dim_set:Nn \fboxsep  { 1.5pt }
          \dim_set:Nn \fboxrule { 1.5pt }
          \fbox { #2 }
        \group_end:
      }
  }
  {
    \PassOptionsToPackage { many } { tcolorbox }
    \RequirePackage { tcolorbox }
    \NewTCBox \projlib_draft_plain_box { O{-paper} }
      {
        enhanced~jigsaw, breakable,
        on~line, arc = 1.2pt, outer~arc = 1pt,
        colframe = #1, colupper = #1, opacityback = 0,
        boxsep = 1pt, boxrule = 1.2pt,
        left = 1pt, right = 1pt, top = 0pt, bottom = 0pt,
      }
  }

\projlib_langauge_define_multilingual_text:Nn \__dnf_text
  {
    EN = To\ be\ finished     ,
    FR = Pas\ encore\ fini    ,
    DE = Nicht\ beendet       ,
    IT = Per\ essere\ finito  ,
    PT = Não\ terminou        ,
    BR = Não\ terminou        ,
    ES = Estar\ terminado     ,
    CN = 这里尚未完成         ,
    TC = 這裡尚未完成         ,
    JP = 終わってない         ,
    RU = Не\ закончен         ,
  }

\projlib_langauge_define_multilingual_text:Nn \__dnf_report_text
  {
    EN = { Below\ is\ a\ list\ of\ outstanding\ items,
           \ followed\ by\ the\ corresponding\ page\ numbers.         }     ,
    FR = { Voici\ la\ liste\ des\ éléments\ en\ suspens,
           \ suivie\ des\ numéros\ de\ page\ correspondants.          }     ,
    DE = { Unten\ ist\ eine\ Liste\ der\ ausstehenden\ Posten,
           \ gefolgt\ von\ den\ entsprechenden\ Seitenzahlen.         }     ,
    IT = { Qui\ sotto\ c'è\ una\ lista\ di\ voci\ in\ sospeso,
           \ seguita\ dai\ numeri\ di\ pagina\ corrispondenti.        }     ,
    PT = { Abaixo\ está\ uma\ lista\ de\ itens\ pendentes,
           \ seguida\ dos\ números\ de\ página\ correspondentes.      }     ,
    BR = { Abaixo\ está\ uma\ lista\ de\ itens\ pendentes,
           \ seguida\ dos\ números\ de\ página\ correspondentes.      }     ,
    ES = { Aquí está\ la\ lista\ de\ elementos\ pendientes,
           \ seguida\ de\ los\ números\ de\ página\ correspondientes. }     ,
    CN = { 以下是未完成事项列表,括号内注明了对应的页码。             }     ,
    TC = { 以下是未完成事項的列表,括號內註明了對應頁碼。             }     ,
    JP = { 以下は、未解決の項目とそれに対応するページ番号の一覧です。 }     ,
    RU = { Ниже\ приведен\ список\ невыполненных\ пунктов
           \ с\ соответствующими\ номерами\ страниц\ в\ скобках.      }     ,
  }

\tl_new:c    { __dnf_font }
\tl_gset:cn  { __dnf_font }        { \normalfont \ttfamily \bfseries \small }

\definecolor { __dnf_color }       { RGB } {  21, 122,  20 }

\newcounter  { __dnf_counter }

\tl_new:N \g__projlib_draft_dnf_report_tl

\NewDocumentCommand \dnf { d<> }
  {
    \noindent
    \projlib_draft_plain_box [ __dnf_color ]
      {
        \stepcounter { __dnf_counter }
        \__dnf_font
        \__dnf_text
        \c_space_tl
        \# \the__dnf_counter
        \IfNoValueF { #1 } { \, : ~ #1 }
        \tl_gput_right:Nx \g__projlib_draft_dnf_report_tl
          {
            \# \,
            \int_value:w \the__dnf_counter
            \c_space_tl \c_space_tl
            $\langle$
            \skip_horizontal:n { 0.1em }
            \cs_if_exist:cTF { hyperlink }
              {
                \exp_not:N \hyperlink { page.\thepage } { \thepage }
              }
              {
                \thepage
              }
            \skip_horizontal:n { 0.1em }
            $\rangle$
            \c_space_tl
            \IfNoValueF { #1 } { : ~ #1 }
            \\
          }
      }
  }

\hook_gput_code:nnn { enddocument } { projlib-draft }
  {
    \tl_if_blank:VF \g__projlib_draft_dnf_report_tl
      {
        \clearpage \noindent
        \color { __dnf_color }
        \__dnf_font
        \__dnf_report_text \\[0.75\baselineskip]
        \g__projlib_draft_dnf_report_tl
      }
  }

\endinput
%%
%% End of file `projlib-draft.sty'.