Skip to content

Commit

Permalink
pour résoudre #348, on crée un fichier par série
Browse files Browse the repository at this point in the history
  • Loading branch information
maieul committed Jul 16, 2015
1 parent ebf71bd commit 7fedc07
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 34 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -6,7 +6,7 @@
*.out
*.toc
*.gz
*.end
*.?end
*.xdy
*.eledsec1*
*.eledsec2*
Expand Down
2 changes: 2 additions & 0 deletions doc-include/migrate-mac.dtx
Expand Up @@ -348,3 +348,5 @@
% \hline
% \cs{lineref} & \cs{edlineref} \\
% \end{longtable}
% \subsubsection{Endnotes}
% With \reledmac, there are now one auxiliary files by endnotes (.Aend, .Bend, .Cend etc.). If you have overriden \cs{doendnotes}, that you should not have, you should adapt it.
84 changes: 51 additions & 33 deletions reledmac.dtx
Expand Up @@ -308,6 +308,7 @@
% \changes{v2.0.0}{2015/06/28}{Add nonum option for endnotes.}
% \changes{v2.0.0}{2015/06/28}{Add \cs{Xendinplaceofnumber} hook.}
% \changes{v2.0.0}{2015/06/28}{Add \cs{Xendnonumber} hook.}
% \changes{v2.0.0}{2015/06/28}{Fix bug when printing only one series of endnotes, but wanted to keep endnotes for other series.}
% \hyphenation{man-u-script man-u-scripts}
%
%
Expand Down Expand Up @@ -670,7 +671,7 @@
% the second section, and so on), and then creates a new version of
% this auxiliary file to collect information during this run. The
% first instance of \cs{beginnumbering} also opens a file called
% \meta{jobname}\file{.end} to receive the text of the endnotes.
% \meta{jobname}\file{.\meta{series}end} to receive the text of the endnotes.
% \cs{endnumbering} closes the \meta{jobname}.\file{nn} file.
%
% If the line numbering of a text is to be continuous from start to end,
Expand Down Expand Up @@ -3264,10 +3265,8 @@
\newif\ifnoend@%
\DeclareOptionX{noend}{%
\let\l@dend@open\@gobble%
\let\l@d@end\relax
\let\l@dend@close\relax%
\global\let\l@dend@stuff=\relax%
\global\chardef\l@d@end=16%
\noend@true%
}%

