From 3f6f22a9bc526f6bcc6a25fc684b59f0e405bb9d Mon Sep 17 00:00:00 2001 From: cmhughes Date: Tue, 6 Apr 2021 12:19:36 +0100 Subject: [PATCH 1/4] Some 'master' occurences changed to 'main' --- documentation/latexindent.ind | 366 +++++++++++++++++----------------- helper-scripts/prepctan.sh | 4 +- helper-scripts/readme.txt | 4 +- 3 files changed, 188 insertions(+), 186 deletions(-) diff --git a/documentation/latexindent.ind b/documentation/latexindent.ind index 4e6606c5..13617561 100644 --- a/documentation/latexindent.ind +++ b/documentation/latexindent.ind @@ -2,246 +2,248 @@ --- \textbf{B} --- \nopagebreak \item backup files - \subitem cycle through, \hyperpage{19} - \subitem extension settings, \hyperpage{18} - \subitem maximum number of backup files, \hyperpage{18} - \subitem number of backup files, \hyperpage{18} - \subitem overwrite switch, -w, \hyperpage{7} + \subitem cycle through, \hyperpage{25} + \subitem extension settings, \hyperpage{24} + \subitem maximum number of backup files, \hyperpage{24} + \subitem number of backup files, \hyperpage{24} + \subitem overwrite switch, -w, \hyperpage{13} \indexspace --- \textbf{C} --- \nopagebreak - \item capturing parenthesis (regex), \hyperpage{29} + \item capturing parenthesis (regex), \hyperpage{35} \indexspace --- \textbf{D} --- \nopagebreak - \item delimiters, \hyperpage{95} - \subitem advanced settings, \hyperpage{22} - \subitem advanced settings of lookForAlignDelims, \hyperpage{22} - \subitem ampersand \&, \hyperpage{22} - \subitem default settings of lookForAlignDelims, \hyperpage{22} - \subitem delimiter justification (left or right), \hyperpage{29} - \subitem delimiterRegEx, \hyperpage{29} - \subitem dontMeasure feature, \hyperpage{27} - \subitem double backslash demonstration, \hyperpage{26} - \subitem lookForAlignDelims, \hyperpage{22} - \subitem poly-switches for double back slash, \hyperpage{94} - \subitem spacing demonstration, \hyperpage{24} - \subitem with specialBeginEnd and the -m switch, \hyperpage{95} - \subitem within specialBeginEnd blocks, \hyperpage{34} + \item delimiters, \hyperpage{103} + \subitem advanced settings, \hyperpage{28} + \subitem advanced settings of lookForAlignDelims, \hyperpage{28} + \subitem ampersand \&, \hyperpage{28} + \subitem default settings of lookForAlignDelims, \hyperpage{28} + \subitem delimiter justification (left or right), \hyperpage{35} + \subitem delimiterRegEx, \hyperpage{35} + \subitem dontMeasure feature, \hyperpage{33} + \subitem double backslash demonstration, \hyperpage{32} + \subitem lookForAlignDelims, \hyperpage{28} + \subitem poly-switches for double back slash, \hyperpage{102} + \subitem spacing demonstration, \hyperpage{30} + \subitem with specialBeginEnd and the -m switch, \hyperpage{104} + \subitem within specialBeginEnd blocks, \hyperpage{41} \indexspace --- \textbf{I} --- \nopagebreak \item indentation - \subitem customising indentation per-code block, \hyperpage{37} - \subitem customising per-name, \hyperpage{37} - \subitem default, \hyperpage{10} - \subitem defaultIndent description, \hyperpage{21} - \subitem defaultIndent using -y switch, \hyperpage{10} - \subitem defaultIndent using YAML file, \hyperpage{14} - \subitem maximum indetation, \hyperpage{36} - \subitem no additional indent, \hyperpage{37} - \subitem no additional indent global, \hyperpage{37} - \subitem removing indentation per-code block, \hyperpage{37} - \subitem summary, \hyperpage{54} + \subitem customising indentation per-code block, \hyperpage{44} + \subitem customising per-name, \hyperpage{44} + \subitem default, \hyperpage{16} + \subitem defaultIndent description, \hyperpage{27} + \subitem defaultIndent using -y switch, \hyperpage{16} + \subitem defaultIndent using YAML file, \hyperpage{20} + \subitem maximum indetation, \hyperpage{43} + \subitem no additional indent, \hyperpage{44} + \subitem no additional indent global, \hyperpage{44} + \subitem removing indentation per-code block, \hyperpage{44} + \subitem summary, \hyperpage{62} \indexspace --- \textbf{L} --- \nopagebreak \item linebreaks - \subitem summary of poly-switches, \hyperpage{95} + \subitem summary of poly-switches, \hyperpage{103} \indexspace --- \textbf{M} --- \nopagebreak \item modifying linebreaks - \subitem at the \emph{beginning} of a code block, \hyperpage{87} - \subitem at the \emph{end} of a code block, \hyperpage{89} - \subitem by text wrapping, globally, \hyperpage{61} - \subitem by text wrapping, per-code-block, \hyperpage{65} - \subitem by using one sentence per line, \hyperpage{70} - \subitem surrounding double back slash, \hyperpage{94} - \subitem using poly-switches, \hyperpage{86} + \subitem at the \emph{beginning} of a code block, \hyperpage{95} + \subitem at the \emph{end} of a code block, \hyperpage{97} + \subitem by text wrapping, globally, \hyperpage{69} + \subitem by text wrapping, per-code-block, \hyperpage{73} + \subitem by using one sentence per line, \hyperpage{78} + \subitem surrounding double back slash, \hyperpage{102} + \subitem using poly-switches, \hyperpage{94} \indexspace --- \textbf{P} --- \nopagebreak \item poly-switches - \subitem adding blank lines (again!): set to 4, \hyperpage{88}, - \hyperpage{90} - \subitem adding blank lines: set to 3, \hyperpage{88, 89} + \subitem adding blank lines (again!): set to 4, \hyperpage{96}, + \hyperpage{98} + \subitem adding blank lines: set to 3, \hyperpage{96, 97} \subitem adding comments and then line breaks: set to 2, - \hyperpage{87}, \hyperpage{89} - \subitem adding line breaks: set to 1, \hyperpage{87}, - \hyperpage{89} - \subitem blank lines, \hyperpage{92} - \subitem conflicting partnering, \hyperpage{99} - \subitem conflicting switches, \hyperpage{100, 101} - \subitem default values, \hyperpage{87} - \subitem definition, \hyperpage{86} - \subitem double backslash, \hyperpage{95} - \subitem environment global example, \hyperpage{87} - \subitem environment per-code block example, \hyperpage{87} - \subitem for double back slash (delimiters), \hyperpage{94--97} - \subitem off by default: set to 0, \hyperpage{86} - \subitem removing line breaks: set to -1, \hyperpage{91} - \subitem summary of all poly-switches, \hyperpage{97} - \subitem values, \hyperpage{86} + \hyperpage{95}, \hyperpage{97} + \subitem adding line breaks: set to 1, \hyperpage{95}, + \hyperpage{97} + \subitem blank lines, \hyperpage{101} + \subitem conflicting partnering, \hyperpage{107} + \subitem conflicting switches, \hyperpage{108, 109} + \subitem default values, \hyperpage{95} + \subitem definition, \hyperpage{94} + \subitem double backslash, \hyperpage{103} + \subitem environment global example, \hyperpage{95} + \subitem environment per-code block example, \hyperpage{95} + \subitem for double back slash (delimiters), \hyperpage{102--105} + \subitem off by default: set to 0, \hyperpage{94} + \subitem removing line breaks: set to -1, \hyperpage{99} + \subitem summary of all poly-switches, \hyperpage{105} + \subitem values, \hyperpage{94} \subitem visualisation: $\BeginStartsOnOwnLine$, $\BodyStartsOnOwnLine$, $\EndStartsOnOwnLine$, $\EndFinishesWithLineBreak$, - \hyperpage{87} + \hyperpage{95} \indexspace --- \textbf{R} --- \nopagebreak \item regular expressions - \subitem a word about, \hyperpage{5} - \subitem ampersand alignment, \hyperpage{22} - \subitem arguments, \hyperpage{112} - \subitem at least one +, \hyperpage{35}, \hyperpage{105}, - \hyperpage{108}, \hyperpage{112--114} - \subitem capturing parenthesis, \hyperpage{29} - \subitem commands, \hyperpage{112} - \subitem delimiter alignment for edge or node, \hyperpage{34} - \subitem delimiter regex at \#, \hyperpage{30} - \subitem delimiter regex at \# or \textbackslash>, \hyperpage{30} + \subitem a word about, \hyperpage{11} + \subitem ampersand alignment, \hyperpage{28} + \subitem arguments, \hyperpage{120} + \subitem at least one +, \hyperpage{41}, \hyperpage{113}, + \hyperpage{116}, \hyperpage{120--122} + \subitem capturing parenthesis, \hyperpage{35} + \subitem commands, \hyperpage{120} + \subitem delimiter alignment for edge or node, \hyperpage{41} + \subitem delimiter regex at \#, \hyperpage{36} + \subitem delimiter regex at \# or \textbackslash>, \hyperpage{37} \subitem delimiter regex at \textbackslash= or \textbackslash>, - \hyperpage{29} - \subitem delimiter regex at only \textbackslash>, \hyperpage{29} - \subitem delimiterRegEx, \hyperpage{22} - \subitem dontMeasure feature, cell, \hyperpage{27} - \subitem dontMeasure feature, row, \hyperpage{28} - \subitem environments, \hyperpage{112} - \subitem fine tuning, \hyperpage{112} - \subitem horizontal space \textbackslash{h}, \hyperpage{35}, - \hyperpage{37}, \hyperpage{78}, \hyperpage{108, 109}, - \hyperpage{112} - \subitem ifElseFi, \hyperpage{112} - \subitem keyEqualsValuesBracesBrackets, \hyperpage{112} - \subitem lowercase alph a-z, \hyperpage{28}, \hyperpage{37}, - \hyperpage{70}, \hyperpage{72}, \hyperpage{74}, - \hyperpage{78}, \hyperpage{112} - \subitem modifyLineBreaks, \hyperpage{112} - \subitem NamedGroupingBracesBrackets, \hyperpage{112} - \subitem numeric 0-9, \hyperpage{34}, \hyperpage{37}, - \hyperpage{74}, \hyperpage{78}, \hyperpage{112} - \subitem replacement switch, -r, \hyperpage{104} - \subitem substitution field, arraycolsep, \hyperpage{105} - \subitem substitution field, equation, \hyperpage{107} - \subitem UnNamedGroupingBracesBrackets, \hyperpage{112} - \subitem uppercase alph A-Z, \hyperpage{34}, \hyperpage{37}, - \hyperpage{70}, \hyperpage{72}, \hyperpage{78}, - \hyperpage{112} - \subitem using -y switch, \hyperpage{16} + \hyperpage{35} + \subitem delimiter regex at only \textbackslash>, \hyperpage{36} + \subitem delimiterRegEx, \hyperpage{28} + \subitem dontMeasure feature, cell, \hyperpage{34} + \subitem dontMeasure feature, row, \hyperpage{35} + \subitem environments, \hyperpage{120} + \subitem fine tuning, \hyperpage{120} + \subitem horizontal space \textbackslash{h}, \hyperpage{41}, + \hyperpage{44}, \hyperpage{87}, \hyperpage{116, 117}, + \hyperpage{120} + \subitem ifElseFi, \hyperpage{120} + \subitem keyEqualsValuesBracesBrackets, \hyperpage{120} + \subitem lowercase alph a-z, \hyperpage{34, 35}, \hyperpage{44}, + \hyperpage{78}, \hyperpage{80}, \hyperpage{82}, + \hyperpage{87}, \hyperpage{120} + \subitem modifyLineBreaks, \hyperpage{120} + \subitem NamedGroupingBracesBrackets, \hyperpage{120} + \subitem numeric 0-9, \hyperpage{41}, \hyperpage{44}, + \hyperpage{82}, \hyperpage{87}, \hyperpage{120} + \subitem replacement switch, -r, \hyperpage{112} + \subitem substitution field, arraycolsep, \hyperpage{113} + \subitem substitution field, equation, \hyperpage{115} + \subitem UnNamedGroupingBracesBrackets, \hyperpage{120} + \subitem uppercase alph A-Z, \hyperpage{41}, \hyperpage{44}, + \hyperpage{78}, \hyperpage{80}, \hyperpage{87}, + \hyperpage{120} + \subitem using -y switch, \hyperpage{22} \indexspace --- \textbf{S} --- \nopagebreak \item sentences - \subitem begin with, \hyperpage{72, 73} - \subitem end with, \hyperpage{72}, \hyperpage{74} - \subitem follow, \hyperpage{72} - \subitem indenting, \hyperpage{77} - \subitem one sentence per line, \hyperpage{70} - \subitem oneSentencePerLine, \hyperpage{70} - \subitem removing sentence line breaks, \hyperpage{71} - \subitem text wrapping, \hyperpage{77} + \subitem begin with, \hyperpage{80, 81} + \subitem end with, \hyperpage{80}, \hyperpage{82} + \subitem follow, \hyperpage{80} + \subitem indenting, \hyperpage{85} + \subitem one sentence per line, \hyperpage{78} + \subitem oneSentencePerLine, \hyperpage{78} + \subitem removing sentence line breaks, \hyperpage{79} + \subitem text wrapping, \hyperpage{85} \item specialBeginEnd - \subitem alignment at delimiter, \hyperpage{34} - \subitem combined with lookForAlignDelims, \hyperpage{34} - \subitem default settings, \hyperpage{31} - \subitem delimiterRegEx, \hyperpage{34} - \subitem delimiterRegEx tweaked, \hyperpage{35} - \subitem double backslash poly-switch demonstration, \hyperpage{95} - \subitem IfElsFi example, \hyperpage{33} - \subitem indentRules example, \hyperpage{49} - \subitem indentRulesGlobal, \hyperpage{54} - \subitem introduction, \hyperpage{31} - \subitem lookForAlignDelims, \hyperpage{95} - \subitem middle, \hyperpage{33} - \subitem noAdditionalIndent, \hyperpage{49} - \subitem noAdditionalIndentGlobal, \hyperpage{54} - \subitem paragraphsStopAt, \hyperpage{84} - \subitem poly-switch summary, \hyperpage{97} - \subitem removeParagraphLineBreaks, \hyperpage{79} - \subitem searching for special before commands, \hyperpage{32} - \subitem specifying as verbatim, \hyperpage{34} - \subitem textWrapOptions, \hyperpage{65} - \subitem tikz example, \hyperpage{34} - \subitem update to displaymath V3.0, \hyperpage{124} + \subitem alignment at delimiter, \hyperpage{41} + \subitem combined with lookForAlignDelims, \hyperpage{41} + \subitem default settings, \hyperpage{38} + \subitem delimiterRegEx, \hyperpage{41} + \subitem delimiterRegEx tweaked, \hyperpage{41} + \subitem double backslash poly-switch demonstration, + \hyperpage{103} + \subitem IfElsFi example, \hyperpage{39} + \subitem indentRules example, \hyperpage{57} + \subitem indentRulesGlobal, \hyperpage{62} + \subitem introduction, \hyperpage{38} + \subitem lookForAlignDelims, \hyperpage{103} + \subitem middle, \hyperpage{39} + \subitem noAdditionalIndent, \hyperpage{57} + \subitem noAdditionalIndentGlobal, \hyperpage{62} + \subitem paragraphsStopAt, \hyperpage{92} + \subitem poly-switch summary, \hyperpage{105} + \subitem removeParagraphLineBreaks, \hyperpage{87} + \subitem searching for special before commands, \hyperpage{38} + \subitem specifying as verbatim, \hyperpage{40} + \subitem textWrapOptions, \hyperpage{73} + \subitem tikz example, \hyperpage{41} + \subitem update to displaymath V3.0, \hyperpage{133} \item switches - \subitem -c, --cruft definition and details, \hyperpage{11} - \subitem -d, --onlydefault definition and details, \hyperpage{11} - \subitem -g, --logfile definition and details, \hyperpage{11} - \subitem -h, --help definition and details, \hyperpage{7} - \subitem -l demonstration, \hyperpage{15, 16}, \hyperpage{24}, - \hyperpage{27--30}, \hyperpage{32--34}, \hyperpage{36}, - \hyperpage{39--51}, \hyperpage{55--58}, - \hyperpage{62--64}, \hyperpage{66, 67}, \hyperpage{69}, - \hyperpage{71--84}, \hyperpage{86--97}, - \hyperpage{99--102}, \hyperpage{104--110}, - \hyperpage{113, 114} - \subitem -l in relation to other settings, \hyperpage{16} - \subitem -l, --local definition and details, \hyperpage{9} - \subitem -m demonstration, \hyperpage{61--64}, \hyperpage{66, 67}, - \hyperpage{69}, \hyperpage{71--84}, \hyperpage{86--97}, - \hyperpage{99--102}, \hyperpage{107} + \subitem -c, --cruft definition and details, \hyperpage{17} + \subitem -d, --onlydefault definition and details, \hyperpage{17} + \subitem -g, --logfile definition and details, \hyperpage{17} + \subitem -h, --help definition and details, \hyperpage{13} + \subitem -l demonstration, \hyperpage{21, 22}, \hyperpage{30}, + \hyperpage{33--37}, \hyperpage{39--43}, + \hyperpage{46--59}, \hyperpage{63--66}, + \hyperpage{70--72}, \hyperpage{74, 75}, \hyperpage{77}, + \hyperpage{79--92}, \hyperpage{94--105}, + \hyperpage{107--110}, \hyperpage{112--118}, + \hyperpage{122} + \subitem -l in relation to other settings, \hyperpage{22} + \subitem -l, --local definition and details, \hyperpage{15} + \subitem -m demonstration, \hyperpage{69--72}, \hyperpage{74, 75}, + \hyperpage{77}, \hyperpage{79--92}, + \hyperpage{94--105}, \hyperpage{107--110}, + \hyperpage{115} \subitem -m, --modifylinebreaks definition and details, - \hyperpage{11} - \subitem -o demonstration, \hyperpage{26}, \hyperpage{30}, - \hyperpage{34}, \hyperpage{62--64}, \hyperpage{80--84}, - \hyperpage{86}, \hyperpage{109}, \hyperpage{124} - \subitem -o, --output definition and details, \hyperpage{8} - \subitem -r demonstration, \hyperpage{103--110} - \subitem -r, --replacement definition and details, \hyperpage{12} - \subitem -rr demonstration, \hyperpage{106}, \hyperpage{109} + \hyperpage{17} + \subitem -o demonstration, \hyperpage{32}, \hyperpage{36, 37}, + \hyperpage{41}, \hyperpage{70--72}, \hyperpage{88--92}, + \hyperpage{94}, \hyperpage{117}, \hyperpage{133} + \subitem -o, --output definition and details, \hyperpage{14} + \subitem -r demonstration, \hyperpage{111--118} + \subitem -r, --replacement definition and details, \hyperpage{18} + \subitem -rr demonstration, \hyperpage{114}, \hyperpage{117} \subitem -rr, --onlyreplacement definition and details, - \hyperpage{12} - \subitem -rv demonstration, \hyperpage{109} + \hyperpage{18} + \subitem -rv demonstration, \hyperpage{117} \subitem -rv, --replacementrespectverb definition and details, - \hyperpage{12} - \subitem -s, --silent definition and details, \hyperpage{9} - \subitem -sl, --screenlog definition and details, \hyperpage{11} - \subitem -t, --trace definition and details, \hyperpage{9} - \subitem -tt, --ttrace definition and details, \hyperpage{9} - \subitem -v, --version definition and details, \hyperpage{7} - \subitem -w, --overwrite definition and details, \hyperpage{7} - \subitem -y demonstration, \hyperpage{16}, \hyperpage{26}, - \hyperpage{78} - \subitem -y, --yaml definition and details, \hyperpage{10} + \hyperpage{18} + \subitem -s, --silent definition and details, \hyperpage{15} + \subitem -sl, --screenlog definition and details, \hyperpage{17} + \subitem -t, --trace definition and details, \hyperpage{15} + \subitem -tt, --ttrace definition and details, \hyperpage{15} + \subitem -v, --version definition and details, \hyperpage{13} + \subitem -w, --overwrite definition and details, \hyperpage{13} + \subitem -y demonstration, \hyperpage{22}, \hyperpage{32}, + \hyperpage{86} + \subitem -y, --yaml definition and details, \hyperpage{16} \indexspace --- \textbf{V} --- \nopagebreak \item verbatim - \subitem commands, \hyperpage{19} - \subitem comparison with -r and -rr switches, \hyperpage{109} - \subitem environments, \hyperpage{19} - \subitem in relation to oneSentencePerLine, \hyperpage{76} - \subitem in relation to paragraphsStopAt, \hyperpage{84} - \subitem in relation to textWrapOptions, \hyperpage{62} - \subitem noIndentBlock, \hyperpage{20} - \subitem poly-switch summary, \hyperpage{97} - \subitem rv, replacementrespectverb switch, \hyperpage{12}, - \hyperpage{103} - \subitem specialBeginEnd, \hyperpage{33} + \subitem commands, \hyperpage{25} + \subitem comparison with -r and -rr switches, \hyperpage{117} + \subitem environments, \hyperpage{25} + \subitem in relation to oneSentencePerLine, \hyperpage{84} + \subitem in relation to paragraphsStopAt, \hyperpage{92} + \subitem in relation to textWrapOptions, \hyperpage{70} + \subitem noIndentBlock, \hyperpage{26} + \subitem poly-switch summary, \hyperpage{105} + \subitem rv, replacementrespectverb switch, \hyperpage{18}, + \hyperpage{111} + \subitem specialBeginEnd, \hyperpage{40} \subitem verbatimEnvironments demonstration (-l switch), - \hyperpage{15} + \hyperpage{21} \subitem verbatimEnvironments demonstration (-y switch), - \hyperpage{16} - \subitem within summary of text wrapping, \hyperpage{70} + \hyperpage{22} + \subitem within summary of text wrapping, \hyperpage{78} \indexspace --- \textbf{W} --- \nopagebreak \item warning - \subitem amalgamate field, \hyperpage{58} - \subitem be sure to test before use, \hyperpage{3} + \subitem amalgamate field, \hyperpage{67} + \subitem be sure to test before use, \hyperpage{9} \subitem capturing parenthesis for lookForAlignDelims, - \hyperpage{29} - \subitem editing YAML files, \hyperpage{15} - \subitem fine tuning, \hyperpage{112} - \subitem the m switch, \hyperpage{61} + \hyperpage{35} + \subitem editing YAML files, \hyperpage{21} + \subitem fine tuning, \hyperpage{120} + \subitem the m switch, \hyperpage{69} \end{theindex} diff --git a/helper-scripts/prepctan.sh b/helper-scripts/prepctan.sh index 5fa7cb11..fe17bfe6 100755 --- a/helper-scripts/prepctan.sh +++ b/helper-scripts/prepctan.sh @@ -1,8 +1,8 @@ #!/bin/bash # A little script to help me prepare the bundle for ctan -# make sure to be on the master branch -git checkout master +# make sure to be on the main branch +git checkout main # re-compile the documentation cd ../documentation arara latexindent diff --git a/helper-scripts/readme.txt b/helper-scripts/readme.txt index bc72d047..37d9569f 100644 --- a/helper-scripts/readme.txt +++ b/helper-scripts/readme.txt @@ -12,8 +12,8 @@ Typical running order of these helper scripts: - - - - - - - + - + - - git tag "V" - git push --tags - From da2b15eb64ee0e14eff3e8f606930bce4cedbdd8 Mon Sep 17 00:00:00 2001 From: cmhughes Date: Sat, 24 Apr 2021 19:50:49 +0100 Subject: [PATCH 2/4] log file process will no longer cause script to fail if the log file can not be opened: https://github.com/cmhughes/latexindent.pl/issues/145 --- LatexIndent/Document.pm | 17 ++++++++++------- documentation/sec-default-user-local.tex | 3 ++- documentation/sec-how-to-use.tex | 8 ++++++++ 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/LatexIndent/Document.pm b/LatexIndent/Document.pm index 0b3ea9b2..25bf3876 100644 --- a/LatexIndent/Document.pm +++ b/LatexIndent/Document.pm @@ -162,15 +162,18 @@ sub output_indented_text{ # open log file my $logfileName = $switches{logFileName}||"indent.log"; my $logfile; - open($logfile,">","${$self}{cruftDirectory}/$logfileName") or die "Can't open $logfileName"; + my $logfilePossible = 1; + open($logfile,">","${$self}{cruftDirectory}/$logfileName") or $logfilePossible =0; - foreach my $line (@{LatexIndent::Logger::logFileLines}){ - print $logfile $line,"\n"; - } + if($logfilePossible){ + foreach my $line (@{LatexIndent::Logger::logFileLines}){ + print $logfile $line,"\n"; + } + + # close log file + close($logfile); + } - # close log file - close($logfile); - # output to screen, unless silent mode print ${$self}{body} unless $switches{silentMode}; diff --git a/documentation/sec-default-user-local.tex b/documentation/sec-default-user-local.tex index 5e04637e..2e5afbcd 100644 --- a/documentation/sec-default-user-local.tex +++ b/documentation/sec-default-user-local.tex @@ -152,7 +152,8 @@ \section{defaultSettings.yaml}\label{sec:defuseloc} %(*@@*)\end{noindent} \end{cmhlistings} - Important note: it is assumed that the \texttt{noindent} block statements appear on their own line. + Important note: it is assumed that the \texttt{noindent} block statements appear on + their own line. \yamltitle{removeTrailingWhitespace}*{fields}\label{yaml:removeTrailingWhitespace} diff --git a/documentation/sec-how-to-use.tex b/documentation/sec-how-to-use.tex index 8c7d9b95..510df8c6 100644 --- a/documentation/sec-how-to-use.tex +++ b/documentation/sec-how-to-use.tex @@ -317,6 +317,14 @@ \subsection{From the command line}\label{sec:commandline} if you wish to change the name of this file, simply call the script with your chosen name after the \texttt{-g} switch as demonstrated above. + \announce{new}{log file updated} If \texttt{latexindent.pl} can not open the log file that you + specify, then the script + will operate, and no log file will be produced; this might be helpful to users who wish + to specify the following, for example + \begin{commandshell} +latexindent.pl -g /dev/null myfile.tex +\end{commandshell} + \flagbox{-sl, --screenlog} \index{switches!-sl, --screenlog definition and details} \begin{commandshell} From c1fac58eccffc0f799f1807c365d1b662e9d391e Mon Sep 17 00:00:00 2001 From: cmhughes Date: Sun, 25 Apr 2021 16:46:13 +0100 Subject: [PATCH 3/4] Logger update to include FATAL method, and improved messaging for when file does not exist --- LatexIndent/Document.pm | 17 +++++++++++++---- LatexIndent/FileExtension.pm | 10 ++++++---- LatexIndent/Logger.pm | 14 ++++++++++++++ documentation/sec-how-to-use.tex | 5 ++--- documentation/sec-the-m-switch.tex | 18 +++++++++--------- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/LatexIndent/Document.pm b/LatexIndent/Document.pm index 25bf3876..863d4d7d 100644 --- a/LatexIndent/Document.pm +++ b/LatexIndent/Document.pm @@ -153,6 +153,19 @@ sub output_indented_text{ $logger->info("Not outputting to file; see -w and -o switches for more options."); } + # output the log file information + $self->output_logfile(); + + # output to screen, unless silent mode + print ${$self}{body} unless $switches{silentMode}; + + return; +} + +sub output_logfile{ + + my $self = shift; + # # put the final line in the logfile $logger->info("${$masterSettings{logFilePreferences}}{endLogFileWith}") if ${$masterSettings{logFilePreferences}}{endLogFileWith}; @@ -174,10 +187,6 @@ sub output_indented_text{ close($logfile); } - # output to screen, unless silent mode - print ${$self}{body} unless $switches{silentMode}; - - return; } sub process_body_of_text{ diff --git a/LatexIndent/FileExtension.pm b/LatexIndent/FileExtension.pm index 499ca9f6..6902b0f4 100644 --- a/LatexIndent/FileExtension.pm +++ b/LatexIndent/FileExtension.pm @@ -48,8 +48,8 @@ sub file_extension_check{ if ($fileName ne "-"){ if (!$ext) { $logger->info("*File extension work:"); - $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for file with an extension in the following order (see fileExtensionPreference):"); - $logger->info(join("\n",@fileExtensions)); + $logger->info("latexindent called to act upon $fileName without a file extension;\nsearching for files in the following order (see fileExtensionPreference):"); + $logger->info($fileName.join("\n$fileName",@fileExtensions)); my $fileFound = 0; # loop through the known file extensions (see @fileExtensions) @@ -70,13 +70,15 @@ sub file_extension_check{ $logger->fatal("I searched for $fileName$_"); } $logger->fatal("but couldn't find any of them.\nConsider updating fileExtensionPreference.\nExiting, no indendation done."); - die "I couldn't find a match for $fileName in fileExtensionPreference.\nExiting, no indendation done."; + $self->output_logfile(); + die "ERROR: I couldn't find any of the following files: ".$fileName.join(", $fileName",@fileExtensions)." (see fileExtensionPreference)\nExiting, no indendation done."; } } else { # if the file has a recognised extension, check that the file exists unless( -e $fileName ){ - my $message = "I couldn't find $fileName, are you sure it exists?.\nNo indentation done.\nExiting."; + my $message = "ERROR: I couldn't find $fileName, are you sure it exists?\nNo indentation done.\nExiting."; $logger->fatal("*$message"); + $self->output_logfile(); die $message; } } diff --git a/LatexIndent/Logger.pm b/LatexIndent/Logger.pm index 02bcd23d..35ff428e 100644 --- a/LatexIndent/Logger.pm +++ b/LatexIndent/Logger.pm @@ -49,6 +49,20 @@ sub warn{ print $logfileline,"\n" if $switches{screenlog}; } +sub fatal{ + my $self = shift; + my $logfileline = shift; + if ($logfileline =~ m/^\*/s){ + $logfileline =~ s/^\*/FATAL /s; + $logfileline =~ s/^/ /mg; + $logfileline =~ s/^\h+FATAL/FATAL/s; + } else { + $logfileline =~ s/^/ /mg; + } + push(@logFileLines,$logfileline); + print $logfileline,"\n" if $switches{screenlog}; +} + sub trace{ my $self = shift; my $logfileline = shift; diff --git a/documentation/sec-how-to-use.tex b/documentation/sec-how-to-use.tex index 510df8c6..ba81425d 100644 --- a/documentation/sec-how-to-use.tex +++ b/documentation/sec-how-to-use.tex @@ -318,9 +318,8 @@ \subsection{From the command line}\label{sec:commandline} after the \texttt{-g} switch as demonstrated above. \announce{new}{log file updated} If \texttt{latexindent.pl} can not open the log file that you - specify, then the script - will operate, and no log file will be produced; this might be helpful to users who wish - to specify the following, for example + specify, then the script will operate, and no log file will be produced; this might be + helpful to users who wish to specify the following, for example \begin{commandshell} latexindent.pl -g /dev/null myfile.tex \end{commandshell} diff --git a/documentation/sec-the-m-switch.tex b/documentation/sec-the-m-switch.tex index c77ed24e..13ee49d1 100644 --- a/documentation/sec-the-m-switch.tex +++ b/documentation/sec-the-m-switch.tex @@ -1901,17 +1901,17 @@ \subsection{Poly-switches for other code blocks} \toprule Code block & Sample & \multicolumn{2}{c}{Poly-switch mapping} \\ \midrule - environment & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\ - & \verb!\begin{myenv}!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ - & \verb!body of myenv!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\ - & \verb!\end{myenv}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\ - & \verb!after words! & & \\ + environment & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & BeginStartsOnOwnLine \\ + & \verb!\begin{myenv}!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ + & \verb!body of myenv!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & EndStartsOnOwnLine \\ + & \verb!\end{myenv}!$\EndFinishesWithLineBreak$ & $\EndFinishesWithLineBreak$ & EndFinishesWithLineBreak \\ + & \verb!after words! & & \\ \cmidrule{2-4} - ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\ - & \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ - & \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine % + ifelsefi & \verb!before words!$\BeginStartsOnOwnLine$ & $\BeginStartsOnOwnLine$ & IfStartsOnOwnLine \\ + & \verb!\if...!$\BodyStartsOnOwnLine$ & $\BodyStartsOnOwnLine$ & BodyStartsOnOwnLine \\ + & \verb!body of if/or statement!$\OrStartsOnOwnLine$ & $\OrStartsOnOwnLine$ & OrStartsOnOwnLine % \announce{2018-04-27}{new ifElseFi code block poly-switches} \\ - & \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\ + & \verb!\or!$\OrFinishesWithLineBreak$ & $\OrFinishesWithLineBreak$ & OrFinishesWithLineBreak \\ & \verb!body of if/or statement!$\ElseStartsOnOwnLine$ & $\ElseStartsOnOwnLine$ & ElseStartsOnOwnLine \\ & \verb!\else!$\ElseFinishesWithLineBreak$ & $\ElseFinishesWithLineBreak$ & ElseFinishesWithLineBreak \\ & \verb!body of else statement!$\EndStartsOnOwnLine$ & $\EndStartsOnOwnLine$ & FiStartsOnOwnLine \\ From 76d63b0360d4bc66783000bef946400a7ba3decc Mon Sep 17 00:00:00 2001 From: cmhughes Date: Fri, 7 May 2021 08:55:45 +0100 Subject: [PATCH 4/4] V3.9.3: updates to logging process --- LatexIndent/Version.pm | 4 ++-- defaultSettings.yaml | 2 +- documentation/changelog.md | 3 +++ documentation/conf.py | 4 ++-- documentation/readme.txt | 2 +- documentation/sec-how-to-use.rst | 9 +++++++++ documentation/sec-how-to-use.tex | 2 +- documentation/title.tex | 4 ++-- helper-scripts/update-version.sh | 8 ++++---- latexindent.pl | 2 +- readme.md | 2 +- 11 files changed, 27 insertions(+), 15 deletions(-) diff --git a/LatexIndent/Version.pm b/LatexIndent/Version.pm index 3751a17a..20cbab26 100644 --- a/LatexIndent/Version.pm +++ b/LatexIndent/Version.pm @@ -19,6 +19,6 @@ use warnings; use Exporter qw/import/; our @EXPORT_OK = qw/$versionNumber $versionDate/; -our $versionNumber = '3.9.2'; -our $versionDate = '2021-04-06'; +our $versionNumber = '3.9.3'; +our $versionDate = '2021-05-07'; 1 diff --git a/defaultSettings.yaml b/defaultSettings.yaml index a1028961..2a927de5 100644 --- a/defaultSettings.yaml +++ b/defaultSettings.yaml @@ -1,4 +1,4 @@ -# defaultSettings.yaml for latexindent.pl, version 3.9.2, 2021-04-06 +# defaultSettings.yaml for latexindent.pl, version 3.9.3, 2021-05-07 # a script that aims to # beautify .tex, .sty, .cls files # diff --git a/documentation/changelog.md b/documentation/changelog.md index 9aaccdc1..37c2d8bd 100644 --- a/documentation/changelog.md +++ b/documentation/changelog.md @@ -1,5 +1,8 @@ # changelog.md +## V3.9.3, April 7, 2021 +minor updates to log file creation https://github.com/cmhughes/latexindent.pl/issues/145 + ## V3.9.2, April 6, 2021 minor update to include noindent block bug fix for https://github.com/cmhughes/latexindent.pl/issues/266 diff --git a/documentation/conf.py b/documentation/conf.py index b7a0ab70..1c8879a1 100644 --- a/documentation/conf.py +++ b/documentation/conf.py @@ -62,9 +62,9 @@ # built documents. # # The short X.Y version. -version = u'3.9.2' +version = u'3.9.3' # The full version, including alpha/beta/rc tags. -release = u'3.9.2' +release = u'3.9.3' # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. diff --git a/documentation/readme.txt b/documentation/readme.txt index 3d68267b..225e4ba5 100644 --- a/documentation/readme.txt +++ b/documentation/readme.txt @@ -1,5 +1,5 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% - latexindent.pl, version 3.9.2, 2021-04-06 + latexindent.pl, version 3.9.3, 2021-05-07 PERL script to indent code within environments, and align delimited environments in .tex files. diff --git a/documentation/sec-how-to-use.rst b/documentation/sec-how-to-use.rst index ef26f669..a0425de4 100644 --- a/documentation/sec-how-to-use.rst +++ b/documentation/sec-how-to-use.rst @@ -378,6 +378,15 @@ By default, ``latexindent.pl`` reports information to ``indent.log``, but if you name of this file, simply call the script with your chosen name after the ``-g`` switch as demonstrated above. +If ``latexindent.pl`` can not open the log file that you specify, then the script will operate, and +no log file will be produced; this might be helpful to users who wish to specify the following, for +example + +.. code-block:: latex + :class: .commandshell + + latexindent.pl -g /dev/null myfile.tex + .. describe:: -sl, –screenlog .. index:: switches;-sl, –screenlog definition and details diff --git a/documentation/sec-how-to-use.tex b/documentation/sec-how-to-use.tex index ba81425d..0760d467 100644 --- a/documentation/sec-how-to-use.tex +++ b/documentation/sec-how-to-use.tex @@ -317,7 +317,7 @@ \subsection{From the command line}\label{sec:commandline} if you wish to change the name of this file, simply call the script with your chosen name after the \texttt{-g} switch as demonstrated above. - \announce{new}{log file updated} If \texttt{latexindent.pl} can not open the log file that you + \announce*{2021-05-07}{log file creation updated} If \texttt{latexindent.pl} can not open the log file that you specify, then the script will operate, and no log file will be produced; this might be helpful to users who wish to specify the following, for example \begin{commandshell} diff --git a/documentation/title.tex b/documentation/title.tex index cd892f13..7545c5d4 100644 --- a/documentation/title.tex +++ b/documentation/title.tex @@ -8,14 +8,14 @@ sharp corners, enhanced, overlay={\node[anchor=north east,outer sep=2pt] at ([xshift=3cm,yshift=4mm]frame.north east) {\includegraphics[width=3cm]{logo}}; }] - \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.9.2 + \centering\ttfamily\bfseries latexindent.pl\\[1cm] Version 3.9.3 \end{tcolorbox} } \author{Chris Hughes \thanks{and contributors! See \vref{sec:contributors}. For all communication, please visit \cite{latexindent-home}.}} -\date{2021-04-06} +\date{2021-05-07} \maketitle \begin{adjustwidth}{1cm}{1cm} \small diff --git a/helper-scripts/update-version.sh b/helper-scripts/update-version.sh index 0fc93414..f1a409e2 100755 --- a/helper-scripts/update-version.sh +++ b/helper-scripts/update-version.sh @@ -20,10 +20,10 @@ do esac done -oldVersion='3.9.1' -newVersion='3.9.2' -oldDate='2021-03-21' -newDate='2021-04-06' +oldVersion='3.9.2' +newVersion='3.9.3' +oldDate='2021-04-06' +newDate='2021-05-07' cd ../ cd documentation diff --git a/latexindent.pl b/latexindent.pl index f339ec59..ef24db27 100755 --- a/latexindent.pl +++ b/latexindent.pl @@ -1,5 +1,5 @@ #!/usr/bin/env perl -# latexindent.pl, version 3.9.2, 2021-04-06 +# latexindent.pl, version 3.9.3, 2021-05-07 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by diff --git a/readme.md b/readme.md index 4ea02841..b637af21 100644 --- a/readme.md +++ b/readme.md @@ -13,7 +13,7 @@ can modify line breaks. ## version - latexindent.pl, version 3.9.2, 2021-04-06 + latexindent.pl, version 3.9.3, 2021-05-07 ## author Chris Hughes (cmhughes)