Index: JRSTLexer.java =================================================================== --- JRSTLexer.java (revision 545) +++ JRSTLexer.java (working copy) @@ -39,6 +39,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; +import static org.nuiton.jrst.ReStructuredText.BLOCK_QUOTE; + /** * Le principe est de positionner la mark du {@link AdvancedReader} lors du * debut d'une methode peek*, puis a la fin de la methode de regarder le nombre @@ -135,7 +137,7 @@ public static final String LINE = "line"; - public static final String BLOCK_QUOTE = "block_quote"; + //public static final String BLOCK_QUOTE = "block_quote"; public static final String ATTRIBUTION = "attribution"; @@ -943,20 +945,21 @@ Element result = null; String line = in.readLine(); if (line != null) { - if (line.matches("\\s*")) { + if (line.matches("\\s.*")) { + String savedLine = line; line = in.readLine(); + if (line != null) { int level = level(line); String blockQuote = null; - if (!(level == 0)) { + if (level != 0) { String txt = line; String[] lines = in.readWhile("(^ {" + level - + "}.*)|(\\s*)"); + + "}.*)|(\\s*)"); for (String l : lines) { if (l.matches("^ {" + level + "}--\\s*.*")) { blockQuote = l; - blockQuote = blockQuote.replaceAll("--", "") - .trim(); + blockQuote = blockQuote.replaceAll("--", "").trim(); } else { txt += "\n" + l; } @@ -966,7 +969,7 @@ if (blockQuote != null) { result.addAttribute(ATTRIBUTION, blockQuote); } - result.setText(txt); + result.setText(savedLine + txt); } } } @@ -2360,7 +2363,8 @@ */ private int level(String line) { int result = 0; - while (line.length() > result && line.charAt(result) == ' ') { + String sTmp = line.replaceAll("\\s", " "); + while (sTmp.length() > result && sTmp.charAt(result) == ' ') { result++; } return result;