Markdown: remove automatic smart quotes
Remove the "smart quote" support that handles ', ", -- and ---.
In technical docs this makes it harder to copy flags from text.
Bug: issue 77
Change-Id: I1aef26534195b019c3f84d02c23889c758c85986
diff --git a/Documentation/markdown.md b/Documentation/markdown.md
index 652d5ed..3e0f392 100644
--- a/Documentation/markdown.md
+++ b/Documentation/markdown.md
@@ -187,13 +187,6 @@
Note two tildes are required (`~~`) on either side of the struck out
section of text.
-### Smart quotes
-
-'Single' and "double" quotes in paragraph text are
-replaced with smart quotes. Apostrophes (this doc's text), ellipses
-("...") and dashes ("--" and "---") are also replaced with HTML
-entities to make the documentation appear typeset.
-
### Blockquotes
Blockquoted text can be used to stand off text obtained from
diff --git a/gitiles-servlet/src/main/java/com/google/gitiles/doc/MarkdownToHtml.java b/gitiles-servlet/src/main/java/com/google/gitiles/doc/MarkdownToHtml.java
index 7a116c1..2dcebdd 100644
--- a/gitiles-servlet/src/main/java/com/google/gitiles/doc/MarkdownToHtml.java
+++ b/gitiles-servlet/src/main/java/com/google/gitiles/doc/MarkdownToHtml.java
@@ -61,8 +61,6 @@
import org.eclipse.jgit.revwalk.RevTree;
import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
import javax.annotation.Nullable;
@@ -457,37 +455,9 @@
}
}
- private static final Pattern PRETTY = Pattern.compile("('|[.]{3}|-{2,3})");
-
@Override
public void visit(Text node) {
- String text = node.getLiteral();
- Matcher pretty = PRETTY.matcher(text);
- int i = 0;
- while (pretty.find()) {
- int s = pretty.start();
- if (i < s) {
- html.appendAndEscape(text.substring(i, s));
- }
- switch (pretty.group(0)) {
- case "'":
- html.entity("’");
- break;
- case "...":
- html.entity("…");
- break;
- case "--":
- html.entity("–");
- break;
- case "---":
- html.entity("—");
- break;
- }
- i = pretty.end();
- }
- if (i < text.length()) {
- html.appendAndEscape(text.substring(i));
- }
+ html.appendAndEscape(node.getLiteral());
}
@Override