Expand Down Expand Up @@ -10818,22 +10817,6 @@
% \begin{macrocode}
\ifbool{noend@}{}{%Used instead of \ifnoend@ to prevent expansion problem
% \end{macrocode}
% \begin{macro}{\l@d@end}
% \begin{macro}{\ifl@dend@}
% \begin{macro}{\l@dend@true}
% \begin{macro}{\l@dend@false}
% Endnotes of all varieties are saved up in a file, typically named
% \meta{jobname}\file{.end}.
% \cs{l@d@end} is the output stream number for
% this file, and \cs{ifl@dend@} is a flag that is \verb"true" when the file is open.
% \begin{macrocode}
\newwrite\l@d@end
\newif\ifl@dend@
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
%
% \begin{macro}{\l@dend@open}
% \begin{macro}{\l@dend@close}
Expand All @@ -10843,9 +10826,20 @@
% line numbers for the endnotes are generated by the same mechanism
% we use for the footnotes, so that there is no need to defer any
% writing to catch information from the output routine.
% \begin{macrocode}
\newcommand{\l@dend@open}[1]{\global\l@dend@true\immediate\openout\l@d@end=#1\relax}
\newcommand{\l@dend@close}{\global\l@dend@false\immediate\closeout\l@d@end}
% The argument of these two command is the series letter.
% \begin{macrocode}
\newcommand{\l@dend@open}[1]{%
\global\booltrue{l@dend@#1}%
\expandafter\immediate%
\expandafter\openout%
\csname l@d@#1end\endcsname%
=\jobname.#1end\relax%
}%
\newcommand{\l@dend@close}[1]{%
\global\boolfalse{l@dend@#1}%
\expandafter\immediate%
\expandafter\closeout\csname l@d@#1end\endcsname%
}%

% \end{macrocode}
% \end{macro}
Expand All @@ -10858,10 +10852,13 @@
% and writes the section number to the endnote file.
% \begin{macrocode}
\newcommand{\l@dend@stuff}{%
\ifl@dend@\relax\else
\l@dend@open{\jobname.end}%
\fi
\immediate\write\l@d@end{\string\l@d@section{\the\section@num}}}
\def\do##1{%
\ifbool{l@dend@##1}{}%
{\l@dend@open{##1}}%
\expandafter\immediate\expandafter\write\csname l@d@##1end\endcsname{\string\l@d@section{\the\section@num}}%
}%
\dolistloop{\@series}%
}%

% \end{macrocode}
% \end{macro}
Expand Down Expand Up @@ -11126,11 +11123,12 @@
% \cs{Xendinsertsep@} is set to true at the first note of the series, and to false at the last one.
% \begin{macrocode}
\newif\ifXendinsertsep@%
\newcommand*{\doendnotes}[1]{\l@dend@close
\newcommand*{\doendnotes}[1]{%
\l@dend@close{#1}%
\begingroup
\makeatletter
\expandafter\let\csname #1end\endcsname=\endprint
\input\jobname.end
\input\jobname.#1end%
\global\Xendinsertsep@false%
\endgroup}
% \end{macrocode}
Expand All @@ -11142,7 +11140,7 @@
% \cs{doendnotesbysection} print the endnotes for the first numbered section at its first call for a series, then for the second section at its second call for the same series, then for the third section at its third call for the same series, and so on.
% \begin{macrocode}
\newcommand*{\doendnotesbysection}[1]{%
\l@dend@close%
\l@dend@close{#1}%
\global\expandafter\advance\csname #1end@bysection\endcsname by 1%
\begingroup%
\makeatletter%
Expand All @@ -11151,7 +11149,7 @@
{\cslet{#1end}{\endprint}}%
{\cslet{#1end}{\@gobblefive}}%
}%
\input\jobname.end%
\input\jobname.#1end%
\global\Xendinsertsep@false%
\endgroup%
}%
Expand Down Expand Up @@ -11390,16 +11388,36 @@
\fi
% \end{macrocode}
% \subsection{The endnotes}
% \changes{v2.0.0}{2015/06/28}{One endnotes file by series.}
% Endnotes are commands like \cs{Xendnote}, where X is a series letter.
% First, we check for the \verb+noend+ options.
% \begin{macrocode}
\unless\ifnoend@
% \end{macrocode}
% \subsubsection{The auxiliary file}
% \begin{macro}{\l@d@Xend}
% \begin{macro}{\ifl@dend@X}
% \begin{macro}{\l@dend@Xtrue}
% \begin{macro}{\l@dend@Xfalse}
% Endnotes of all varieties are saved up in a file, one by series, typically named
% \meta{jobname}\file{.Xend}.
% \cs{l@d@end} is the output stream number for
% this file, and \cs{ifl@dend@X} is a flag that is \verb"true" when the file is open.
%
%
% \begin{macrocode}
\expandafter\newwrite\csname l@d@#1end\endcsname%
\expandafter\newif\csname ifl@dend@#1\endcsname%
% \end{macrocode}
% \end{macro}
% \end{macro}
% \end{macro}
% \end{macro}
% \subsubsection{The main macro}
% The \cs{Xendnote} macro functions to
% write one endnote to the \file{.end} file. We change
% write one endnote to the \file{.Xend} file. We change
% \cs{newlinechar} so that in the file every space becomes the
% start of a new line; this generally ensures that a long note doesn't
% start of a new line; this generally ensures that a long note does not
% exceed restrictions on the length of lines in files.
% \begin{macrocode}

Expand All @@ -11408,7 +11426,7 @@
\newlinechar='40%
\global\@noneed@Footnotetrue%
\newcommand{\content}{##2}%
\immediate\write\l@d@end{%
\expandafter\immediate\expandafter\write\csname l@d@#1end\endcsname{%
\expandafter\string\csname #1end\endcsname%
{\ifnumberedpar@\l@d@nums\fi}%
{\ifnumberedpar@\expandonce\@tag\fi}%
Expand Down

0 comments on commit 7fedc07

Please sign in to comment.