commit 00da07e6ce667080257af1173e7ee92080c36e86
Author: Juergen Spitzmueller <[email protected]>
Date: Sun Aug 10 11:39:15 2025 +0200
tex2lyx: correct default backref value
This is none, not section. The latter is only the default for
a valueless option "backref"
---
src/tex2lyx/Preamble.cpp | 14 +++++++++-----
src/tex2lyx/test/DummyDocument.lyx.lyx | 2 +-
src/tex2lyx/test/Dummy~Document.lyx.lyx | 2 +-
src/tex2lyx/test/test-insets-basic.lyx.lyx | 14 +-------------
src/tex2lyx/test/test-insets.lyx.lyx | 14 +-------------
5 files changed, 13 insertions(+), 33 deletions(-)
diff --git a/src/tex2lyx/Preamble.cpp b/src/tex2lyx/Preamble.cpp
index 7f446bd75f..88475a5c83 100644
--- a/src/tex2lyx/Preamble.cpp
+++ b/src/tex2lyx/Preamble.cpp
@@ -446,13 +446,17 @@ vector<string> split_options(string const & input)
* \p options and return the value.
* The found option is also removed from \p options.
*/
-string process_keyval_opt(vector<string> & options, string const & name)
+string process_keyval_opt(vector<string> & options, string const & name,
+ string const defval = string())
{
for (size_t i = 0; i < options.size(); ++i) {
vector<string> option;
+ if (!contains(options[i], "=")) {
+ // No value given. Return default.
+ options.erase(options.begin() + i);
+ return defval;
+ }
split(options[i], option, '=');
- if (option.size() < 2)
- continue;
if (option[0] == name) {
options.erase(options.begin() + i);
option.erase(option.begin());
@@ -1019,7 +1023,7 @@ Preamble::Preamble() : one_language(true),
explicit_babel(false),
h_pdf_breaklinks = "0";
h_pdf_pdfborder = "0";
h_pdf_colorlinks = "0";
- h_pdf_backref = "section";
+ h_pdf_backref = "false";
h_pdf_pdfusetitle = "0";
//h_pdf_pagemode;
//h_pdf_quoted_options;
@@ -1107,7 +1111,7 @@ void Preamble::handle_hyperref(vector<string> & options)
h_pdf_pdfborder = "1";
else if (pdfborder == "{0 0 1}")
h_pdf_pdfborder = "0";
- string backref = process_keyval_opt(options, "backref");
+ string backref = process_keyval_opt(options, "backref", "section");
if (!backref.empty())
h_pdf_backref = backref;
string colorlinks = process_keyval_opt(options, "colorlinks");
diff --git a/src/tex2lyx/test/DummyDocument.lyx.lyx
b/src/tex2lyx/test/DummyDocument.lyx.lyx
index 96e7b0afc0..4413a9b56d 100644
--- a/src/tex2lyx/test/DummyDocument.lyx.lyx
+++ b/src/tex2lyx/test/DummyDocument.lyx.lyx
@@ -40,7 +40,7 @@
\pdf_breaklinks 0
\pdf_pdfborder 0
\pdf_colorlinks 0
-\pdf_backref section
+\pdf_backref false
\pdf_pdfusetitle 0
\papersize a4
\use_geometry false
diff --git a/src/tex2lyx/test/Dummy~Document.lyx.lyx
b/src/tex2lyx/test/Dummy~Document.lyx.lyx
index abe0f32e77..ab57ee8703 100644
--- a/src/tex2lyx/test/Dummy~Document.lyx.lyx
+++ b/src/tex2lyx/test/Dummy~Document.lyx.lyx
@@ -40,7 +40,7 @@
\pdf_breaklinks 0
\pdf_pdfborder 0
\pdf_colorlinks 0
-\pdf_backref section
+\pdf_backref false
\pdf_pdfusetitle 0
\papersize a4
\use_geometry false
diff --git a/src/tex2lyx/test/test-insets-basic.lyx.lyx
b/src/tex2lyx/test/test-insets-basic.lyx.lyx
index 97185ebd40..07eb5a4849 100644
--- a/src/tex2lyx/test/test-insets-basic.lyx.lyx
+++ b/src/tex2lyx/test/test-insets-basic.lyx.lyx
@@ -76,7 +76,7 @@
\pdf_breaklinks 0
\pdf_pdfborder 0
\pdf_colorlinks 0
-\pdf_backref section
+\pdf_backref false
\pdf_pdfusetitle 0
\papersize a4
\use_geometry false
@@ -6899,18 +6899,6 @@ addcontentsline:
\end_layout
\begin_layout Standard
-
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-\backslash
-bibliographystyle{test}
-\end_layout
-
-\end_inset
-
\begin_inset ERT
status collapsed
diff --git a/src/tex2lyx/test/test-insets.lyx.lyx
b/src/tex2lyx/test/test-insets.lyx.lyx
index 8e06724057..6f134b7821 100644
--- a/src/tex2lyx/test/test-insets.lyx.lyx
+++ b/src/tex2lyx/test/test-insets.lyx.lyx
@@ -52,7 +52,7 @@
\pdf_breaklinks 0
\pdf_pdfborder 0
\pdf_colorlinks 0
-\pdf_backref section
+\pdf_backref false
\pdf_pdfusetitle 0
\papersize a4
\use_geometry false
@@ -7397,18 +7397,6 @@ addcontentsline:
\end_layout
\begin_layout Standard
-
-\begin_inset ERT
-status collapsed
-
-\begin_layout Plain Layout
-
-\backslash
-bibliographystyle{test}
-\end_layout
-
-\end_inset
-
\begin_inset ERT
status collapsed
--
lyx-cvs mailing list
[email protected]
https://lists.lyx.org/mailman/listinfo/lyx-cvs