From 559fa5fe1412df424f60e00b33d20ef1ca773b22 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Sun, 13 Feb 2011 23:35:13 +0000 Subject: hardwrap (12feb11) git-svn-id: svn://tug.org/texlive/trunk@21396 c570f23f-e606-0410-a88d-b1316a301751 --- .../texmf-dist/source/latex/hardwrap/hardwrap.dtx | 80 ++++++++++++++++++---- .../texmf-dist/source/latex/hardwrap/hardwrap.ins | 4 +- 2 files changed, 67 insertions(+), 17 deletions(-) (limited to 'Master/texmf-dist/source/latex/hardwrap') diff --git a/Master/texmf-dist/source/latex/hardwrap/hardwrap.dtx b/Master/texmf-dist/source/latex/hardwrap/hardwrap.dtx index 83389f6f28d..4a8617f6d1b 100644 --- a/Master/texmf-dist/source/latex/hardwrap/hardwrap.dtx +++ b/Master/texmf-dist/source/latex/hardwrap/hardwrap.dtx @@ -9,7 +9,7 @@ \preamble ____________________________ The HARDWRAP package - (C) 2010 Will Robertson + (C) 2010-2011 Will Robertson (C) 2010 Kevin Godby License information appended @@ -51,7 +51,7 @@ This work consists of the file hardwrap.dtx % %\ProvidesPackage{hardwrap} %<*package> - [2010/11/11 v0.1 Hard wrap messages] + [2011/02/12 v0.2 Hard wrap messages] % % \end{macrocode} % @@ -191,6 +191,32 @@ This work consists of the file hardwrap.dtx \newcommand*{\secref}[1]{\hyperref[#1]{section~}\ref{#1}} +% Hang the code line numbers in the margin +\def\macro@code{% + \topsep \MacrocodeTopsep + \@beginparpenalty \predisplaypenalty + \if@inlabel\leavevmode\fi + \trivlist \parskip \z@ \item[]% + \macro@font + \leftskip\@totalleftmargin% \advance\leftskip-\MacroIndent + \rightskip\z@ \parindent\z@ \parfillskip\@flushglue + \blank@linefalse \def\par{\ifblank@line + \leavevmode\fi + \blank@linetrue\@@par + \penalty\interlinepenalty} + \obeylines + \let\do\do@noligs \verbatim@nolig@list + \let\do\@makeother \dospecials + \global\@newlistfalse + \global\@minipagefalse + \ifcodeline@index + \everypar{\global\advance\c@CodelineNo\@ne + \llap{\theCodelineNo\ \hskip\@totalleftmargin}% + \check@module}% + \else \everypar{\check@module}% + \fi + \init@crossref} + \definecolor{niceblue}{rgb}{0.1,0.3,0.9} \def\theCodelineNo{\textcolor{niceblue}{\sffamily\tiny\arabic{CodelineNo}}} \newcommand*\pkg[1]{\textsf{#1}} @@ -215,7 +241,8 @@ This work consists of the file hardwrap.dtx % % \begin{abstract} % \noindent This package provides facilities for hard-wrapping text to a certain -% line width. The primary purpose is to make it easier for package authors to write +% number of characters per line. +% The primary purpose is to make it easier for package authors to write % readable informational messages to the console and log file; % wrappers around \cs{PackageWarning} \etal\ are provided for this. % \end{abstract} @@ -227,7 +254,8 @@ This work consists of the file hardwrap.dtx % \part{User documentation} % \section{Introduction} % -% The \pkg{\jobname} package provides a macro for word-wrapping text. In +% The \pkg{\jobname} package provides a macro for word-wrapping text to a +% certain number of characters per line. In % addition, helper macros are available for package and document class authors % to use in automatically wrapping informational, warning, and error messages. % This package requires \hologo{eTeX}. @@ -310,10 +338,12 @@ This work consists of the file hardwrap.dtx % % \section{Changing the line lengths} % -% While \pkg{\jobname} attempts to determine the appropriate line -% lengths, you may wish to override the value found using +% While \pkg{\jobname} attempts to determine the maximum line +% lengths based on where \TeX\ will wrap its console and log output, +% you may wish to override the value found using % \cs{setmaxprintline}\marg{value}. -% This macro takes an integer value which is subsequently used as the +% This macro takes an integer value which is subsequently used by the +% commands generated with \cs{GenerateLogMacros} as the % maximum line width allowed in the terminal output and log file. By default % this value is~\texttt{79}. % @@ -360,7 +390,15 @@ This work consists of the file hardwrap.dtx % \end{Verbatim} % to write the text to a file after being hard-wrapped with carriage returns (\verb|^^J|) after each line. % -% \newpage +% \section{Support} +% +% Development and historical versions are available from GitHub at +% \url{http://github.com/wspr/hardwrap/}. +% +% Please report bugs and feature suggestions to the issue tracker at +% \url{http://github.com/wspr/hardwrap/issues}. +% +% \clearpage % \splittoc % \part{Implementation} % @@ -538,7 +576,7 @@ This work consists of the file hardwrap.dtx % \begin{macrocode} \newcommand*\HardWrap[5]{% \begingroup - \hw@maxprintline=#2\relax + \hw@maxprintline=\numexpr#2\relax % \end{macrocode} % Replacements for user commands: % \begin{macrocode} @@ -563,7 +601,7 @@ This work consists of the file hardwrap.dtx % \end{macrocode} % Now scan over the text token by token, transforming it into an % intermediate representation of fully wrapped text. -% Then fully expand this intermediate for into its final form, +% Then fully expand this intermediate form into its final form, % ready to be processed by the input function \verb|#1|. % \begin{macrocode} \expandafter\hw@scan\@tempa\hw@scanstop @@ -588,9 +626,9 @@ This work consists of the file hardwrap.dtx % % \begin{macro}{\hw@process} % The \cs{hw@process} macro contains the actual word-wrapping algorithm. -% The text is scanned token by token. Each token falls into one of four +% The text is scanned token by token. Each token falls into one of five % categories: (1)~the stop token \cs{hw@scanstop}, (2)~a space token, -% (3)~a newline insertion, or (4)~anything else. +% (3)~a newline insertion, (4)~an opening brace, or (5)~anything else. % % \begin{enumerate} % \item @@ -604,6 +642,10 @@ This work consists of the file hardwrap.dtx % the current word is the last one that can fit on the line. % To continue, skip the actual token that is the `newline' and then start scanning again. % \item +% If we find an opening brace \verb|{|, we read in the entire brace group, and then +% re-insert it in the scanner surrounded with brace-strings. I.e., braces are printed +% in the output. +% \item % If the token doesn't fall into one of the above special cases, we'll just append it to % the current word and continue reading tokens. % \end{enumerate} @@ -617,10 +659,10 @@ This work consists of the file hardwrap.dtx \def\next{\afterassignment\hw@scan\let\@tempa= }% \else\ifx\let@token\hw@insert@newline \hw@process@messagebreak - \def\next{\expandafter\hw@dochar\@gobble}% + \def\next{\expandafter\hw@scan\@gobble}% \else\ifx\let@token^^J \hw@process@messagebreak - \def\next{\expandafter\hw@dochar\@gobble}% + \def\next{\expandafter\hw@scan\@gobble}% \else\ifx\let@token\bgroup \def\next{\expandafter\hw@dochar\hw@process@group}% \else @@ -912,7 +954,7 @@ This work consists of the file hardwrap.dtx }% } % \end{macrocode} -% Here are our wrappers for \cs{PackageInfo} \etal, which are +% Here are our wrappers for \cs{ClassInfo} \etal, which are % used above to generalise the code a little. Note that these macros are % \cs{protected}, which allows them to be used in an expanding context % without a preceding \cs{noexpand}. @@ -923,6 +965,7 @@ This work consists of the file hardwrap.dtx \protected\def\hw@class@warning@noline#1#2{\ClassWarning{#1}{#2\@gobbletwo}} \protected\def\hw@class@error #1#2{\ClassError {#1}{#2\@gobble}} % \end{macrocode} +% And package messages: % \begin{macrocode} \protected\def\hw@package@info #1#2{\PackageInfo {#1}{#2\hw@suffix}} \protected\def\hw@package@info@noline #1#2{\PackageInfo {#1}{#2\@gobbletwo}} @@ -1033,6 +1076,13 @@ This work consists of the file hardwrap.dtx \end{qstest} % \end{macrocode} % +% \begin{macrocode} +\begin{qstest}{trailing newline bug}{} +\HardWrap{\xdef\TMP}{20}{}{N}{a\\b\\c\\}% +\Expect*{\TMP}*{aNbNcN} +\end{qstest} +% \end{macrocode} +% % \GenerateLogMacros{package}[HW]{hardwrap} % \GenerateLogMacros{class}[HWC]{hardwrap} % ^^A\HW@error{Please ignore this error!\\ I'm only testing things out.}{(Go away.)} diff --git a/Master/texmf-dist/source/latex/hardwrap/hardwrap.ins b/Master/texmf-dist/source/latex/hardwrap/hardwrap.ins index a028f0d44d3..6874b31f17f 100644 --- a/Master/texmf-dist/source/latex/hardwrap/hardwrap.ins +++ b/Master/texmf-dist/source/latex/hardwrap/hardwrap.ins @@ -7,7 +7,7 @@ %% hardwrap.dtx (with options: `batchfile') %% ____________________________ %% The HARDWRAP package -%% (C) 2010 Will Robertson +%% (C) 2010-2011 Will Robertson %% (C) 2010 Kevin Godby %% License information appended %% @@ -16,7 +16,7 @@ \preamble ____________________________ The HARDWRAP package - (C) 2010 Will Robertson + (C) 2010-2011 Will Robertson (C) 2010 Kevin Godby License information appended -- cgit v1.2.3