public
Description: Markdown processing with Nu. Use with any Nu or Objective-C project. Created by Grayson Hansard.
Homepage: http://programming.nu/posts/2007/10/10/markdown-in-nu
Clone URL: git://github.com/timburks/numarkdown.git
Down to 8 MarkdownTest failures.

Made a minor change to remove trailing spaces in markdown_DoCodeSpans
and updated the MarkdownTests gold files using the latest Markdown.pl
release.
timburks (author)
Tue Nov 06 15:47:08 -0800 2007
commit  0a7d18e83f9d5c9427b0fad3264378fdc05e0221
tree    afbae596af109a9f8c83eb7b427e1e56b9ba30cd
parent  5887f29c9aaac22f29e7db90393ee40f4b3f5a1a
...
1
 
 
 
 
2
3
4
5
6
7
 
 
8
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
0
@@ -1,7 +1,13 @@
0
 
0
+
0
+(task "bin/nudown" is
0
+ (SH "gcc objc/nudown.m -o bin/nudown -framework Cocoa -framework Nu"))
0
+
0
 (task "test" is
0
       (SH "nutest test/test_markdown.nu"))
0
 
0
 (task "clean" is
0
       (SH "rm test/SimpleTests/*.html")
0
       (SH "rm test/MarkdownTests/*.html"))
0
+
0
+(task "default" => "bin/nudown")
0
\ No newline at end of file
...
246
247
248
249
 
 
 
250
251
252
...
529
530
531
532
533
534
535
536
 
 
 
 
 
 
537
538
539
...
246
247
248
 
249
250
251
252
253
254
...
531
532
533
 
 
 
 
 
534
535
536
537
538
539
540
541
542
0
@@ -246,7 +246,9 @@
0
     \1      # Matching closer
