summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/tex/latex/nicetext/fdtxttex.tex
blob: 9e5e3dda35a1ed95a4cc5c883b9c69fe649f5fc2 (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
                                                   \makeatletter
\typeout{^^J*fdtxttex.tex* 2010/03/22 txt to TeX by dialogue^^J
             (apply \string\MakeDocCorrectHook)
                                                            ^^J}

\RequirePackage{fifinddo}

\def\MakeDocCorrectHook#1{#1}
\catcode`\_=11 
\def\CorrectionFile{\def\mdoc_corr}
\CorrectionFile{mdoccorr.cfg}
\ResultFile{sample.tex}
\def\InputFile{\def\input_file_name}
\InputFile{sample.txt}
\newif\iftoscreen

\def\FD_dialogue{%
  \typeout{^^J%
    ===========================================================^^J%
    \string\CorrectionFile{\mdoc_corr} 
    \space (define \@backslashchar MakeDocCorrectHook)^^J%
    \string\InputFile {\input_file_name}^^J% 
    \string\ResultFile{\result_file_name} 
    \space\space\space\space\space\space\space
    \string\toscreen\iftoscreen true\else false\fi             ^^J%
    ===========================================================%
  }%
  \typein[\action]%
         {Run with these settings? (Y)es? (C)hange? (Otherwise quit.)}% 
  \csname action_\action \endcsname 
}
\def\run_with_settings{%
  \input{\mdoc_corr}%
  \WriteProvides
  \ProcessFileWith{\input_file_name}{%
    \WriteResult{\expandafter \MakeDocCorrectHook 
                 \expandafter{\fdInputLine}}%
    \iftoscreen
      \typeout{\expandafter \MakeDocCorrectHook 
                 \expandafter{\fdInputLine}}%
    \else
      \message{.}%
    \fi}
  \CloseResultFile
  \typeout{Done.}%
  \FD_dialogue
} 
\expandafter\let\csname action_y\endcsname \run_with_settings
\expandafter\let\csname action_Y\endcsname \run_with_settings

\def\change_settings{%
    \typein[\change]{^^JType setting command(s).}%
    \change \FD_dialogue}
\expandafter\let\csname action_c\endcsname \change_settings
\expandafter\let\csname action_C\endcsname \change_settings

\FD_dialogue

\stop