From e08ff546e52e0a351dca025abfd1592ecd85fd4e Mon Sep 17 00:00:00 2001 From: Rene' Jeschke Date: Sat, 16 Apr 2011 17:56:01 +0200 Subject: [PATCH] Improved README, bugfix for link name parsing. --- README.md | 15 ++++++----- src/java/txtmark/Emitter.java | 2 +- src/java/txtmark/Utils.java | 47 +++++++++++++++-------------------- 3 files changed, 28 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9eab794..5005b45 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ TODO: *** -Based on [MarkdownTest_1.0_2007-05-09](http://daringfireball.net/projects/downloads/MarkdownTest_1.0_2007-05-09.tgz) +Based on [MarkdownTest\_1.0\_2007-05-09](http://daringfireball.net/projects/downloads/MarkdownTest_1.0_2007-05-09.tgz) * Amps and angle encoding ... OK * Auto links ... OK @@ -38,15 +38,14 @@ Based on [MarkdownTest_1.0_2007-05-09](http://daringfireball.net/projects/downlo * Links, shortcut references ... OK * Literal quotes in titles ... FAILED (see [Note 3](#note2)) * Markdown Documentation - Basics ... OK -* Markdown Documentation - Syntax ... OK +* Markdown Documentation - Syntax ... FAILED (see [Note 2](#note1)) * Nested blockquotes ... OK * Ordered and unordered lists ... OK * Strong and em together ... OK * Tabs ... OK * Tidyness ... OK -18 passed; 5 failed. -Benchmark: 2 wallclock secs ( 0.02 usr 0.01 sys + 1.85 cusr 0.74 csys = 2.62 CPU) +17 passed; 6 failed. *** @@ -59,8 +58,8 @@ Benchmark: 2 wallclock secs ( 0.02 usr 0.01 sys + 1.85 cusr 0.74 csys = 2.6 3.

Note:

What the frell ... this test will continue to FAIL. - Sorry, but using unescaped '"' in a link, which should be surrounded - by '"' is unacceptable for me ;) + Sorry, but using unescaped `"` in a title which should be surrounded + by `"` is unacceptable for me ;) Change: @@ -82,7 +81,7 @@ Benchmark: 2 wallclock secs ( 0.02 usr 0.01 sys + 1.85 cusr 0.74 csys = 2.6 Based on [this](http://henkelmann.eu/2011/01/10/performance_comparison_of_markdown_processor_for_the_jvm). Txtmark's results should not be considered final, they may change in either direction during the upcoming releases. -But I think you get the point. +But I think you get the point. @@ -220,7 +219,7 @@ But I think you get the point. [Knockoff]: http://tristanhunt.com/projects/knockoff/ [PegDown] is copyright (c) 2010 by Mathias Doenitz [PegDown]: https://github.com/sirthias/pegdown - + *** Project link: diff --git a/src/java/txtmark/Emitter.java b/src/java/txtmark/Emitter.java index dac75a2..2851920 100644 --- a/src/java/txtmark/Emitter.java +++ b/src/java/txtmark/Emitter.java @@ -237,7 +237,7 @@ class Emitter { pos++; temp.setLength(0); - pos = Utils.readUntil(temp, in, pos, ']'); + pos = Utils.readRawUntil(temp, in, pos, ']'); if(pos < start) return -1; final String id = temp.length() > 0 ? temp.toString() : name; diff --git a/src/java/txtmark/Utils.java b/src/java/txtmark/Utils.java index 4aed448..4144fc4 100644 --- a/src/java/txtmark/Utils.java +++ b/src/java/txtmark/Utils.java @@ -210,36 +210,29 @@ class Utils while(pos < in.length()) { final char ch = in.charAt(pos); - if(ch == '\\' && pos + 1 < in.length()) + boolean endReached = false; + switch(ch) { - pos = escape(out, in.charAt(pos + 1), pos); - } - else - { - boolean endReached = false; - switch(ch) - { - case '\n': - out.append(' '); - break; - case '[': - counter++; + case '\n': + out.append(' '); + break; + case '[': + counter++; + out.append(ch); + break; + case ']': + counter--; + if(counter == 0) + endReached = true; + else out.append(ch); - break; - case ']': - counter--; - if(counter == 0) - endReached = true; - else - out.append(ch); - break; - default: - out.append(ch); - break; - } - if(endReached) - break; + break; + default: + out.append(ch); + break; } + if(endReached) + break; pos++; }