Index: jrst2/src/java/org/codelutin/jrst/JRSTReader.java diff -u jrst2/src/java/org/codelutin/jrst/JRSTReader.java:1.14 jrst2/src/java/org/codelutin/jrst/JRSTReader.java:1.15 --- jrst2/src/java/org/codelutin/jrst/JRSTReader.java:1.14 Wed Apr 25 13:29:17 2007 +++ jrst2/src/java/org/codelutin/jrst/JRSTReader.java Thu Apr 26 10:22:20 2007 @@ -23,9 +23,9 @@ * Created: 27 oct. 06 00:15:34 * * @author poussin - * @version $Revision: 1.14 $ + * @version $Revision: 1.15 $ * - * Last update: $Date: 2007/04/25 13:29:17 $ + * Last update: $Date: 2007/04/26 10:22:20 $ * by : $Author: sletellier $ */ @@ -279,6 +279,7 @@ * @author poussin, letellier */ public class JRSTReader { + /** to use log facility, just put in your code: log.info(\"...\"); */ static private Log log = LogFactory.getLog(JRSTReader.class); @@ -634,15 +635,12 @@ List option = (List)item.selectNodes("option"); for (Element e : option){ Element eOption = optionGroup.addElement(OPTION); - eOption.addElement("option_string").setText(e.attributeValue("option_string")); + eOption.addElement(OPTION_STRING).setText(e.attributeValue(OPTION_STRING)); if (e.attributeValue("delimiterExiste").equals("true")){ - eOption.addElement("option_argument").addAttribute("delimiter", e.attributeValue("delimiter")).setText(e.attributeValue("option_argument")); + eOption.addElement(OPTION_ARGUMENT).addAttribute("delimiter", e.attributeValue("delimiter")).setText(e.attributeValue(OPTION_ARGUMENT)); } } - JRSTReader reader = new JRSTReader(); - String text = item.getText(); - Document doc = reader.read(new StringReader(text)); - optionListItem.addElement("description").appendContent(doc.getRootElement()); + optionListItem.addElement(DESCRIPTION).addAttribute("inline", "true").setText(item.getText()); item = lexer.peekOption(); } return result; @@ -656,17 +654,9 @@ private Element composeTopic(Element item) throws Exception { Element result = null; result=DocumentHelper.createElement(TOPIC); - Element title = result.addElement("title"); - JRSTReader reader = new JRSTReader(); - String text = item.attributeValue("title"); - Document doc = reader.read(new StringReader(text)); - title.appendContent(doc.getRootElement()); - reader = new JRSTReader(); - text = item.getText(); - doc = reader.read(new StringReader(text)); - result.appendContent(doc.getRootElement()); - - return result; + result.addElement(TITLE).addAttribute("inline", "true").setText(item.attributeValue(TITLE)); + result.addElement(PARAGRAPH).addAttribute("inline", "true").setText(item.getText()); + return result; } /** * @param Element item @@ -677,21 +667,12 @@ private Element composeSidebar(Element item) throws Exception { Element result = null; result=DocumentHelper.createElement(SIDEBAR); - Element title = result.addElement("title"); + result.addElement(TITLE).addAttribute("inline", "true").setText(item.attributeValue(TITLE)); + if (item.attributeValue("subExiste").equals("true")) + result.addElement(SUBTITLE).addAttribute("inline", "true").setText(item.attributeValue(SUBTITLE)); JRSTReader reader = new JRSTReader(); - String text = item.attributeValue("title"); + String text = item.getText(); Document doc = reader.read(new StringReader(text)); - title.appendContent(doc.getRootElement()); - if (item.attributeValue("subExiste").equals("true")){ - Element subtitle = result.addElement("title"); - reader = new JRSTReader(); - text = item.attributeValue("subtitle"); - doc = reader.read(new StringReader(text)); - subtitle.appendContent(doc.getRootElement()); - } - reader = new JRSTReader(); - text = item.getText(); - doc = reader.read(new StringReader(text)); result.appendContent(doc.getRootElement()); return result; @@ -718,13 +699,8 @@ for (int i=0;i()"; static final public String DOCINFO_ITEM = "author|authors|organization|address|contact|version|revision|status|date|copyright"; @@ -355,6 +355,9 @@ result = peekTopic(); } if (result == null) { + result = peekRemove(); + } + if (result == null) { result = peekDirectiveOrReference(); } if (result == null) { @@ -391,9 +394,6 @@ result = peekBlockQuote(); } if (result == null) { - result = peekRemove(); - } - if (result == null) { result = peekPara(); } @@ -526,7 +526,7 @@ matcher.find(); result = DocumentHelper.createElement(TOPIC).addAttribute("level", ""+level(line)); String title = line.substring(matcher.end(),line.length()); - result.addAttribute("title",title); + result.addAttribute(TITLE,title); line = in.readLine(); String txt = joinBlock(readBlock(level(line))); result.setText(txt); @@ -559,7 +559,7 @@ matcher.find(); result = DocumentHelper.createElement(SIDEBAR).addAttribute("level", ""+level(line)); String title = line.substring(matcher.end(),line.length()); - result.addAttribute("title",title); + result.addAttribute(TITLE,title); line = in.readLine(); if (line.matches("^\\s+:subtitle:\\s*(.*)$*")){ matcher = Pattern.compile(":subtitle:\\s*").matcher(line); @@ -1741,7 +1741,7 @@ return result; } /** - * @param title_char + * @param title_charescapeRegex * @return String */ private String escapeRegex(String text) {