bluecloth 2.0.6.pre120-x86-mswin32
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +363 -0
- data/LICENSE +27 -0
- data/LICENSE.discount +47 -0
- data/README +81 -0
- data/Rakefile +349 -0
- data/Rakefile.local +43 -0
- data/bin/bluecloth +84 -0
- data/ext/Csio.c +61 -0
- data/ext/VERSION +1 -0
- data/ext/amalloc.h +29 -0
- data/ext/bluecloth.c +391 -0
- data/ext/bluecloth.h +19 -0
- data/ext/config.h +55 -0
- data/ext/css.c +76 -0
- data/ext/cstring.h +75 -0
- data/ext/docheader.c +43 -0
- data/ext/extconf.rb +52 -0
- data/ext/generate.c +1602 -0
- data/ext/markdown.c +1078 -0
- data/ext/markdown.h +146 -0
- data/ext/mkdio.c +303 -0
- data/ext/mkdio.h +79 -0
- data/ext/resource.c +155 -0
- data/ext/version.c +28 -0
- data/ext/xml.c +82 -0
- data/ext/xmlpage.c +48 -0
- data/lib/1.8/bluecloth_ext.so +0 -0
- data/lib/1.9/bluecloth_ext.so +0 -0
- data/lib/bluecloth.rb +164 -0
- data/rake/191_compat.rb +26 -0
- data/rake/dependencies.rb +76 -0
- data/rake/helpers.rb +434 -0
- data/rake/hg.rb +273 -0
- data/rake/manual.rb +782 -0
- data/rake/packaging.rb +126 -0
- data/rake/publishing.rb +269 -0
- data/rake/rdoc.rb +30 -0
- data/rake/style.rb +62 -0
- data/rake/svn.rb +668 -0
- data/rake/testing.rb +187 -0
- data/rake/verifytask.rb +64 -0
- data/rake/win32.rb +190 -0
- data/spec/bluecloth/101_changes_spec.rb +141 -0
- data/spec/bluecloth/autolinks_spec.rb +49 -0
- data/spec/bluecloth/blockquotes_spec.rb +145 -0
- data/spec/bluecloth/code_spans_spec.rb +164 -0
- data/spec/bluecloth/emphasis_spec.rb +164 -0
- data/spec/bluecloth/entities_spec.rb +65 -0
- data/spec/bluecloth/hrules_spec.rb +90 -0
- data/spec/bluecloth/images_spec.rb +92 -0
- data/spec/bluecloth/inline_html_spec.rb +238 -0
- data/spec/bluecloth/links_spec.rb +171 -0
- data/spec/bluecloth/lists_spec.rb +294 -0
- data/spec/bluecloth/paragraphs_spec.rb +75 -0
- data/spec/bluecloth/titles_spec.rb +305 -0
- data/spec/bluecloth_spec.rb +281 -0
- data/spec/bugfix_spec.rb +172 -0
- data/spec/contributions_spec.rb +85 -0
- data/spec/data/antsugar.txt +34 -0
- data/spec/data/markdowntest/Amps and angle encoding.html +17 -0
- data/spec/data/markdowntest/Amps and angle encoding.text +21 -0
- data/spec/data/markdowntest/Auto links.html +18 -0
- data/spec/data/markdowntest/Auto links.text +13 -0
- data/spec/data/markdowntest/Backslash escapes.html +118 -0
- data/spec/data/markdowntest/Backslash escapes.text +120 -0
- data/spec/data/markdowntest/Blockquotes with code blocks.html +15 -0
- data/spec/data/markdowntest/Blockquotes with code blocks.text +11 -0
- data/spec/data/markdowntest/Code Blocks.html +18 -0
- data/spec/data/markdowntest/Code Blocks.text +14 -0
- data/spec/data/markdowntest/Code Spans.html +5 -0
- data/spec/data/markdowntest/Code Spans.text +5 -0
- data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.html +8 -0
- data/spec/data/markdowntest/Hard-wrapped paragraphs with list-like lines.text +8 -0
- data/spec/data/markdowntest/Horizontal rules.html +71 -0
- data/spec/data/markdowntest/Horizontal rules.text +67 -0
- data/spec/data/markdowntest/Inline HTML (Advanced).html +15 -0
- data/spec/data/markdowntest/Inline HTML (Advanced).text +15 -0
- data/spec/data/markdowntest/Inline HTML (Simple).html +72 -0
- data/spec/data/markdowntest/Inline HTML (Simple).text +69 -0
- data/spec/data/markdowntest/Inline HTML comments.html +13 -0
- data/spec/data/markdowntest/Inline HTML comments.text +13 -0
- data/spec/data/markdowntest/Links, inline style.html +11 -0
- data/spec/data/markdowntest/Links, inline style.text +12 -0
- data/spec/data/markdowntest/Links, reference style.html +52 -0
- data/spec/data/markdowntest/Links, reference style.text +71 -0
- data/spec/data/markdowntest/Links, shortcut references.html +9 -0
- data/spec/data/markdowntest/Links, shortcut references.text +20 -0
- data/spec/data/markdowntest/Literal quotes in titles.html +3 -0
- data/spec/data/markdowntest/Literal quotes in titles.text +7 -0
- data/spec/data/markdowntest/Markdown Documentation - Basics.html +314 -0
- data/spec/data/markdowntest/Markdown Documentation - Basics.text +306 -0
- data/spec/data/markdowntest/Markdown Documentation - Syntax.html +942 -0
- data/spec/data/markdowntest/Markdown Documentation - Syntax.text +888 -0
- data/spec/data/markdowntest/Nested blockquotes.html +9 -0
- data/spec/data/markdowntest/Nested blockquotes.text +5 -0
- data/spec/data/markdowntest/Ordered and unordered lists.html +148 -0
- data/spec/data/markdowntest/Ordered and unordered lists.text +131 -0
- data/spec/data/markdowntest/Strong and em together.html +7 -0
- data/spec/data/markdowntest/Strong and em together.text +7 -0
- data/spec/data/markdowntest/Tabs.html +25 -0
- data/spec/data/markdowntest/Tabs.text +21 -0
- data/spec/data/markdowntest/Tidyness.html +8 -0
- data/spec/data/markdowntest/Tidyness.text +5 -0
- data/spec/data/ml-announce.txt +17 -0
- data/spec/data/re-overflow.txt +67 -0
- data/spec/data/re-overflow2.txt +281 -0
- data/spec/discount_spec.rb +184 -0
- data/spec/lib/constants.rb +5 -0
- data/spec/lib/helpers.rb +137 -0
- data/spec/lib/matchers.rb +235 -0
- data/spec/markdowntest_spec.rb +79 -0
- metadata +205 -0
@@ -0,0 +1,65 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
require 'pathname'
|
6
|
+
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
+
|
8
|
+
libdir = basedir + 'lib'
|
9
|
+
extdir = basedir + 'ext'
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
|
+
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'spec'
|
16
|
+
require 'bluecloth'
|
17
|
+
|
18
|
+
require 'spec/lib/helpers'
|
19
|
+
require 'spec/lib/constants'
|
20
|
+
require 'spec/lib/matchers'
|
21
|
+
|
22
|
+
|
23
|
+
#####################################################################
|
24
|
+
### C O N T E X T S
|
25
|
+
#####################################################################
|
26
|
+
|
27
|
+
describe BlueCloth, "document with entities" do
|
28
|
+
include BlueCloth::TestConstants,
|
29
|
+
BlueCloth::Matchers
|
30
|
+
|
31
|
+
it "escapes special characters" do
|
32
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
33
|
+
The left shift operator, which is written as <<, is often used & greatly admired.
|
34
|
+
---
|
35
|
+
<p>The left shift operator, which is written as <<, is often used & greatly admired.</p>
|
36
|
+
---
|
37
|
+
end
|
38
|
+
|
39
|
+
it "preserves named entities" do
|
40
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
41
|
+
The left shift operator, which is written as <<, is often used & greatly admired.
|
42
|
+
---
|
43
|
+
<p>The left shift operator, which is written as <<, is often used & greatly admired.</p>
|
44
|
+
---
|
45
|
+
end
|
46
|
+
|
47
|
+
it "preserves decimal-encoded entities" do
|
48
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
49
|
+
The left shift operator, which is written as <<, is often used & greatly admired.
|
50
|
+
---
|
51
|
+
<p>The left shift operator, which is written as <<, is often used & greatly admired.</p>
|
52
|
+
---
|
53
|
+
end
|
54
|
+
|
55
|
+
it "preserves hex-encoded entities" do
|
56
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
57
|
+
The left shift operator, which is written as <<, is often used & greatly admired.
|
58
|
+
---
|
59
|
+
<p>The left shift operator, which is written as <<, is often used & greatly admired.</p>
|
60
|
+
---
|
61
|
+
end
|
62
|
+
|
63
|
+
end
|
64
|
+
|
65
|
+
|
@@ -0,0 +1,90 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
require 'pathname'
|
6
|
+
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
+
|
8
|
+
libdir = basedir + 'lib'
|
9
|
+
extdir = basedir + 'ext'
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
|
+
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'spec'
|
16
|
+
require 'bluecloth'
|
17
|
+
|
18
|
+
require 'spec/lib/helpers'
|
19
|
+
require 'spec/lib/constants'
|
20
|
+
require 'spec/lib/matchers'
|
21
|
+
|
22
|
+
|
23
|
+
#####################################################################
|
24
|
+
### C O N T E X T S
|
25
|
+
#####################################################################
|
26
|
+
|
27
|
+
describe BlueCloth, "horizontal rules" do
|
28
|
+
include BlueCloth::TestConstants,
|
29
|
+
BlueCloth::Matchers
|
30
|
+
|
31
|
+
# Hrule -- three asterisks
|
32
|
+
it "produces a horizontal rule tag from three asterisks on a line by themselves" do
|
33
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
34
|
+
***
|
35
|
+
---
|
36
|
+
<hr />
|
37
|
+
---
|
38
|
+
end
|
39
|
+
|
40
|
+
# Hrule -- three spaced-out asterisks
|
41
|
+
it "produces a horizontal rule tag from three asterisks with intervening spaces on a line " +
|
42
|
+
" by themselves" do
|
43
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
44
|
+
* * *
|
45
|
+
---
|
46
|
+
<hr />
|
47
|
+
---
|
48
|
+
end
|
49
|
+
|
50
|
+
# Indented Hrule -- three spaced-out asterisks
|
51
|
+
it "produces a horizontal rule tag from three asterisks with intervening spaces on a line " +
|
52
|
+
" by themselves, even if they're indented less than 4 spaces" do
|
53
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
54
|
+
* * *
|
55
|
+
---
|
56
|
+
<hr />
|
57
|
+
---
|
58
|
+
end
|
59
|
+
|
60
|
+
# Hrule -- more than three asterisks
|
61
|
+
it "produces a horizontal rule tag from more than three asterisks on a line by themselves" do
|
62
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
63
|
+
*****
|
64
|
+
---
|
65
|
+
<hr />
|
66
|
+
---
|
67
|
+
end
|
68
|
+
|
69
|
+
# Hrule -- a line of dashes
|
70
|
+
it "produces a horizontal rule tag from three dashes on a line by themselves" do
|
71
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
72
|
+
---------------------------------------
|
73
|
+
---
|
74
|
+
<hr />
|
75
|
+
---
|
76
|
+
end
|
77
|
+
|
78
|
+
# Hrule -- three spaced-out dashes
|
79
|
+
it "produces a horizontal rule tag from three dashes with intervening spaces on a line " +
|
80
|
+
" by themselves" do
|
81
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
82
|
+
- - -
|
83
|
+
---
|
84
|
+
<hr />
|
85
|
+
---
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
|
@@ -0,0 +1,92 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
require 'pathname'
|
6
|
+
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
+
|
8
|
+
libdir = basedir + 'lib'
|
9
|
+
extdir = basedir + 'ext'
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
|
+
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'spec'
|
16
|
+
require 'bluecloth'
|
17
|
+
|
18
|
+
require 'spec/lib/helpers'
|
19
|
+
require 'spec/lib/constants'
|
20
|
+
require 'spec/lib/matchers'
|
21
|
+
|
22
|
+
|
23
|
+
#####################################################################
|
24
|
+
### C O N T E X T S
|
25
|
+
#####################################################################
|
26
|
+
|
27
|
+
describe BlueCloth, "images" do
|
28
|
+
include BlueCloth::TestConstants,
|
29
|
+
BlueCloth::Matchers
|
30
|
+
|
31
|
+
### [Images]
|
32
|
+
|
33
|
+
# Inline image with title
|
34
|
+
it "transforms inline images with a title in double quotes to an IMG tag" do
|
35
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
36
|
+
![alt text](/path/img.jpg "Title")
|
37
|
+
---
|
38
|
+
<p><img src="/path/img.jpg" title="Title" alt="alt text" /></p>
|
39
|
+
---
|
40
|
+
end
|
41
|
+
|
42
|
+
# Inline image with title (single-quotes)
|
43
|
+
it "transforms inline images with a title in single quotes to an IMG tag" do
|
44
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
45
|
+
![alt text](/path/img.jpg 'Title')
|
46
|
+
---
|
47
|
+
<p><img src="/path/img.jpg" title="Title" alt="alt text" /></p>
|
48
|
+
---
|
49
|
+
end
|
50
|
+
|
51
|
+
# Inline image with title (with embedded quotes)
|
52
|
+
it "transforms inline images with a title that includes quotes to an IMG tag" do
|
53
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
54
|
+
![alt text](/path/img.jpg 'The "Title" Image')
|
55
|
+
---
|
56
|
+
<p><img src="/path/img.jpg" title="The "Title" Image" alt="alt text" /></p>
|
57
|
+
---
|
58
|
+
end
|
59
|
+
|
60
|
+
# Inline image without title
|
61
|
+
it "transforms inline images without a title to an IMG tag" do
|
62
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
63
|
+
![alt text](/path/img.jpg)
|
64
|
+
---
|
65
|
+
<p><img src="/path/img.jpg" alt="alt text" /></p>
|
66
|
+
---
|
67
|
+
end
|
68
|
+
|
69
|
+
# Inline image with quoted alt text
|
70
|
+
it "transforms inline images with quoted alt text to an IMG tag" do
|
71
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
72
|
+
![the "alt text"](/path/img.jpg)
|
73
|
+
---
|
74
|
+
<p><img src="/path/img.jpg" alt="the "alt text"" /></p>
|
75
|
+
---
|
76
|
+
end
|
77
|
+
|
78
|
+
|
79
|
+
# Reference image
|
80
|
+
it "transforms image references with a title to an IMG tag" do
|
81
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
82
|
+
![alt text][id]
|
83
|
+
|
84
|
+
[id]: /url/to/img.jpg "Title"
|
85
|
+
---
|
86
|
+
<p><img src="/url/to/img.jpg" title="Title" alt="alt text" /></p>
|
87
|
+
---
|
88
|
+
end
|
89
|
+
|
90
|
+
end
|
91
|
+
|
92
|
+
|
@@ -0,0 +1,238 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# encoding: utf-8
|
3
|
+
|
4
|
+
BEGIN {
|
5
|
+
require 'pathname'
|
6
|
+
basedir = Pathname.new( __FILE__ ).dirname.parent.parent
|
7
|
+
|
8
|
+
libdir = basedir + 'lib'
|
9
|
+
extdir = basedir + 'ext'
|
10
|
+
|
11
|
+
$LOAD_PATH.unshift( libdir ) unless $LOAD_PATH.include?( libdir )
|
12
|
+
$LOAD_PATH.unshift( extdir ) unless $LOAD_PATH.include?( extdir )
|
13
|
+
}
|
14
|
+
|
15
|
+
require 'spec'
|
16
|
+
require 'bluecloth'
|
17
|
+
|
18
|
+
require 'spec/lib/helpers'
|
19
|
+
require 'spec/lib/constants'
|
20
|
+
require 'spec/lib/matchers'
|
21
|
+
|
22
|
+
|
23
|
+
#####################################################################
|
24
|
+
### C O N T E X T S
|
25
|
+
#####################################################################
|
26
|
+
|
27
|
+
describe BlueCloth, "document with inline HTML" do
|
28
|
+
include BlueCloth::TestConstants,
|
29
|
+
BlueCloth::Matchers
|
30
|
+
|
31
|
+
it "preserves TABLE block" do
|
32
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
33
|
+
This is a regular paragraph.
|
34
|
+
|
35
|
+
<table>
|
36
|
+
<tr>
|
37
|
+
<td>Foo</td>
|
38
|
+
</tr>
|
39
|
+
</table>
|
40
|
+
|
41
|
+
This is another regular paragraph.
|
42
|
+
---
|
43
|
+
<p>This is a regular paragraph.</p>
|
44
|
+
|
45
|
+
<table>
|
46
|
+
<tr>
|
47
|
+
<td>Foo</td>
|
48
|
+
</tr>
|
49
|
+
</table>
|
50
|
+
|
51
|
+
<p>This is another regular paragraph.</p>
|
52
|
+
---
|
53
|
+
end
|
54
|
+
|
55
|
+
it "preserves DIV block" do
|
56
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
57
|
+
This is a regular paragraph.
|
58
|
+
|
59
|
+
<div>
|
60
|
+
Something
|
61
|
+
</div>
|
62
|
+
Something else.
|
63
|
+
---
|
64
|
+
<p>This is a regular paragraph.</p>
|
65
|
+
|
66
|
+
<div>
|
67
|
+
Something
|
68
|
+
</div>
|
69
|
+
|
70
|
+
<p>Something else.</p>
|
71
|
+
---
|
72
|
+
end
|
73
|
+
|
74
|
+
|
75
|
+
it "preserves HRs" do
|
76
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
77
|
+
This is a regular paragraph.
|
78
|
+
|
79
|
+
<hr />
|
80
|
+
|
81
|
+
Something else.
|
82
|
+
---
|
83
|
+
<p>This is a regular paragraph.</p>
|
84
|
+
|
85
|
+
<hr />
|
86
|
+
|
87
|
+
<p>Something else.</p>
|
88
|
+
---
|
89
|
+
end
|
90
|
+
|
91
|
+
|
92
|
+
it "preserves fancy HRs" do
|
93
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
94
|
+
This is a regular paragraph.
|
95
|
+
|
96
|
+
<hr class="publishers-mark" id="first-hrule" />
|
97
|
+
|
98
|
+
Something else.
|
99
|
+
---
|
100
|
+
<p>This is a regular paragraph.</p>
|
101
|
+
|
102
|
+
<hr class="publishers-mark" id="first-hrule" />
|
103
|
+
|
104
|
+
<p>Something else.</p>
|
105
|
+
---
|
106
|
+
end
|
107
|
+
|
108
|
+
|
109
|
+
it "preserves IFRAMEs" do
|
110
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
111
|
+
This is a regular paragraph.
|
112
|
+
|
113
|
+
<iframe src="foo.html" id="foo-frame"></iframe>
|
114
|
+
|
115
|
+
Something else.
|
116
|
+
---
|
117
|
+
<p>This is a regular paragraph.</p>
|
118
|
+
|
119
|
+
<iframe src="foo.html" id="foo-frame"></iframe>
|
120
|
+
|
121
|
+
<p>Something else.</p>
|
122
|
+
---
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
it "preserves MathML block" do
|
127
|
+
pending "discount doesn't support this, it explicitly matches block-level HTML elements only"
|
128
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
129
|
+
Examples
|
130
|
+
--------
|
131
|
+
|
132
|
+
Now that we have met some of the key players, it is time to see what we can
|
133
|
+
do. Here are some examples and comments which illustrate the use of the basic
|
134
|
+
layout and token elements. Consider the expression x2 + 4x + 4 = 0. A basic
|
135
|
+
MathML presentation encoding for this would be:
|
136
|
+
|
137
|
+
<math>
|
138
|
+
<mrow>
|
139
|
+
<msup>
|
140
|
+
<mi>x</mi>
|
141
|
+
<mn>2</mn>
|
142
|
+
</msup>
|
143
|
+
<mo>+</mo>
|
144
|
+
<mn>4</mn>
|
145
|
+
<mi>x</mi>
|
146
|
+
<mo>+</mo>
|
147
|
+
<mn>4</mn>
|
148
|
+
<mo>=</mo>
|
149
|
+
<mn>0</mn>
|
150
|
+
</mrow>
|
151
|
+
</math>
|
152
|
+
|
153
|
+
This encoding will display as you would expect. However, if we were interested
|
154
|
+
in reusing this expression in unknown situations, we would likely want to spend
|
155
|
+
a little more effort analyzing and encoding the logical expression structure.
|
156
|
+
---
|
157
|
+
<h2>Examples</h2>
|
158
|
+
|
159
|
+
<p>Now that we have met some of the key players, it is time to see what we can
|
160
|
+
do. Here are some examples and comments which illustrate the use of the basic
|
161
|
+
layout and token elements. Consider the expression x2 + 4x + 4 = 0. A basic
|
162
|
+
MathML presentation encoding for this would be:</p>
|
163
|
+
|
164
|
+
<math>
|
165
|
+
<mrow>
|
166
|
+
<msup>
|
167
|
+
<mi>x</mi>
|
168
|
+
<mn>2</mn>
|
169
|
+
</msup>
|
170
|
+
<mo>+</mo>
|
171
|
+
<mn>4</mn>
|
172
|
+
<mi>x</mi>
|
173
|
+
<mo>+</mo>
|
174
|
+
<mn>4</mn>
|
175
|
+
<mo>=</mo>
|
176
|
+
<mn>0</mn>
|
177
|
+
</mrow>
|
178
|
+
</math>
|
179
|
+
|
180
|
+
<p>This encoding will display as you would expect. However, if we were interested
|
181
|
+
in reusing this expression in unknown situations, we would likely want to spend
|
182
|
+
a little more effort analyzing and encoding the logical expression structure.</p>
|
183
|
+
---
|
184
|
+
end
|
185
|
+
|
186
|
+
|
187
|
+
it "preserves span-level HTML" do
|
188
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
189
|
+
This is some stuff with a <span class="foo">spanned bit of text</span> in
|
190
|
+
it. And <del>this *should* be a bit of deleted text</del> which should be
|
191
|
+
preserved, and part of it emphasized.
|
192
|
+
---
|
193
|
+
<p>This is some stuff with a <span class="foo">spanned bit of text</span> in
|
194
|
+
it. And <del>this <em>should</em> be a bit of deleted text</del> which should be
|
195
|
+
preserved, and part of it emphasized.</p>
|
196
|
+
---
|
197
|
+
end
|
198
|
+
|
199
|
+
it "preserves block-level HTML case-insensitively" do
|
200
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
201
|
+
This is a regular paragraph.
|
202
|
+
|
203
|
+
<TABLE>
|
204
|
+
<TR>
|
205
|
+
<TD>Foo</TD>
|
206
|
+
</TR>
|
207
|
+
</TABLE>
|
208
|
+
|
209
|
+
This is another regular paragraph.
|
210
|
+
---
|
211
|
+
<p>This is a regular paragraph.</p>
|
212
|
+
|
213
|
+
<TABLE>
|
214
|
+
<TR>
|
215
|
+
<TD>Foo</TD>
|
216
|
+
</TR>
|
217
|
+
</TABLE>
|
218
|
+
|
219
|
+
<p>This is another regular paragraph.</p>
|
220
|
+
---
|
221
|
+
end
|
222
|
+
|
223
|
+
it "preserves span-level HTML case-insensitively" do
|
224
|
+
the_indented_markdown( <<-"---" ).should be_transformed_into(<<-"---").without_indentation
|
225
|
+
This is some stuff with a <SPAN CLASS="foo">spanned bit of text</SPAN> in
|
226
|
+
it. And <DEL>this *should* be a bit of deleted text</DEL> which should be
|
227
|
+
preserved, and part of it emphasized.
|
228
|
+
---
|
229
|
+
<p>This is some stuff with a <SPAN CLASS="foo">spanned bit of text</SPAN> in
|
230
|
+
it. And <DEL>this <em>should</em> be a bit of deleted text</DEL> which should be
|
231
|
+
preserved, and part of it emphasized.</p>
|
232
|
+
---
|
233
|
+
end
|
234
|
+
|
235
|
+
|
236
|
+
end
|
237
|
+
|
238
|
+
|