The branch, xhtml/new_features/css-separate-directory, has been updated. - Log -----------------------------------------------------------------
commit f8351cfbaa7775525d43d2526260e5fbebfc0ef0 Author: Josh Hieronymus <[email protected]> Date: Fri Jul 26 20:44:28 2013 -0400 Add option to write CSS file to "styles" directory diff --git a/src/Buffer.cpp b/src/Buffer.cpp index 85ab3b5..9fd7862 100644 --- a/src/Buffer.cpp +++ b/src/Buffer.cpp @@ -1914,7 +1914,7 @@ void Buffer::writeLyXHTMLSource(odocstream & os, docstring const dstyles = css.str(); if (!dstyles.empty()) { bool written = false; - if (params().html_css_as_file) { + if (params().html_css_as_file || params().html_css_in_separate_directory) { // open a file for CSS info ofdocstream ocss; string const fcssname = addName(temppath(), "docstyle.css"); @@ -1923,11 +1923,18 @@ void Buffer::writeLyXHTMLSource(odocstream & os, ocss << dstyles; ocss.close(); written = true; - // write link to header - os << "<link rel='stylesheet' href='styles/docstyle.css' type='text/css' />\n"; - // register file - string const fcssfileinstylesdir = filePath() + "styles/docstyle.css"; - runparams.exportdata->addExternalFile("xhtml", fcssfile, fcssfileinstylesdir); + if (params().html_css_as_file) { + // write link to header + os << "<link rel='stylesheet' href='docstyle.css' type='text/css' />\n"; + // register file + runparams.exportdata->addExternalFile("xhtml", fcssfile); + } else { + // write link to header + os << "<link rel='stylesheet' href='styles/docstyle.css' type='text/css' />\n"; + // register file + string const fcssfileinstylesdir = filePath() + "styles/docstyle.css"; + runparams.exportdata->addExternalFile("xhtml", fcssfile, fcssfileinstylesdir); + } } } // we are here if the CSS is supposed to be written to the header diff --git a/src/BufferParams.cpp b/src/BufferParams.cpp index c98e1f9..eae06a4 100644 --- a/src/BufferParams.cpp +++ b/src/BufferParams.cpp @@ -415,6 +415,7 @@ BufferParams::BufferParams() html_math_output = MathML; html_math_img_scale = 1.0; html_css_as_file = false; + html_css_in_separate_directory = false; output_sync = false; use_refstyle = true; @@ -905,6 +906,8 @@ string BufferParams::readToken(Lexer & lex, string const & token, lex >> html_be_strict; } else if (token == "\\html_css_as_file") { lex >> html_css_as_file; + } else if (token == "\\html_css_in_separate_directory") { + lex >> html_css_in_separate_directory; } else if (token == "\\html_math_img_scale") { lex >> html_math_img_scale; } else if (token == "\\html_latex_start") { @@ -1174,6 +1177,7 @@ void BufferParams::writeFile(ostream & os) const << "\\output_changes " << convert<string>(outputChanges) << '\n' << "\\html_math_output " << html_math_output << '\n' << "\\html_css_as_file " << html_css_as_file << '\n' + << "\\html_css_in_separate_directory" << html_css_in_separate_directory << '\n' << "\\html_be_strict " << convert<string>(html_be_strict) << '\n'; if (html_math_img_scale != 1.0) diff --git a/src/BufferParams.h b/src/BufferParams.h index 9c558a6..213b8fa 100644 --- a/src/BufferParams.h +++ b/src/BufferParams.h @@ -470,6 +470,8 @@ public: std::string html_latex_end; /// bool html_css_as_file; + /// + bool html_css_in_separate_directory; /// generate output usable for reverse/forward search bool output_sync; /// custom LaTeX macro from user instead our own diff --git a/src/frontends/qt4/GuiDocument.cpp b/src/frontends/qt4/GuiDocument.cpp index 4fd3d53..2b90cf8 100644 --- a/src/frontends/qt4/GuiDocument.cpp +++ b/src/frontends/qt4/GuiDocument.cpp @@ -753,6 +753,8 @@ GuiDocument::GuiDocument(GuiView & lv) this, SLOT(change_adaptor())); connect(outputModule->cssCB, SIGNAL(stateChanged(int)), this, SLOT(change_adaptor())); + connect(outputModule->css_in_separate_directoryCB, SIGNAL(stateChanged(int)), + this, SLOT(change_adaptor())); connect(outputModule->mathoutCB, SIGNAL(currentIndexChanged(int)), this, SLOT(change_adaptor())); @@ -2786,6 +2788,7 @@ void GuiDocument::applyView() bp_.html_math_output = mo; bp_.html_be_strict = outputModule->strictCB->isChecked(); bp_.html_css_as_file = outputModule->cssCB->isChecked(); + bp_.html_css_in_separate_directory = outputModule->css_in_separate_directoryCB->isChecked(); bp_.html_math_img_scale = outputModule->mathimgSB->value(); // fonts @@ -3320,6 +3323,7 @@ void GuiDocument::paramsToDialog() outputModule->mathoutCB->setCurrentIndex(bp_.html_math_output); outputModule->strictCB->setChecked(bp_.html_be_strict); outputModule->cssCB->setChecked(bp_.html_css_as_file); + outputModule->css_in_separate_directoryCB->setChecked(bp_.html_css_in_separate_directory); // paper bool const extern_geometry = diff --git a/src/frontends/qt4/ui/OutputUi.ui b/src/frontends/qt4/ui/OutputUi.ui index 812d736..d29c524 100644 --- a/src/frontends/qt4/ui/OutputUi.ui +++ b/src/frontends/qt4/ui/OutputUi.ui @@ -126,7 +126,7 @@ </property> </widget> </item> - <item row="1" column="0"> + <item row="2" column="0"> <widget class="QLabel" name="mathoutLA"> <property name="font"> <font> @@ -142,7 +142,7 @@ </property> </widget> </item> - <item row="1" column="1"> + <item row="2" column="1"> <widget class="QComboBox" name="mathoutCB"> <property name="font"> <font> @@ -175,7 +175,7 @@ </item> </widget> </item> - <item row="2" column="0"> + <item row="3" column="0"> <widget class="QLabel" name="mathimgLA"> <property name="font"> <font> @@ -191,7 +191,7 @@ </property> </widget> </item> - <item row="2" column="1"> + <item row="3" column="1"> <widget class="QDoubleSpinBox" name="mathimgSB"> <property name="font"> <font> @@ -223,6 +223,16 @@ </property> </widget> </item> + <item row="1" column="1"> + <widget class="QCheckBox" name="css_in_separate_directoryCB"> + <property name="text"> + <string>Write CSS to Separate Directory</string> + </property> + <property name="checked"> + <bool>false</bool> + </property> + </widget> + </item> </layout> </widget> </item> ----------------------------------------------------------------------- Summary of changes: src/Buffer.cpp | 19 +++++++++++++------ src/BufferParams.cpp | 4 ++++ src/BufferParams.h | 2 ++ src/frontends/qt4/GuiDocument.cpp | 4 ++++ src/frontends/qt4/ui/OutputUi.ui | 18 ++++++++++++++---- 5 files changed, 37 insertions(+), 10 deletions(-) hooks/post-receive -- Repositories for GSOC work