0
     (?!`)END -"sx") findAllInString:str) each:
0
       (do (m)
0
- (str replaceOccurrencesOfString:(m group) withString:-"<code>#{(markdown_EncodeCode ((m groupAtIndex:2) strip))}</code>")))
0
+ (set temp (/^[ \t]*/ replaceWithString:"" inString:(m groupAtIndex:2)))
0
+ (set temp (/[ \t]*$/ replaceWithString:"" inString:temp))
0
+ (str replaceOccurrencesOfString:(m group) withString:-"<code>#{(markdown_EncodeCode temp)}</code>")))
0
      str)
0
 
0
 (function markdown_EncodeItalicsAndBolds (str)
0
@@ -529,11 +531,12 @@
0
      )+
0
     )
0
     ((?=^[ ]{0,4}\S)|\Z)  # Lookahead for non-space at line-start, or end of doc
0
- END -"mx") findAllInString:str) each:(do (m)
0
- (set codeblock (m groupAtIndex:1))
0
- (set codeblock (markdown_Detab (markdown_EncodeCode (markdown_Outdent codeblock))))
0
- (set codeblock ((regex -"(\A\n+)|(\s+\z)") replaceWithString:-"" inString:codeblock))
0
- (str replaceOccurrencesOfString:(m group) withString:"\n<pre><code>#{codeblock}\n</code></pre>\n\n")))
0
+ END -"mx") findAllInString:str) each:
0
+ (do (m)
0
+ (set codeblock (m groupAtIndex:1))
0
+ (set codeblock (markdown_Detab (markdown_EncodeCode (markdown_Outdent codeblock))))
0
+ (set codeblock ((regex -"(\A\n+)|(\s+\z)") replaceWithString:-"" inString:codeblock))
0
+ (str replaceOccurrencesOfString:(m group) withString:"\n<pre><code>#{codeblock}\n</code></pre>\n\n")))
0
      str)
0
 
0
 (function markdown_DoBlockQuotes (str)
...
101
102
103
104
105
106
107
...
109
110
111
112
 
113
114
115
116
 
117
118
...
101
102
103
 
104
105
106
...
108
109
110
 
111
112
113
114
 
115
116
117
0
@@ -101,7 +101,6 @@ Minus: \-
0
 
0
 <p>Minus: <code>\-</code></p>
0
 
0
-
0
 <p>These should get escaped, even though they're matching pairs for
0
 other Markdown constructs:</p>
0
 
0
@@ -109,10 +108,10 @@ other Markdown constructs:</p>
0
 
0
 <p>_underscores_</p>
0
 
0
-<p>`backticks`</p>
0
+<p>\<code>backticks\</code></p>
0
 
0
 <p>This is a code span with a literal backslash-backtick sequence: <code>\`</code></p>
0
 
0
-<p>This is a tag with unescaped backticks <span attr='`ticks`'>bar</span>.</p>
0
+<p>This is a tag with unescaped backticks <span attr='<code>ticks</code>'>bar</span>.</p>
0
 
0
 <p>This is a tag with backslashes <span attr='\\backslashes\\'>bar</span>.</p>
...
9
10
11
12
 
13
14
15
...
9
10
11
 
12
13
14
15
0
@@ -9,7 +9,7 @@
0
 <p>Regular text.</p>
0
 
0
 <pre><code>the lines in this block
0
-all contain trailing spaces
0
+all contain trailing spaces
0
 </code></pre>
0
 
0
 <p>Regular Text.</p>
...
1
2
3
 
4
5
...
1
2
 
3
4
5
0
@@ -1,5 +1,5 @@
0
 <p><code>&lt;test a="</code> content of attribute <code>"&gt;</code></p>
0
 
0
-<p>Fix for backticks within HTML tag: <span attr='`ticks`'>like this</span></p>
0
+<p>Fix for backticks within HTML tag: <span attr='<code>ticks</code>'>like this</span></p>
0
 
0
 <p>Here's how you put <code>`backticks`</code> in a code span.</p>
...
12
13
14
15
 
16
17
 
18
19
20
...
12
13
14
 
15
16
 
17
18
19
20
0
@@ -12,9 +12,9 @@
0
 
0
 <p><img src="/url/" alt="alt text" title="with a title" />.</p>
0
 
0
-<p><img src="" alt="Empty" title="" /></p>
0
+<p>!<a href="">Empty</a></p>
0
 
0
-<p><img src="http://example.com/(parens).jpg" alt="this is a stupid URL" title="" /></p>
0
+<p><img src="http://example.com/(parens" alt="this is a stupid URL" title="" />.jpg)</p>
0
 
0
 <p><img src="/url/" alt="alt text" /></p>
0
 
...
2
3
4
5
 
6
7
8
9
10
11
 
12
13
 
14
15
16
...
27
28
29
30
 
 
...
2
3
4
 
5
6
7
8
9
10
11
12
13
14
15
16
17
18
...
29
30
31
 
32
33
0
@@ -2,15 +2,17 @@
0
 
0
 <div>foo</div>
0
 
0
-<p>And nested without indentation:</p>
0
+And nested without indentation:
0
 
0
 <div>
0
 <div>
0
 <div>
0
 foo
0
 </div>
0
+
0
 <div style=">"/>
0
 </div>
0
+
0
 <div>bar</div>
0
 </div>
0
 
0
@@ -27,4 +29,5 @@ foo
0
 <div class="toggleableend">
0
 foo
0
 </div>
0
-</div>
0
+
0
+<p></div></p>
...
6
7
8
9
 
10
11
12
...
14
15
16
17
 
18
19
 
20
21
 
22
23
 
...
6
7
8
 
9
10
11
12
...
14
15
16
 
17
18
 
19
20
 
21
22
 
23
0
@@ -6,7 +6,7 @@
0
 
0
 <p><a href="/url/" title="title preceded by a tab">URL and title</a>.</p>
0
 
0
-<p><a href="/url/" title="title has spaces afterward">URL and title</a>.</p>
0
+<p><a href="/url/ "title has spaces afterward"">URL and title</a>.</p>
0
 
0
 <p><a href="/url/">URL wrapped in angle brackets</a>.</p>
0
 
0
@@ -14,10 +14,10 @@
0
 
0
 <p><a href="">Empty</a>.</p>
0
 
0
-<p><a href="http://en.wikipedia.org/wiki/WIMP_(computing)">With parens in the URL</a></p>
0
+<p><a href="http://en.wikipedia.org/wiki/WIMP_(computing">With parens in the URL</a>)</p>
0
 
0
-<p>(With outer parens and <a href="/foo(bar)">parens in url</a>)</p>
0
+<p>(With outer parens and <a href="/foo(bar">parens in url</a>))</p>
0
 
0
-<p><a href="/foo(bar)" title="and a title">With parens in the URL</a></p>
0
+<p><a href="/foo(bar">With parens in the URL</a> "and a title")</p>
0
 
0
-<p>(With outer parens and <a href="/foo(bar)" title="and a title">parens in url</a>)</p>
0
+<p>(With outer parens and <a href="/foo(bar">parens in url</a> "and a title"))</p>
...
27
28
29
30
 
31
32
33
...
37
38
39
40
 
41
42
43
...
45
46
47
48
49
 
 
50
51
52
 
 
...
27
28
29
 
30
31
32
33
...
37
38
39
 
40
41
42
43
...
45
46
47
 
 
48
49
50
 
 
51
52
0
@@ -27,7 +27,7 @@
0
 
0
 <p>And <a href="foo">this</a>.</p>
0
 
0
-<p>And <a href="foo">this</a>.</p>
0
+<p>And [this].</p>
0
 
0
 <p>But not [that] [].</p>
0
 
0
@@ -37,7 +37,7 @@
0
 
0
 <p>[Something in brackets like <a href="foo">this</a> should work]</p>
0
 
0
-<p>[Same with <a href="foo">this</a>.]</p>
0
+<p>[Same with [this].]</p>
0
 
0
 <p>In this case, <a href="/somethingelse/">this</a> points to something else.</p>
0
 
0
@@ -45,8 +45,8 @@
0
 
0
 <hr />
0
 
0
-<p>Here's one where the <a href="/url/">link
0
-breaks</a> across lines.</p>
0
+<p>Here's one where the [link
0
+breaks] across lines.</p>
0
 
0
-<p>Here's another where the <a href="/url/">link
0
-breaks</a> across lines, but with a line-ending space.</p>
0
+<p>Here's another where the [link
0
+breaks] across lines, but with a line-ending space.</p>
...
1
 
2
3
4
 
 
5
6
7
 
 
8
9
 
...
 
1
2
 
 
3
4
5
 
 
6
7
8
 
9
0
@@ -1,9 +1,9 @@
0
-<p>This is the <a href="/simple">simple case</a>.</p>
0
+<p>This is the [simple case].</p>
0
 
0
-<p>This one has a <a href="/foo">line
0
-break</a>.</p>
0
+<p>This one has a [line
0
+break].</p>
0
 
0
-<p>This one has a <a href="/foo">line
0
-break</a> with a line-ending space.</p>
0
+<p>This one has a [line
0
+break] with a line-ending space.</p>
0
 
0
-<p><a href="/that">this</a> and the <a href="/other">other</a></p>
0
+<p><a href="/that">this</a> and the [other]</p>
...
136
137
138
139
140
141
142
143
144
145
146
147
 
 
148
 
 
 
...
136
137
138
 
139
140
141
142
143
 
 
 
144
145
146
147
148
149
0
@@ -136,13 +136,14 @@ back.</p></li>
0
 <li><p>Third</p></li>
0
 </ol>
0
 
0
-
0
 <p>This was an error in Markdown 1.0.1:</p>
0
 
0
 <ul>
0
 <li><p>this</p>
0
 
0
-<ul><li>sub</li></ul>
0
-
0
-<p>that</p></li>
0
+<ul>
0
+<li>sub</li>
0
 </ul>
0
+
0
+<p><p>that</p></li>
0
+</ul></p>
...
1
2
3
4
5
6
7
 
 
 
 
 
 
 
8
...
1
 
 
 
 
 
 
2
3
4
5
6
7
8
9
0
@@ -1,8 +1,9 @@
0
 <blockquote>
0
-<p>A list within a blockquote:</p>
0
-<ul>
0
-<li>asterisk 1</li>
0
-<li>asterisk 2</li>
0
-<li>asterisk 3</li>
0
-</ul>
0
+ <p>A list within a blockquote:</p>
0
+
0
+ <ul>
0
+ <li>asterisk 1</li>
0
+ <li>asterisk 2</li>
0
+ <li>asterisk 3</li>
0
+ </ul>
0
 </blockquote>

Comments

    No one has commented yet.