lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] gwc-no-xslfo aec2811 12/12: Enable old and new PDF i


From: Greg Chicares
Subject: [lmi-commits] [lmi] gwc-no-xslfo aec2811 12/12: Enable old and new PDF implementations to coexist
Date: Sat, 27 Jan 2018 04:23:34 -0500 (EST)

branch: gwc-no-xslfo
commit aec28110bec274233151840ca2ef494a51a4ed84
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Enable old and new PDF implementations to coexist
    
    Eventually the old implementation will be retired, and only the new
    will survive. However, during a testing interregnum, the old remains
    the production default, and the new is available only with the most
    powerful password.
---
 ledger_pdf.cpp | 12 ++++++++++++
 ledger_xsl.cpp |  4 +++-
 ledger_xsl.hpp |  2 +-
 3 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/ledger_pdf.cpp b/ledger_pdf.cpp
index 48b2a75..64e575f 100644
--- a/ledger_pdf.cpp
+++ b/ledger_pdf.cpp
@@ -24,17 +24,29 @@
 #include "ledger_pdf.hpp"
 
 #include "configurable_settings.hpp"
+#include "global_settings.hpp" // PDF !! expunge
 #include "ledger.hpp"
 #include "ledger_pdf_generator.hpp"
+#include "ledger_xsl.hpp" // PDF !! expunge
 #include "path_utility.hpp"
 
 /// Write ledger as pdf.
 
 std::string write_ledger_as_pdf(Ledger const& ledger, fs::path const& filepath)
 {
+    // PDF !! Expunge this conditional block:
+    if(global_settings::instance().ash_nazg())
+        {
+        // Execute both the new and the old code so that their results
+        // may be compared.
+        write_ledger_as_pdf_via_xsl(ledger, filepath);
+        }
+
     throw_if_interdicted(ledger);
 
     fs::path print_dir(configurable_settings::instance().print_directory());
+    // PDF !! Either orthodox_filename() should be used here, or its
+    // use should be reconsidered everywhere else.
     fs::path pdf_out_file = unique_filepath(print_dir / filepath, ".pdf");
 
     auto const pdf = ledger_pdf_generator::create();
diff --git a/ledger_xsl.cpp b/ledger_xsl.cpp
index 7743940..ee008c4 100644
--- a/ledger_xsl.cpp
+++ b/ledger_xsl.cpp
@@ -94,11 +94,13 @@ fs::path xsl_filepath(Ledger const& ledger)
 /// filenames must be transformed is that apache fop is java, and
 /// java is "portable".
 
-std::string write_ledger_as_pdf(Ledger const& ledger, fs::path const& filepath)
+std::string write_ledger_as_pdf_via_xsl(Ledger const& ledger, fs::path const& 
filepath)
 {
     throw_if_interdicted(ledger);
 
     fs::path print_dir(configurable_settings::instance().print_directory());
+    // Old implementation: write to a distinctive subdirectory.
+    print_dir = print_dir / "old";
 
     fs::path real_filepath(orthodox_filename(filepath.leaf()));
     LMI_ASSERT(fs::portable_name(real_filepath.string()));
diff --git a/ledger_xsl.hpp b/ledger_xsl.hpp
index 31b30a4..22aee10 100644
--- a/ledger_xsl.hpp
+++ b/ledger_xsl.hpp
@@ -30,7 +30,7 @@
 
 class Ledger;
 
-std::string write_ledger_as_pdf(Ledger const&, fs::path const&);
+std::string write_ledger_as_pdf_via_xsl(Ledger const&, fs::path const&);
 
 fs::path xsl_filepath(Ledger const&);
 



reply via email to

[Prev in Thread] Current Thread [Next in Thread]