diff --git a/src/main/java/w2phtml/xhtml/XhtmlConfig.java b/src/main/java/w2phtml/xhtml/XhtmlConfig.java index 8f717b4..2ece164 100644 --- a/src/main/java/w2phtml/xhtml/XhtmlConfig.java +++ b/src/main/java/w2phtml/xhtml/XhtmlConfig.java @@ -209,7 +209,7 @@ public class XhtmlConfig extends w2phtml.base.ConfigBase { else { nValue = ABSOLUTE; } } }; - options[LIST_FORMATTING] = new IntegerOption("list_formatting","css1_hack") { + options[LIST_FORMATTING] = new IntegerOption("list_formatting","hard_labels") { @Override public void setString(String sValue) { super.setString(sValue); if ("css1_hack".equals(sValue)) { nValue = CSS1_HACK; } diff --git a/src/main/java/w2phtml/xhtml/content/ListParser.java b/src/main/java/w2phtml/xhtml/content/ListParser.java index b2c5d3b..350260e 100644 --- a/src/main/java/w2phtml/xhtml/content/ListParser.java +++ b/src/main/java/w2phtml/xhtml/content/ListParser.java @@ -63,8 +63,8 @@ public class ListParser extends Parser { } } - protected void insertListLabel(ListStyle style, int nLevel, String sDefaultStyle, String sPrefix, String sLabel, Element hnode) { - if (sLabel!=null && sLabel.length()>0) { + protected void insertListLabel(ListStyle style, String sDefaultStyle, String sPrefix, Element hnode) { + if (sCurrentListLabel!=null && sCurrentListLabel.length()>0) { if (sPrefix!=null) { Element prefix = converter.createElement("span"); prefix.setAttribute("class", "chapter-name"); @@ -73,7 +73,7 @@ public class ListParser extends Parser { } StyleInfo info = new StyleInfo(); if (style!=null) { - String sTextStyleName = style.getLevelProperty(nLevel,TEXT_STYLE_NAME); + String sTextStyleName = style.getLevelProperty(nCurrentListLevel,TEXT_STYLE_NAME); getTextSP().readStyle(sTextStyleName, info); } @@ -83,7 +83,8 @@ public class ListParser extends Parser { Element content = converter.createElement(info.sTagName); getTextSP().writeStyle(info, content); hnode.appendChild(content); - content.appendChild( converter.createTextNode(sLabel) ); + content.appendChild( converter.createTextNode(sCurrentListLabel) ); + sCurrentListLabel = ""; } } diff --git a/src/main/java/w2phtml/xhtml/content/TextParser.java b/src/main/java/w2phtml/xhtml/content/TextParser.java index 5cb75db..c5d8d74 100644 --- a/src/main/java/w2phtml/xhtml/content/TextParser.java +++ b/src/main/java/w2phtml/xhtml/content/TextParser.java @@ -74,9 +74,7 @@ public class TextParser extends Parser { Element[] currentHeading = new Element[7]; // Last headings (repeated when splitting) // Counters for generated numbers - private String sCurrentListLabel = null; private ListStyle currentListStyle = null; - private int nCurrentListLevel = 0; public Separator docSep = null; @@ -602,7 +600,7 @@ public class TextParser extends Parser { // Prepend numbering if (!bUnNumbered) { - getListParser().insertListLabel(listStyle, nListLevel, "SectionNumber", null, sLabel, heading); + getListParser().insertListLabel(listStyle, "SectionNumber", null, heading); } // Add to toc @@ -667,21 +665,18 @@ public class TextParser extends Parser { hnode.appendChild(temp.getFirstChild()); // Maybe add to toc - tocParser.handleParagraph((Element)onode, par, sCurrentListLabel); if (!isEmptyParagraph) { par = createTextBackground(par, styleName); if (config.listFormatting()==XhtmlConfig.HARD_LABELS) { - getListParser().insertListLabel(currentListStyle, nCurrentListLevel, "ItemNumber", null, sCurrentListLabel, par); + getListParser().insertListLabel(currentListStyle, "ItemNumber", null, par); } - sCurrentListLabel = null; traverseInlineText(onode,par); } else { // An empty paragraph (this includes paragraphs that only contains // whitespace) is ignored by the browser, hence we add   par.appendChild( converter.createTextNode("\u00A0") ); - sCurrentListLabel = null; } if (converter.isOPS() && !par.hasChildNodes()) {