From 3c3cb777d6fa4a771ddcb5ad84008c97f33de190 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Wed, 3 Jun 2015 18:43:27 +0200 Subject: [PATCH] Missing bits from 07169c7b Sorry, was forgetting this. --- lib/scripts/legacy_lyxpreview2ppm.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/scripts/legacy_lyxpreview2ppm.py b/lib/scripts/legacy_lyxpreview2ppm.py index 63013dbe4c..ee49e6afa3 100644 --- a/lib/scripts/legacy_lyxpreview2ppm.py +++ b/lib/scripts/legacy_lyxpreview2ppm.py @@ -318,10 +318,13 @@ def legacy_conversion_step1(latex_file, dpi, output_format, fg_color, bg_color, def legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics, use_pdftocairo, conv, gs_device, gs_ext, alpha, resolution, output_format): + error_count = 0 + # Search for pdflatex executable pdflatex = find_exe(["pdflatex"]) if pdflatex == None: warning("Can't find pdflatex. Some pages failed with all the possible routes.") + failed_pages = [] else: # Create a new LaTeX file from the original but only with failed pages pdf_latex_file = latex_file_re.sub("_pdflatex.tex", latex_file) @@ -360,6 +363,7 @@ def legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics, if conv_status: # Give up! warning("Some pages failed with all the possible routes") + failed_pages = [] else: # We've done it! pdf_log_file = latex_file_re.sub(".log", pdf_latex_file) @@ -370,6 +374,7 @@ def legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics, for index in error_pages: pdf_metrics.pop(index - 1) pdf_metrics.insert(index - 1, (index, -1.0)) + error_count += 1 original_bitmap = latex_file_re.sub("%d." + output_format, pdf_latex_file) destination_bitmap = latex_file_re.sub("%d." + output_format, latex_file) @@ -378,6 +383,8 @@ def legacy_conversion_pdflatex(latex_file, failed_pages, legacy_metrics, join_metrics_and_rename(legacy_metrics, pdf_metrics, failed_pages, original_bitmap, destination_bitmap) + return error_count + # The file has been processed through latex and we expect dvi output. # Run dvips, taking note whether it was successful.