From 6127141d4b0e93575ae7de527a951791e01b9201 Mon Sep 17 00:00:00 2001 From: Richard Heck Date: Tue, 15 Feb 2011 17:44:17 +0000 Subject: [PATCH] Introduce BufferParam to control whether CSS is output in the header of the XHTML file or to a separate style file. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@37682 a592a061-630c-0410-9148-cb99ea01b6c8 --- lib/lyx2lyx/lyx_2_0.py | 10 ++++++++-- src/Buffer.cpp | 2 +- src/BufferParams.cpp | 10 +++++++--- src/BufferParams.h | 2 ++ 4 files changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/lyx2lyx/lyx_2_0.py b/lib/lyx2lyx/lyx_2_0.py index 24ba92f421..7d1b1a7c4c 100644 --- a/lib/lyx2lyx/lyx_2_0.py +++ b/lib/lyx2lyx/lyx_2_0.py @@ -2456,6 +2456,10 @@ def revert_tabularwidth(document): if document.body[features].find('alignment="tabularwidth"') != -1: remove_option(document.body, features, 'tabularwidth') +def revert_html_css_as_file(document): + if not del_token(document.header, '\\html_css_as_file', 0): + document.warning("Malformed LyX document: Missing \\html_css_as_file.") + ## # Conversion hub @@ -2528,10 +2532,12 @@ convert = [[346, []], [409, [convert_use_xetex]], [410, []], [411, [convert_langpack]], - [412, []] + [412, []], + [413, []], ] -revert = [[411, [revert_tabularwidth]], +revert = [[412, [revert_html_css_as_file]], + [411, [revert_tabularwidth]], [410, [revert_langpack]], [409, [revert_labeling]], [408, [revert_use_xetex]], diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 6ed365c894..37be152281 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -127,7 +127,7 @@ namespace { // Do not remove the comment below, so we get merge conflict in // independent branches. Instead add your own. -int const LYX_FORMAT = 412; // edwin: set tabular width +int const LYX_FORMAT = 413; // rgh: html_css_as_file typedef map DepClean; typedef map > RefCache; diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index 21b8237fd2..165b920bda 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -414,6 +414,7 @@ BufferParams::BufferParams() html_be_strict = false; html_math_output = MathML; html_math_img_scale = 1.0; + html_css_as_file = false; output_sync = false; use_refstyle = true; @@ -850,6 +851,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, html_math_output = static_cast(temp); } else if (token == "\\html_be_strict") { lex >> html_be_strict; + } else if (token == "\\html_css_as_file") { + lex >> html_css_as_file; } else if (token == "\\html_math_img_scale") { lex >> html_math_img_scale; } else if (token == "\\html_latex_start") { @@ -1088,9 +1091,10 @@ void BufferParams::writeFile(ostream & os) const } os << "\\tracking_changes " << convert(trackChanges) << '\n' - << "\\output_changes " << convert(outputChanges) << '\n' - << "\\html_math_output " << html_math_output << '\n' - << "\\html_be_strict " << convert(html_be_strict) << '\n'; + << "\\output_changes " << convert(outputChanges) << '\n' + << "\\html_math_output " << html_math_output << '\n' + << "\\html_css_as_file" << html_css_as_file << '\n' + << "\\html_be_strict " << convert(html_be_strict) << '\n'; if (html_math_img_scale != 1.0) os << "\\html_math_img_scale " << convert(html_math_img_scale) << '\n'; diff --git a/src/BufferParams.h b/src/BufferParams.h index 16ff23a76a..ee2b22a248 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -405,6 +405,8 @@ public: std::string html_latex_start; /// std::string html_latex_end; + /// + bool html_css_as_file; /// generate output usable for reverse/forward search bool output_sync; /// custom LaTeX macro from user instead our own -- 2.39.2