diff --git a/latexdiff b/latexdiff index 1d16e27..6e64b8f 100755 --- a/latexdiff +++ b/latexdiff @@ -379,6 +379,7 @@ my ($type,$subtype,$floattype,$config,$preamblefile,$encoding,$nolabel,$visiblel $replacecontext1,$appendcontext1, $replacecontext2,$appendcontext2, $help,$verbose,$driver,$version,$ignorewarnings, + $onlyadditions, $enablecitmark,$disablecitmark,$allowspaces,$flatten,$nolinks,$debug,$earlylatexdiffpreamble); ###$disablemathmark, my ($mboxsafe); # MNEMNONICS for mathmarkup @@ -413,6 +414,7 @@ my ($pkg,%packages); # Defaults $mathmarkup=COARSE; $verbose=0; +$onlyadditions=0; # output debug and intermediate files, set to 0 in final distribution $debug=0; # insert preamble directly after documentclass - experimental feature, set to 0 in final distribution @@ -477,6 +479,7 @@ GetOptions('type|t=s' => \$type, 'filter-script=s' => \$filterscript, 'ignore-filter-stderr' => \$ignorefilterstderr, 'no-links' => \$nolinks, + 'no-del' => \$onlyadditions, 'version' => \$version, 'help|h' => \$help, 'debug!' => \$debug ) or die "Use latexdiff -h to get help.\n" ; @@ -2893,9 +2896,14 @@ sub postprocess { # up. This case should be rare, so I just leave this in the diff file output. Not really elegant # but can still be dealt with later if it results in problems. s/%DIFDELCMD < \\RIGHTBRACE/%DIFDELCMD < \\MBLOCKRIGHTBRACE/g ; - # Replace \RIGHTBRACE by } + # Replace \RIGHTBRACE by } s/\\RIGHTBRACE/}/g; + # Optional: Remove deleted block entirely + if ($onlyadditions) { + s/\\DIFdelbegin.*?\\DIFdelend//sg ; + } + ### # change citation commands within comments to protect from processing ### if ($CITECMD){ ### 1 while s/(%.*)\\($CITECMD)/$1\\CITEDIF$2/m ; @@ -3827,6 +3835,8 @@ be real files (not pipes or similar) as they are opened twice. [ Default: scan the preamble for \\usepackage commands to determine loaded packages.] +--no-del Supress deleted text from the diff. + --show-preamble Print generated or included preamble commands to stdout. --show-safecmd Print list of regex matching and excluding safe commands. diff --git a/testsuite/no-del-new.tex b/testsuite/no-del-new.tex new file mode 100644 index 0000000..4bcaf15 --- /dev/null +++ b/testsuite/no-del-new.tex @@ -0,0 +1,60 @@ +\documentclass[12pt,a4paper]{article} + +\setlength{\topmargin}{-0.2in} +\setlength{\textheight}{9.5in} +\setlength{\oddsidemargin}{0.0in} + +\setlength{\textwidth}{6in} + +\title{latexdiff Example - Revised version} +\author{F Tilmann} +% Note how in the preamble visual markup is never used (even +% if some preamble might eventually end up as visible text.) + +\begin{document} +\maketitle + +\section*{Introduction} + +This is an extremely simple document that showcases some of the latexdiff features. +Type +\begin{verbatim} +latexdiff -t UNDERLINE example-draft.tex example-rev.tex > example-diff.tex +\end{verbatim} +to create the difference file. You can inspect this file directly. Then run either +\begin{verbatim} +pdflatex example-diff.tex +xpdf example-diff.pdf +\end{verbatim} +or +\begin{verbatim} +latex example-diff.tex +dvips -o example-diff.ps example-diff.dvi +gv example-diff.ps +\end{verbatim} +to display the markup. + +\section*{Yet another section title} + + More things could be said were it not for the constraints of time and space. + +A paragraph with a line only in the revised document. More things could be +said were it not for the constraints of time and space. + +And here is a typo. + +Here is a table: + +\begin{tabular}{ll} +Name & Description \\ +\hline +Gandalf & White \\ +Saruman & Evil +\end{tabular} + +And now for something completely different, with not a paragraph in sight. +No change, +no markup! +\end{document} + + diff --git a/testsuite/no-del-old.tex b/testsuite/no-del-old.tex new file mode 100644 index 0000000..593a170 --- /dev/null +++ b/testsuite/no-del-old.tex @@ -0,0 +1,59 @@ +\documentclass[12pt,a4paper]{article} + +\setlength{\topmargin}{-0.2in} +\setlength{\textheight}{9.5in} +\setlength{\oddsidemargin}{0.0in} + +\setlength{\textwidth}{6.5in} + +\title{latexdiff Example - Draft version} +\author{F Tilmann} + +\begin{document} +\maketitle + +\section*{Introduction} + +This is an extremely simple document that showcases some of latexdiff features. +Type +\begin{verbatim} +latexdiff -t UNDERLINE example-draft.tex example-rev.tex > example-diff.tex +\end{verbatim} +to create the difference file. You can inspect this file directly. Then run either +\begin{verbatim} +pdflatex example-diff.tex +xpdf example-diff.pdf +\end{verbatim} +or +\begin{verbatim} +latex example-diff.tex +dvips -o example-diff.ps example-diff.dvi +gv example-diff.ps +\end{verbatim} +to display the markup. + +\section*{Another section title} + +A paragraph with a line only in the draft document. More things could be said +were it not for the constraints of time and space. + +More things could be said were it not for the constraints of time and space. + +And here is a tipo. + +Here is a table: + +\begin{tabular}{ll} +Name & Description \\ +\hline +Gandalf & Grey \\ +Saruman & White +\end{tabular} + +And sometimes a whole paragraph gets completely rewritten. In this +case latexdiff marks up the whole paragraph even if some words in it +are identical. +No change, no markup! +\end{document} + + diff --git a/testsuite/verify b/testsuite/verify index ecb1f4f..5b043d1 100755 --- a/testsuite/verify +++ b/testsuite/verify @@ -22,6 +22,7 @@ DIFDELCMDBUG eqnarray eqnarray2 subscriptm delequ2 schneider gennady umesh under delequ3 delequ4 "simplefrac --allow-spaces" "master --flatten" "subfile --flatten" "import --flatten" titlediffTest2 exampleDiff bornd2 \ "rolla --math-markup=2" mini "complex-maths --math-markup=1" margalit circonflex mwe-comment "apacite-test --flatten" quoteddollarunderscore units complicated-math move-equation2 lists "figures --graphics-markup=both" alignat "safecmd --append-safecmd=remark" verbatim verbatim2-is143 embedded-math-array "verbatim-input --flatten" anchordemo 'customdiffcmdtest --add-to-config "CUSTOMDIFCMD=blindtext;mypar;donothing;cmd"' description frac_w_space_comments \ "href-in-bibliography --append-safecmd=path" revtex-bibliography biblatex 'txtcmd-with-multiple-arguments --append-textcmd=cmd' \ +"no-del --no-del" \ ) #set testroots= ( test subscript )