Chromium Code Reviews| Index: editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/dartdoc/DartDocUtilities.java |
| diff --git a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/dartdoc/DartDocUtilities.java b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/dartdoc/DartDocUtilities.java |
| index d537c61d1b9b9424469e94669238eae2e334bcc5..101f231aa6372575eee95df7b9d907b5e91d767a 100644 |
| --- a/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/dartdoc/DartDocUtilities.java |
| +++ b/editor/tools/plugins/com.google.dart.tools.core/src/com/google/dart/tools/core/utilities/dartdoc/DartDocUtilities.java |
| @@ -39,6 +39,8 @@ import com.google.dart.engine.utilities.dart.ParameterKind; |
| import com.google.dart.engine.utilities.source.SourceRange; |
| import com.google.dart.tools.core.DartCore; |
| +import org.apache.commons.lang3.StringUtils; |
| + |
| import java.io.BufferedReader; |
| import java.io.IOException; |
| import java.io.StringReader; |
| @@ -476,16 +478,31 @@ public final class DartDocUtilities { |
| // handle too much whitespace in front of list items |
| str = str.replace("<br>\n<li>", "<li>"); |
| - // convert code and reference blocks |
| - str = str.replace("[:", "<code>").replace(":]", "</code>"); |
| - str = str.replace("[", "<code>").replace("]", "</code>"); |
| - str = replacePairs(str, "`", "<code>", "</code>"); |
| - |
| - // convert bold and italic |
| - str = replacePairs(str, "**", "<b>", "</b>"); |
| - str = replacePairs(str, "__", "<b>", "</b>"); |
| - str = replacePairs(str, "*", "<i>", "</i>"); |
| - str = replacePairs(str, "_", "<i>", "</i>"); |
| + // process non-code lines |
| + { |
| + String[] lines = StringUtils.splitPreserveAllTokens(str, "\n"); |
| + StringBuilder sb = new StringBuilder(); |
| + for (String line : lines) { |
| + if (line.startsWith(" ") || line.startsWith("<pre> ")) { |
|
Brian Wilkerson
2014/05/06 21:50:51
The tag "<pre>" normally delineates a block. Do we
scheglov
2014/05/06 23:42:57
AFAIK <pre> is not a part of a normal markdown.
|
| + // ignore code lines |
| + } else { |
| + // convert code and reference blocks |
| + line = line.replace("[:", "<code>").replace(":]", "</code>"); |
| + line = line.replace("[", "<code>").replace("]", "</code>"); |
| + line = replacePairs(line, "`", "<code>", "</code>"); |
| + |
| + // convert bold and italic |
| + line = replacePairs(line, "**", "<b>", "</b>"); |
| + line = replacePairs(line, "__", "<b>", "</b>"); |
| + line = replacePairs(line, "*", "<i>", "</i>"); |
| + line = replacePairs(line, "_", "<i>", "</i>"); |
| + } |
| + sb.append(line); |
| + sb.append("\n"); |
| + } |
| + str = sb.toString(); |
| + str = str.substring(0, str.length() - 1); |
| + } |
| return str; |
| } |