]> git.lyx.org Git - lyx.git/blobdiff - src/output_xhtml.cpp
Fix ChkTeX error reporting (#8639)
[lyx.git] / src / output_xhtml.cpp
index d03954461068cf2de2f4ad4655c9469b06ff2ad8..d3386ee1a55bb86b40bd1e2297d6839351448232 100644 (file)
@@ -71,7 +71,8 @@ docstring escapeChar(char_type c, XHTMLStream::EscapeSettings e)
 
 
 // escape what needs escaping
-docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e) {
+docstring htmlize(docstring const & str, XHTMLStream::EscapeSettings e)
+{
        odocstringstream d;
        docstring::const_iterator it = str.begin();
        docstring::const_iterator en = str.end();
@@ -109,7 +110,8 @@ string escapeChar(char c, XHTMLStream::EscapeSettings e)
 
 
 // escape what needs escaping
-string htmlize(string const & str, XHTMLStream::EscapeSettings e) {
+string htmlize(string const & str, XHTMLStream::EscapeSettings e)
+{
        ostringstream d;
        string::const_iterator it = str.begin();
        string::const_iterator en = str.end();
@@ -145,8 +147,9 @@ docstring cleanAttr(docstring const & str)
 
 bool isFontTag(string const & s)
 {
-       // others?
-       return s == "em" || s == "strong" || s == "i" || s == "b";
+       return s == "em" || s == "strong" || s == "i" || s == "b"
+           || s == "dfn" || s == "kbd" || s == "var" || s == "samp"
+           || s == "del" || s == "u";
 }
 
 
@@ -704,7 +707,8 @@ ParagraphList::const_iterator makeParagraphs(Buffer const & buf,
        for (; par != pend; ++par) {
                Layout const & lay = par->layout();
                if (!lay.counter.empty())
-                       buf.params().documentClass().counters().step(lay.counter, OutputUpdate);
+                       buf.masterBuffer()->params().
+                           documentClass().counters().step(lay.counter, OutputUpdate);
                // FIXME We should see if there's a label to be output and
                // do something with it.
                if (par != pbegin)
@@ -798,7 +802,7 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
                // FIXME There may be a bug here about user defined enumeration
                // types. If so, then we'll need to take the counter and add "i",
                // "ii", etc, as with enum.
-               Counters & cnts = buf.params().documentClass().counters();
+               Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
                docstring const & cntr = style.counter;
                if (!style.counter.empty() 
                    && (par == pbegin || !isNormalEnv(style)) 
@@ -915,19 +919,21 @@ ParagraphList::const_iterator makeEnvironmentHtml(Buffer const & buf,
 
 
 void makeCommand(Buffer const & buf,
-                                         XHTMLStream & xs,
-                                         OutputParams const & runparams,
-                                         Text const & text,
-                                         ParagraphList::const_iterator const & pbegin)
+                XHTMLStream & xs,
+                OutputParams const & runparams,
+                Text const & text,
+                ParagraphList::const_iterator const & pbegin)
 {
        Layout const & style = pbegin->layout();
        if (!style.counter.empty())
-               buf.params().documentClass().counters().step(style.counter, OutputUpdate);
+               buf.masterBuffer()->params().
+                   documentClass().counters().step(style.counter, OutputUpdate);
 
        openTag(xs, style, pbegin->params());
 
        // Label around sectioning number:
        // FIXME Probably need to account for LABEL_MANUAL
+       // FIXME Probably also need now to account for labels ABOVE and CENTERED.
        if (style.labeltype != LABEL_NO_LABEL) {
                openLabelTag(xs, style);
                xs << pbegin->params().labelString();
@@ -967,11 +973,15 @@ void xhtmlParagraphs(Text const & text,
        while (bpit < epit) {
                ParagraphList::const_iterator par = paragraphs.constIterator(bpit);
                if (par->params().startOfAppendix()) {
-                       // FIXME: only the counter corresponding to toplevel
-                       // sectioning should be reset
-                       Counters & cnts = buf.masterBuffer()->params().documentClass().counters();
-                       cnts.reset();
-                       cnts.appendix(true);
+                       // We want to reset the counter corresponding to toplevel sectioning
+                       Layout const & lay =
+                               buf.masterBuffer()->params().documentClass().getTOCLayout();
+                       docstring const cnt = lay.counter;
+                       if (!cnt.empty()) {
+                               Counters & cnts =
+                                       buf.masterBuffer()->params().documentClass().counters();
+                               cnts.reset(cnt);
+                       }
                }
                Layout const & style = par->layout();
                ParagraphList::const_iterator const lastpar = par;
@@ -1016,7 +1026,8 @@ void xhtmlParagraphs(Text const & text,
 }
 
 
-string alignmentToCSS(LyXAlignment align) {
+string alignmentToCSS(LyXAlignment align)
+{
        switch (align) {
        case LYX_ALIGN_BLOCK:
                // we are NOT going to use text-align: justify!!