From cdec5927b395c594b55f0e83e641be4d6227cc73 Mon Sep 17 00:00:00 2001 From: abv Date: Wed, 26 Jul 2017 13:47:04 +0300 Subject: [PATCH] 0028950: Generation of draw_test_harness and upgrade pdf files is crashed Template for LaTeX header used in generation of PDF manuals is corrected to avoid multiple errors during processing by LaTeX (which can eventually lead to LaTeX aborting if their count exceeds 100). Names of log files generated by gendoc command are made dependent on target format and (for PDF output) document name. Formatting bug is fixed in DRAW User Guide --- adm/gendoc.tcl | 59 ++++++++++--------- dox/resources/occt_pdf_template.tex | 12 ++-- dox/resources/occt_ug_pdf.doxyfile | 2 +- .../draw_test_harness/draw_test_harness.md | 2 +- 4 files changed, 40 insertions(+), 35 deletions(-) diff --git a/adm/gendoc.tcl b/adm/gendoc.tcl index 226a587491..e422fd09f5 100644 --- a/adm/gendoc.tcl +++ b/adm/gendoc.tcl @@ -303,13 +303,6 @@ proc gendoc {args} { puts "" - # Clean logfiles - set DOXYLOG [OCCDoc_GetRootDir]/doc/doxygen_warnings_and_errors.log - set PDFLOG [OCCDoc_GetRootDir]/doc/pdflatex_warnings_and_errors.log - - file delete -force $PDFLOG - file delete -force $DOXYLOG - # Start main activities if { $GEN_MODE != "PDF_ONLY" } { if { [OCCDoc_GetProdRootDir] == ""} { @@ -330,15 +323,15 @@ proc gendoc {args} { } } } else { - puts "Generating OCCT User Guides in PDF format...\n" + puts "Generating OCCT User Guides in PDF format..." foreach pdf $DOCFILES { - puts "Info: Processing file $pdf\n" + puts "\nInfo: Processing file $pdf" # Some values are hardcoded because they are related only to PDF generation OCCDoc_Main "OVERVIEW" [list $pdf] {} "PDF_ONLY" $VERB_MODE "none" $MATHJAX_LOCATION "NO" $DOXYGEN_PATH $GRAPHVIZ_PATH $INKSCAPE_PATH $HHC_PATH } - puts "[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed." + puts "\n[clock format [clock seconds] -format {%Y-%m-%d %H:%M}] Generation completed." } } @@ -465,23 +458,31 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s set starttimestamp [clock format [clock seconds] -format {%Y-%m-%d %H:%M}] if { ($generatorMode == "HTML_ONLY") || ($docType == "REFMAN") } { + set LOGPREFIX "html_" puts "$starttimestamp Generating HTML files..." # Copy index file to provide fast access to HTML documentation file copy -force $INDIR/resources/index.html $DOCDIR/index.html } elseif { $generatorMode == "CHM_ONLY" } { + set LOGPREFIX "chm_" puts "$starttimestamp Generating CHM file..." } elseif { $generatorMode == "PDF_ONLY" } { + set LOGPREFIX "[file rootname [file tail [lindex $docfiles 0]]]_" puts "$starttimestamp Generating PDF file..." } - set DOXYLOG $OUTDIR/doxygen_warnings_and_errors.log - set RESULT [catch {exec $DOXYGEN_PATH $DOXYFILE >> $OUTDIR/doxygen_out.log} DOX_ERROR] + # Clean logfiles + set DOXYLOG $OUTDIR/${LOGPREFIX}doxygen_err.log + set DOXYOUT $OUTDIR/${LOGPREFIX}doxygen_out.log + file delete -force $DOXYLOG + file delete -force $DOXYOUT + + set RESULT [catch {exec $DOXYGEN_PATH $DOXYFILE >> $DOXYOUT} DOX_ERROR] if {$RESULT != 0} { set NbErrors [regexp -all -line {^\s*[^\s]+} $DOX_ERROR] if {$NbErrors > 0} { - puts "\nWarning: Doxygen reported $NbErrors messages." - puts "See log in $DOXYLOG\n" + puts "Warning: Doxygen reported $NbErrors messages." + puts "See log in $DOXYLOG" set DOX_ERROR_FILE [open $DOXYLOG "a"] if {$generatorMode == "PDF_ONLY"} { puts $DOX_ERROR_FILE "\n====================================================" @@ -503,7 +504,7 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s if {[OCCDoc_PostProcessor $DOCDIR] == 0} { puts "$curtime Generation completed." puts "\nInfo: doxygen log file is located in:" - puts "$OUTDIR/doxygen_out.log." + puts "${DOXYOUT}." puts "\nReference Manual is generated in \n$DOCDIR" } } elseif { $docType == "OVERVIEW" } { @@ -570,25 +571,29 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s puts "Info: Executing $LATEXDIR/Makefile..." } } - set PDFLOG $OUTDIR/pdflatex_warnings_and_errors.log + + set PDFLOG $OUTDIR/${LOGPREFIX}pdflatex_err.log + set PDFOUT $OUTDIR/${LOGPREFIX}pdflatex_out.log + file delete -force $PDFLOG + file delete -force $PDFOUT if {"$is_win" == "yes"} { - set RESULT [catch {eval exec [auto_execok $LATEXDIR/make.bat] >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR] + set RESULT [catch {eval exec [auto_execok $LATEXDIR/make.bat] >> "$PDFOUT"} LaTeX_ERROR] } else { - set RESULT [catch {eval exec "make -f $LATEXDIR/Makefile" >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR] + set RESULT [catch {eval exec "make -f $LATEXDIR/Makefile" >> "$PDFOUT"} LaTeX_ERROR] # Small workaround for *nix stations set prev_loc [pwd] cd $LATEXDIR - set RESULT [catch {eval exec "pdflatex refman.tex" >> "$OUTDIR/pdflatex_out.log"} LaTeX_ERROR] + set RESULT [catch {eval exec "pdflatex refman.tex" >> "$PDFOUT"} LaTeX_ERROR] cd $prev_loc } if {$RESULT != 0} { set NbErrors [regexp -all -line {^\s*[^\s]+} $LaTeX_ERROR] if {$NbErrors > 0} { - puts "\nWarning: PDFLaTeX reported $NbErrors messages.\nSee log in $PDFLOG\n" - set LaTeX_ERROR_FILE [open $PDFLOG "a"] + puts "Warning: PDFLaTeX reported $NbErrors messages.\nSee log in $PDFLOG" + set LaTeX_ERROR_FILE [open $PDFLOG "a+"] puts $LaTeX_ERROR_FILE "\n====================================================" puts $LaTeX_ERROR_FILE "Logfile of file $TEX:" puts $LaTeX_ERROR_FILE "====================================================\n" @@ -621,6 +626,7 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s set TEX "$PDFNAME" } file rename -force $LATEXDIR/refman.pdf "$destFolder/$TEX.pdf" + puts "Generated $destFolder/$TEX.pdf" } } elseif { $generatorMode == "CHM_ONLY" } { if { [OCCDoc_GetProdRootDir] == ""} { @@ -632,13 +638,10 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s cd $INDIR if { $generatorMode == "HTML_ONLY" } { - puts "\nHTML documentation is generated in \n$DOCDIR" - } - if { $generatorMode == "CHM_ONLY" } { - puts "\nGenerated CHM documentation is in \n$OUTDIR/overview.chm" + puts "HTML documentation is generated in \n$DOCDIR" + } elseif { $generatorMode == "CHM_ONLY" } { + puts "Generated CHM documentation is in \n$OUTDIR/overview.chm" } - - puts "" } # Remove temporary Doxygen files @@ -647,8 +650,6 @@ proc OCCDoc_Main {docType {docfiles {}} {modules {}} generatorMode verboseMode s file delete $file } - puts "\nPDF files are generated in \n[file normalize $OUTDIR]" - return 0 } diff --git a/dox/resources/occt_pdf_template.tex b/dox/resources/occt_pdf_template.tex index c2e13920fe..ff6ec5488b 100644 --- a/dox/resources/occt_pdf_template.tex +++ b/dox/resources/occt_pdf_template.tex @@ -31,6 +31,7 @@ \fontseries{bc}\selectfont% \color{darkgray}% } +\newcommand{\+}{\discretionary{\mbox{\scriptsize$\hookleftarrow$}}{}{}} % Page & text layout \usepackage{geometry} @@ -50,12 +51,12 @@ \makeatletter \renewcommand{\paragraph}{% \@startsection{paragraph}{4}{0ex}{-1.0ex}{1.0ex}{% -\normalfont\normalsize\bfseries\SS@parafont% + \normalfont\normalsize\bfseries\SS@parafont% }% } \renewcommand{\subparagraph}{% \@startsection{subparagraph}{5}{0ex}{-1.0ex}{1.0ex}{% -\normalfont\normalsize\bfseries\SS@subparafont% + \normalfont\normalsize\bfseries\SS@subparafont% }% } \makeatother @@ -107,9 +108,12 @@ \newcommand{\clearemptydoublepage}{% \newpage{\pagestyle{empty}\cleardoublepage}% } -\n -%===== C O N T E N T S =====\n + + +%===== C O N T E N T S ===== + \begin{document} + % Titlepage & ToC \hypersetup{pageanchor=false} \pagenumbering{roman} diff --git a/dox/resources/occt_ug_pdf.doxyfile b/dox/resources/occt_ug_pdf.doxyfile index 01f79dd138..b158bef3b1 100644 --- a/dox/resources/occt_ug_pdf.doxyfile +++ b/dox/resources/occt_ug_pdf.doxyfile @@ -41,7 +41,7 @@ GENERATE_TREEVIEW = NO PREDEFINED = PDF_ONLY GENERATE_LATEX = YES COMPACT_LATEX = YES -PDF_HYPERLINKS = NO +PDF_HYPERLINKS = YES USE_PDFLATEX = YES LATEX_BATCHMODE = YES LATEX_OUTPUT = latex diff --git a/dox/user_guides/draw_test_harness/draw_test_harness.md b/dox/user_guides/draw_test_harness/draw_test_harness.md index e6114a5c5e..37afc26001 100644 --- a/dox/user_guides/draw_test_harness/draw_test_harness.md +++ b/dox/user_guides/draw_test_harness/draw_test_harness.md @@ -391,7 +391,7 @@ puts ;negative; Syntax: -~~~~~~ +~~~~~ while condition script for init condition reinit script foreach varname list script -- 2.20.1