summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/scontents/scontents.sty
blob: 77147e8ecf7bf7a3b3c8a5f89bad48833c66ea82 (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
%%
%% This is file `scontents.sty',
%% generated with the docstrip utility.
%%
%% The original source files were:
%%
%% scontents.dtx  (with options: `loader,latex')
%% 
%% Copyright (C) 2019 by Pablo González L <pablgonz@educarchile.cl>
%% 
%% 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.
%% 
%% This work is "maintained" (as per the LPPL maintenance status)
%% by Pablo González Luengo.
%% 
%% This work consists of the files scontents.dtx and
%%                                 scontents.ins,
%% and the derived files           scontents.sty,
%%                                 scontents.tex,
%%                                 t-scontents.mkiv and
%%                                 scontents-code.tex.
%% 
\def\ScontentsFileDate{2019-11-18}%
\def\ScontentsFileVersion{1.8}%
\def\ScontentsFileDescription{Stores LaTeX contents in memory or files}%
\RequirePackage{expl3,xparse,l3keys2e}[2019/05/28]
\ProvidesExplPackage
  {scontents} {\ScontentsFileDate} {\ScontentsFileVersion} {\ScontentsFileDescription}
\@ifpackageloaded { verbatim }
  {
    \msg_set:nnn { scontents } { unsupported-verbatim }
      {
        The~implementation~of~the~'verbatimsc'~environment~used~by~
        \iow_char:N \\typestored~is~not~compatible~with~package~'verbatim'.~
        Review~the~documentation~and~redefine~the~'verbatimsc'~environment.
      }
    \msg_warning:nn { scontents } { unsupported-verbatim }
  } { }
\tl_new:N \g__scontents_end_verbatimsc_tl
\tl_gset_rescan:Nnn
  \g__scontents_end_verbatimsc_tl
  {
    \char_set_catcode_other:N \\
    \char_set_catcode_other:N \{
    \char_set_catcode_other:N \}
  }
  { \end{verbatimsc} }
\tl_const:Nx \c__scontents_end_env_tl
  {
    \c_backslash_str
    end
    \c_left_brace_str
      \exp_not:N \l__scontents_env_name_tl
    \c_right_brace_str
  }
\file_input:n { scontents-code.tex }
\cs_new:Npn \__scontents_format_case:nnn #1 #2 #3
  {#1} % LaTeX
\keys_define:nn { scontents }
  { verb-font .initial:n = \ttfamily }
\ProcessKeysOptions { scontents }
\NewDocumentCommand { \newenvsc } { m O{} }
  {
    \cs_if_exist:cTF { #1 }
      { \msg_error:nnn { scontents } { env-already-defined } {#1} }
      { \__scontents_scontents_setenv:nn {#1} {#2} }
  }
\cs_new_protected:Npn \__scontents_env_define:nnn #1 #2 #3
  {
    \NewDocumentEnvironment {#1} { }
      {
          #2
      }
      {
          #3
      }
  }
\newenvsc{scontents}
\NewDocumentCommand \__scontents_grab_optional:w { r[] }
  { \__scontents_grab_optional:n {#1} }
\cs_new_eq:NN \__scontents_analyse_nesting_format:n
  \__scontents_analyse_nesting_latex:n
\NewDocumentCommand { \Scontents }{ !s !O{} }
  { \__scontents_Scontents_internal:nn {#1} {#2} }
\NewDocumentCommand { \__scontents_verb_arg:w } { +v }
  { \__scontents_verb_arg_internal:n {#1} }
\NewDocumentCommand { \getstored } { O{-1} m }
  { \__scontents_getstored_internal:nn {#1} {#2} }
\NewDocumentCommand { \foreachsc } { o m }
  { \__scontents_foreachsc_internal:nn {#1} {#2} }
\NewDocumentCommand { \typestored } { o m }
  { \__scontents_typestored_internal:nn {#1} {#2} }
\use:x
  {
    \cs_new_protected:Npn \exp_not:N \__scontents_xverb:w
      ##1 \g__scontents_end_verbatimsc_tl
      { ##1 \exp_not:N \end{verbatimsc} }
  }
\NewDocumentEnvironment { verbatimsc } { }
  {
    \cs_set_eq:cN { @xverbatim } \__scontents_xverb:
    \verbatim
  }
  { }
\group_begin:
  \cs_new_protected:Npn \__scontents_plain_disable_outer_par:
    { }
\group_end:
\NewDocumentCommand { \setupsc } { +m }
  { \keys_set:nn { scontents } {#1} }
\NewDocumentCommand { \meaningsc } { o m }
  { \__scontents_meaningsc_internal:nn {#1} {#2} }
\NewExpandableDocumentCommand { \countsc } { m }
  { \seq_count:c { g__scontents_name_#1_seq } }
\NewDocumentCommand { \cleanseqsc } { m }
  { \seq_clear_new:c { g__scontents_name_#1_seq } }
\endinput
%%
%% End of file `scontents.sty'.