Index: jrst2/src/java/org/codelutin/jrst/directive/SectnumDirective.java diff -u jrst2/src/java/org/codelutin/jrst/directive/SectnumDirective.java:1.1 jrst2/src/java/org/codelutin/jrst/directive/SectnumDirective.java:1.2 --- jrst2/src/java/org/codelutin/jrst/directive/SectnumDirective.java:1.1 Tue May 15 10:46:49 2007 +++ jrst2/src/java/org/codelutin/jrst/directive/SectnumDirective.java Tue Jul 29 07:59:52 2008 @@ -7,7 +7,9 @@ public class SectnumDirective implements JRSTDirective { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.codelutin.jrst.JRSTDirective#parse(org.dom4j.Element) */ public Node parse(Element e) { Index: jrst2/src/java/org/codelutin/jrst/directive/ImageDirective.java diff -u jrst2/src/java/org/codelutin/jrst/directive/ImageDirective.java:1.2 jrst2/src/java/org/codelutin/jrst/directive/ImageDirective.java:1.3 --- jrst2/src/java/org/codelutin/jrst/directive/ImageDirective.java:1.2 Fri Dec 29 17:59:33 2006 +++ jrst2/src/java/org/codelutin/jrst/directive/ImageDirective.java Tue Jul 29 07:59:52 2008 @@ -23,52 +23,51 @@ * Created: 4 nov. 06 12:52:02 * * @author poussin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Last update: $Date: 2006-12-29 17:59:33 $ - * by : $Author: bpoussin $ + * Last update: $Date: 2008-07-29 07:59:52 $ + * by : $Author: chatellier $ */ package org.codelutin.jrst.directive; +import static org.codelutin.jrst.ReStructuredText.IMAGE; +import static org.codelutin.jrst.ReStructuredText.SUBSTITUTION_DEFINITION; + import java.util.regex.Matcher; import java.util.regex.Pattern; import org.codelutin.jrst.JRSTDirective; import org.codelutin.jrst.JRSTLexer; - -import static org.codelutin.jrst.ReStructuredText.*; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Node; - /** - * .. image:: picture.jpeg - * :height: 100 - * :width: 200 - * :scale: 50 - * :alt: alternate text - * :align: right - * + * .. image:: picture.jpeg :height: 100 :width: 200 :scale: 50 :alt: alternate + * text :align: right + * * @author poussin */ public class ImageDirective implements JRSTDirective { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.codelutin.jrst.JRSTDirective#parse(org.dom4j.Element) */ public Node parse(Element e) { Element result = DocumentHelper.createElement(IMAGE); - - if (e.getParent() != null && SUBSTITUTION_DEFINITION.equals(e.getParent().getName())) { + + if (e.getParent() != null + && SUBSTITUTION_DEFINITION.equals(e.getParent().getName())) { String ref = e.getParent().attributeValue("name"); result.addAttribute("alt", ref); } result.addAttribute("uri", e.attributeValue(JRSTLexer.DIRECTIVE_VALUE)); - + Pattern arg = Pattern.compile("\\s+:([^:]+):\\s*(.*)"); - String [] lines = e.getText().split("\n"); + String[] lines = e.getText().split("\n"); for (String l : lines) { Matcher matcher = arg.matcher(l.trim()); if (matcher.matches()) { @@ -81,5 +80,3 @@ } } - - Index: jrst2/src/java/org/codelutin/jrst/directive/DateDirective.java diff -u jrst2/src/java/org/codelutin/jrst/directive/DateDirective.java:1.2 jrst2/src/java/org/codelutin/jrst/directive/DateDirective.java:1.3 --- jrst2/src/java/org/codelutin/jrst/directive/DateDirective.java:1.2 Thu May 10 10:18:41 2007 +++ jrst2/src/java/org/codelutin/jrst/directive/DateDirective.java Tue Jul 29 07:59:52 2008 @@ -23,47 +23,46 @@ * Created: 4 nov. 06 13:29:25 * * @author poussin - * @version $Revision: 1.2 $ + * @version $Revision: 1.3 $ * - * Last update: $Date: 2007-05-10 10:18:41 $ - * by : $Author: sletellier $ + * Last update: $Date: 2008-07-29 07:59:52 $ + * by : $Author: chatellier $ */ package org.codelutin.jrst.directive; import java.text.SimpleDateFormat; import java.util.Date; + import org.codelutin.jrst.JRSTDirective; import org.dom4j.DocumentHelper; import org.dom4j.Element; import org.dom4j.Node; import org.dom4j.Text; - /** - * .. date:: - * .. time:: + * .. date:: .. time:: * * @author poussin - * + * */ public class DateDirective implements JRSTDirective { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.codelutin.jrst.JRSTDirective#parse(org.dom4j.Element) */ public Node parse(Element e) { - - //String format = e.attributeValue(JRSTLexer.DIRECTIVE_VALUE); - + + // String format = e.attributeValue(JRSTLexer.DIRECTIVE_VALUE); + // TODO used format to format date, this format is not Java standard // is python standard "%Y-%m-%d" - - Text result = DocumentHelper.createText( - SimpleDateFormat.getInstance().format(new Date())); + + Text result = DocumentHelper.createText(SimpleDateFormat.getInstance() + .format(new Date())); return result; } } - - Index: jrst2/src/java/org/codelutin/jrst/directive/ContentDirective.java diff -u jrst2/src/java/org/codelutin/jrst/directive/ContentDirective.java:1.1 jrst2/src/java/org/codelutin/jrst/directive/ContentDirective.java:1.2 --- jrst2/src/java/org/codelutin/jrst/directive/ContentDirective.java:1.1 Thu May 10 10:18:41 2007 +++ jrst2/src/java/org/codelutin/jrst/directive/ContentDirective.java Tue Jul 29 07:59:52 2008 @@ -7,11 +7,14 @@ public class ContentDirective implements JRSTDirective { - /* (non-Javadoc) + /* + * (non-Javadoc) + * * @see org.codelutin.jrst.JRSTDirective#parse(org.dom4j.Element) */ public Node parse(Element e) { - Element result = DocumentHelper.createElement("topic").addAttribute("value",e.attributeValue("value")); + Element result = DocumentHelper.createElement("topic").addAttribute( + "value", e.attributeValue("value")); result.addAttribute("type", "contents"); result.setText(e.getText()); return result;