The branch, xhtml/new_features/assets-separate-directory, has been updated.

- Log -----------------------------------------------------------------

commit df9fd151a4f24995e6696c9b6787d1f9696d4d25
Author: Josh Hieronymus <[email protected]>
Date:   Tue Jul 30 15:29:22 2013 -0400

    Save math images to proper directory

diff --git a/src/mathed/InsetMathHull.cpp b/src/mathed/InsetMathHull.cpp
index d03eca9..f5c05a6 100644
--- a/src/mathed/InsetMathHull.cpp
+++ b/src/mathed/InsetMathHull.cpp
@@ -2190,25 +2190,36 @@ docstring InsetMathHull::xhtml(XHTMLStream & xs, 
OutputParams const & op) const
                if (pimage || op.dryrun) {
                        string const filename = pimage ? 
pimage->filename().onlyFileName()
                                                       : "previewimage.png";
+                       Buffer const * mbuf = buffer().masterBuffer();
+
                        if (pimage) {
                                // if we are not in the master buffer, then we 
need to see that the
                                // generated image is copied there; otherwise, 
preview fails.
-                               Buffer const * mbuf = buffer().masterBuffer();
                                if (mbuf != &buffer()) {
                                        string mbtmp = mbuf->temppath();
                                        FileName const 
mbufimg(support::addName(mbtmp, filename));
                                        pimage->filename().copyTo(mbufimg);
                                }
                                // add the file to the list of files to be 
exported
-                               op.exportdata->addExternalFile("xhtml", 
pimage->filename());
+                               if 
(mbuf->params().html_assets_in_separate_directory) {
+                                       op.exportdata->addExternalFile("xhtml", 
pimage->filename(), "images/" + filename);
+                               } else {
+                                       op.exportdata->addExternalFile("xhtml", 
pimage->filename());
+                               }
                        }
 
                        string const tag = (getType() == hullSimple) ? "span" : 
"div";
+                       string src_attribute;
+                       if (mbuf->params().html_assets_in_separate_directory) {
+                               src_attribute = "src=\"images/";
+                       } else {
+                               src_attribute = "src=\"";
+                       }
                        xs << html::CR()
                           << html::StartTag(tag)
-                                << html::CompTag("img", "src=\"" + filename + 
"\" alt=\"Mathematical Equation\"")
-                                << html::EndTag(tag)
-                                << html::CR();
+                          << html::CompTag("img", src_attribute + filename + 
"\" alt=\"Mathematical Equation\"")
+                          << html::EndTag(tag)
+                          << html::CR();
                        success = true;
                }
        }

-----------------------------------------------------------------------

Summary of changes:
 src/mathed/InsetMathHull.cpp |   21 ++++++++++++++++-----
 1 files changed, 16 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
Repositories for GSOC work

Reply via email to