mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Report how many preview snippets fail.
Instead of warning about latex problems that, most probably, are worked around by the script, report how many preview snippets were not produced.
This commit is contained in:
parent
7cce590390
commit
07169c7be2
@ -305,7 +305,7 @@ def legacy_conversion_step1(latex_file, dpi, output_format, fg_color, bg_color,
|
||||
# Compile the latex file.
|
||||
latex_status, latex_stdout = run_latex(latex, latex_file)
|
||||
if latex_status:
|
||||
warning("trying to recover from failed compilation")
|
||||
progress("Will try to recover from %s failure" % latex)
|
||||
|
||||
if pdf_output:
|
||||
return legacy_conversion_step3(latex_file, dpi, output_format, True, skipMetrics)
|
||||
@ -516,9 +516,11 @@ def legacy_conversion_step3(latex_file, dpi, output_format, dvips_failed, skipMe
|
||||
# Pass failed pages to pdflatex
|
||||
if len(failed_pages) > 0:
|
||||
warning("Now trying to obtain failed previews through pdflatex")
|
||||
legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics,
|
||||
use_pdftocairo, conv, gs_device, gs_ext, alpha, resolution,
|
||||
output_format)
|
||||
error_count = legacy_conversion_pdflatex(latex_file, failed_pages,
|
||||
legacy_metrics, use_pdftocairo, conv, gs_device, gs_ext, alpha,
|
||||
resolution, output_format)
|
||||
else:
|
||||
error_count = 0
|
||||
|
||||
# Invalidate metrics for pages that produced errors
|
||||
if len(error_pages) > 0:
|
||||
@ -526,6 +528,7 @@ def legacy_conversion_step3(latex_file, dpi, output_format, dvips_failed, skipMe
|
||||
if index not in failed_pages:
|
||||
legacy_metrics.pop(index - 1)
|
||||
legacy_metrics.insert(index - 1, (index, -1.0))
|
||||
error_count += 1
|
||||
|
||||
# Crop the ppm images
|
||||
if pnmcrop != None and output_format == "ppm":
|
||||
@ -537,6 +540,8 @@ def legacy_conversion_step3(latex_file, dpi, output_format, dvips_failed, skipMe
|
||||
# Extract metrics info from the log file.
|
||||
metrics_file = latex_file_re.sub(".metrics", latex_file)
|
||||
write_metrics_info(legacy_metrics, metrics_file)
|
||||
if error_count:
|
||||
warning("Failed to produce %d preview snippet(s)" % error_count)
|
||||
|
||||
return (0, legacy_metrics)
|
||||
|
||||
|
@ -471,7 +471,7 @@ def main(argv):
|
||||
error_pages = []
|
||||
latex_status, latex_stdout = run_latex(latex, latex_file, bibtex)
|
||||
if latex_status:
|
||||
warning("trying to recover from failed compilation")
|
||||
progress("Will try to recover from %s failure" % latex)
|
||||
error_pages = check_latex_log(latex_file_re.sub(".log", latex_file))
|
||||
|
||||
# The dvi output file name
|
||||
@ -568,10 +568,14 @@ def main(argv):
|
||||
|
||||
# Invalidate metrics for pages that produced errors
|
||||
if len(error_pages) > 0:
|
||||
error_count = 0
|
||||
for index in error_pages:
|
||||
if index not in ps_pages and index not in pdf_pages:
|
||||
dvipng_metrics.pop(index - 1)
|
||||
dvipng_metrics.insert(index - 1, (index, -1.0))
|
||||
error_count += 1
|
||||
if error_count:
|
||||
warning("Failed to produce %d preview snippet(s)" % error_count)
|
||||
|
||||
# Convert images to ppm format if necessary.
|
||||
if output_format == "ppm":
|
||||
|
@ -348,7 +348,7 @@ def run_tex(tex, tex_file):
|
||||
|
||||
tex_status, tex_stdout = run_command(tex_call)
|
||||
if tex_status:
|
||||
warning("%s had problems compiling %s" \
|
||||
progress("Warning: %s had problems compiling %s" \
|
||||
% (os.path.basename(tex), tex_file))
|
||||
return tex_status, tex_stdout
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user