commit fcc77d6b14c2b528b22510e53041f8e11db9a98b
Author: Juergen Spitzmueller <[email protected]>
Date: Mon Jul 14 18:41:12 2025 +0200
Disable view/export to PDF (over LaTeX) with unavailable classes (#7901)
---
src/Buffer.cpp | 3 ++-
src/BufferParams.cpp | 2 ++
src/Converter.cpp | 4 +++-
src/Converter.h | 2 +-
4 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/Buffer.cpp b/src/Buffer.cpp
index 89a02db449..f282e2331a 100644
--- a/src/Buffer.cpp
+++ b/src/Buffer.cpp
@@ -16,6 +16,7 @@
#include "Author.h"
#include "BiblioInfo.h"
#include "BranchList.h"
+#include "LayoutFile.h"
#include "buffer_funcs.h"
#include "BufferList.h"
#include "BufferParams.h"
@@ -4566,7 +4567,7 @@ Buffer::ExportStatus Buffer::doExport(string const &
target, bool put_in_tempdir
bool need_nice_file = false;
if (find(backs.begin(), backs.end(), format) == backs.end()) {
// Get the shortest path to format
- converters.buildGraph();
+
converters.buildGraph(!params().baseClass()->isTeXClassAvailable());
Graph::EdgePath path;
for (string const & sit : backs) {
Graph::EdgePath p = converters.getPath(sit, format);
diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp
index c5aaa27aee..74e41f60f1 100644
--- a/src/BufferParams.cpp
+++ b/src/BufferParams.cpp
@@ -3279,6 +3279,8 @@ FormatList const & BufferParams::exportableFormats(bool
only_viewable) const
excludes.insert("xetex");
}
+ // rebuild graph and consider non-available paths
+ theConverters().buildGraph(!baseClass()->isTeXClassAvailable());
FormatList result =
theConverters().getReachable(backs[0], only_viewable, true,
excludes);
vector<string>::const_iterator it = backs.begin() + 1;
diff --git a/src/Converter.cpp b/src/Converter.cpp
index f6cf42c4b9..de2f955aa8 100644
--- a/src/Converter.cpp
+++ b/src/Converter.cpp
@@ -967,7 +967,7 @@ Converters::RetVal Converters::runLaTeX(Buffer const &
buffer, string const & co
-void Converters::buildGraph()
+void Converters::buildGraph(bool notex)
{
// clear graph's data structures
G_.init(theFormats().size());
@@ -975,6 +975,8 @@ void Converters::buildGraph()
// so, for each of them, we create an arrow on the graph, going from
// the one to the other
for (auto const & cvt : converterlist_) {
+ if (notex && cvt.latex())
+ continue;
int const from = theFormats().getNumber(cvt.from());
int const to = theFormats().getNumber(cvt.to());
LASSERT(from >= 0, continue);
diff --git a/src/Converter.h b/src/Converter.h
index c1abe62fee..9d839a768d 100644
--- a/src/Converter.h
+++ b/src/Converter.h
@@ -213,7 +213,7 @@ public:
///
const_iterator end() const { return converterlist_.end(); }
///
- void buildGraph();
+ void buildGraph(bool notex = false);
/// Check whether converter conv is authorized to be run for elements
/// within document doc_fname.
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs