commit ab3a49973f8f948884186f13fe8fd07ecd453198
Author: Richard Heck <rgh...@lyx.org>
Date:   Sun Jul 31 01:47:30 2016 -0400

    Fix display of code listings in XHTML.
    
    Fixes bug #8362.
---
 lib/layouts/stdinsets.inc    |   13 +++++++++++++
 src/insets/InsetListings.cpp |    5 +++--
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/lib/layouts/stdinsets.inc b/lib/layouts/stdinsets.inc
index e6a4641..3a4e0cb 100644
--- a/lib/layouts/stdinsets.inc
+++ b/lib/layouts/stdinsets.inc
@@ -313,6 +313,19 @@ InsetLayout Listings
        ForceLTR              true
        RefPrefix             lst
        HTMLTag               pre
+       HTMLStyle
+               div.float-listings {
+                       border: 2px solid black;
+                       padding: 1ex;
+                       margin: 1ex;
+               }
+               div.listings-caption {
+                       text-align: center;
+                       border: 2px solid black;
+                       padding: 1ex;
+                       margin: 1ex;
+       }
+       EndHTMLStyle
 End
 
 InsetLayout Branch
diff --git a/src/insets/InsetListings.cpp b/src/insets/InsetListings.cpp
index 1afa0f3..8d9a67b 100644
--- a/src/insets/InsetListings.cpp
+++ b/src/insets/InsetListings.cpp
@@ -273,10 +273,10 @@ docstring InsetListings::xhtml(XHTMLStream & os, 
OutputParams const & rp) const
        if (isInline)
                out << html::CompTag("br");
        else {
-               out << html::StartTag("div", "class='float float-listings'");
+               out << html::StartTag("div", "class='float-listings'");
                docstring caption = getCaptionHTML(rp);
                if (!caption.empty())
-                       out << html::StartTag("div", "class='float-caption'")
+                       out << html::StartTag("div", "class='listings-caption'")
                            << XHTMLStream::ESCAPE_NONE
                            << caption << html::EndTag("div");
        }
@@ -372,6 +372,7 @@ docstring const InsetListings::buttonLabel(BufferView const 
& bv) const
 void InsetListings::validate(LaTeXFeatures & features) const
 {
        features.require("listings");
+       features.useInsetLayout(getLayout());
        string param_string = params().params();
        if (param_string.find("\\color") != string::npos)
                features.require("color");

Reply via email to