redcarpet 3.5.1 → 3.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +487 -0
- data/CONTRIBUTING.md +33 -0
- data/README.markdown +5 -5
- data/ext/redcarpet/html.c +18 -1
- data/ext/redcarpet/html_block_names.txt +44 -0
- data/ext/redcarpet/html_blocks.h +30 -35
- data/ext/redcarpet/markdown.c +51 -20
- data/ext/redcarpet/rc_markdown.c +16 -5
- data/ext/redcarpet/rc_render.c +55 -22
- data/ext/redcarpet/redcarpet.h +2 -0
- data/lib/redcarpet.rb +1 -1
- data/redcarpet.gemspec +9 -21
- metadata +14 -41
- data/test/benchmark.rb +0 -24
- data/test/custom_render_test.rb +0 -67
- data/test/fixtures/benchmark.md +0 -232
- data/test/html5_test.rb +0 -82
- data/test/html_render_test.rb +0 -274
- data/test/html_toc_render_test.rb +0 -112
- data/test/markdown_test.rb +0 -416
- data/test/pathological_inputs_test.rb +0 -34
- data/test/redcarpet_bin_test.rb +0 -80
- data/test/redcarpet_compat_test.rb +0 -38
- data/test/safe_render_test.rb +0 -35
- data/test/smarty_html_test.rb +0 -51
- data/test/smarty_pants_test.rb +0 -58
- data/test/stripdown_render_test.rb +0 -69
- data/test/test_helper.rb +0 -47
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redcarpet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Natacha Porté
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
@@ -17,42 +17,42 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - "~>"
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: '13'
|
21
21
|
type: :development
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - "~>"
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version:
|
27
|
+
version: '13'
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: rake-compiler
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - "~>"
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 1.
|
34
|
+
version: '1.1'
|
35
35
|
type: :development
|
36
36
|
prerelease: false
|
37
37
|
version_requirements: !ruby/object:Gem::Requirement
|
38
38
|
requirements:
|
39
39
|
- - "~>"
|
40
40
|
- !ruby/object:Gem::Version
|
41
|
-
version: 1.
|
41
|
+
version: '1.1'
|
42
42
|
- !ruby/object:Gem::Dependency
|
43
43
|
name: test-unit
|
44
44
|
requirement: !ruby/object:Gem::Requirement
|
45
45
|
requirements:
|
46
46
|
- - "~>"
|
47
47
|
- !ruby/object:Gem::Version
|
48
|
-
version: 3.
|
48
|
+
version: '3.5'
|
49
49
|
type: :development
|
50
50
|
prerelease: false
|
51
51
|
version_requirements: !ruby/object:Gem::Requirement
|
52
52
|
requirements:
|
53
53
|
- - "~>"
|
54
54
|
- !ruby/object:Gem::Version
|
55
|
-
version: 3.
|
55
|
+
version: '3.5'
|
56
56
|
description: A fast, safe and extensible Markdown to (X)HTML parser
|
57
57
|
email: vicent@github.com
|
58
58
|
executables:
|
@@ -62,6 +62,8 @@ extensions:
|
|
62
62
|
extra_rdoc_files:
|
63
63
|
- COPYING
|
64
64
|
files:
|
65
|
+
- CHANGELOG.md
|
66
|
+
- CONTRIBUTING.md
|
65
67
|
- COPYING
|
66
68
|
- Gemfile
|
67
69
|
- README.markdown
|
@@ -77,6 +79,7 @@ files:
|
|
77
79
|
- ext/redcarpet/houdini_html_e.c
|
78
80
|
- ext/redcarpet/html.c
|
79
81
|
- ext/redcarpet/html.h
|
82
|
+
- ext/redcarpet/html_block_names.txt
|
80
83
|
- ext/redcarpet/html_blocks.h
|
81
84
|
- ext/redcarpet/html_smartypants.c
|
82
85
|
- ext/redcarpet/markdown.c
|
@@ -92,22 +95,7 @@ files:
|
|
92
95
|
- lib/redcarpet/render_man.rb
|
93
96
|
- lib/redcarpet/render_strip.rb
|
94
97
|
- redcarpet.gemspec
|
95
|
-
|
96
|
-
- test/custom_render_test.rb
|
97
|
-
- test/fixtures/benchmark.md
|
98
|
-
- test/html5_test.rb
|
99
|
-
- test/html_render_test.rb
|
100
|
-
- test/html_toc_render_test.rb
|
101
|
-
- test/markdown_test.rb
|
102
|
-
- test/pathological_inputs_test.rb
|
103
|
-
- test/redcarpet_bin_test.rb
|
104
|
-
- test/redcarpet_compat_test.rb
|
105
|
-
- test/safe_render_test.rb
|
106
|
-
- test/smarty_html_test.rb
|
107
|
-
- test/smarty_pants_test.rb
|
108
|
-
- test/stripdown_render_test.rb
|
109
|
-
- test/test_helper.rb
|
110
|
-
homepage: http://github.com/vmg/redcarpet
|
98
|
+
homepage: https://github.com/vmg/redcarpet
|
111
99
|
licenses:
|
112
100
|
- MIT
|
113
101
|
metadata: {}
|
@@ -126,23 +114,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
114
|
- !ruby/object:Gem::Version
|
127
115
|
version: '0'
|
128
116
|
requirements: []
|
129
|
-
rubygems_version: 3.
|
117
|
+
rubygems_version: 3.5.23
|
130
118
|
signing_key:
|
131
119
|
specification_version: 4
|
132
120
|
summary: Markdown that smells nice
|
133
|
-
test_files:
|
134
|
-
- test/benchmark.rb
|
135
|
-
- test/custom_render_test.rb
|
136
|
-
- test/fixtures/benchmark.md
|
137
|
-
- test/html5_test.rb
|
138
|
-
- test/html_render_test.rb
|
139
|
-
- test/html_toc_render_test.rb
|
140
|
-
- test/markdown_test.rb
|
141
|
-
- test/pathological_inputs_test.rb
|
142
|
-
- test/redcarpet_bin_test.rb
|
143
|
-
- test/redcarpet_compat_test.rb
|
144
|
-
- test/safe_render_test.rb
|
145
|
-
- test/smarty_html_test.rb
|
146
|
-
- test/smarty_pants_test.rb
|
147
|
-
- test/stripdown_render_test.rb
|
148
|
-
- test/test_helper.rb
|
121
|
+
test_files: []
|
data/test/benchmark.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
# coding: UTF-8
|
2
|
-
# Thanks Kramdown for the inspiration!
|
3
|
-
require 'benchmark/ips'
|
4
|
-
|
5
|
-
require 'redcarpet'
|
6
|
-
require 'bluecloth'
|
7
|
-
require 'kramdown'
|
8
|
-
|
9
|
-
markdown = File.read(File.join(File.dirname(__FILE__), "fixtures/benchmark.md"))
|
10
|
-
|
11
|
-
# Let's bench!
|
12
|
-
Benchmark.ips do |bench|
|
13
|
-
bench.report("Redcarpet") do
|
14
|
-
Redcarpet::Markdown.new(Redcarpet::Render::HTML).render(markdown)
|
15
|
-
end
|
16
|
-
|
17
|
-
bench.report("BlueCloth") do
|
18
|
-
BlueCloth.new(markdown).to_html
|
19
|
-
end
|
20
|
-
|
21
|
-
bench.report("Kramdown") do
|
22
|
-
Kramdown::Document.new(markdown).to_html
|
23
|
-
end
|
24
|
-
end
|
data/test/custom_render_test.rb
DELETED
@@ -1,67 +0,0 @@
|
|
1
|
-
# coding: UTF-8
|
2
|
-
require 'test_helper'
|
3
|
-
|
4
|
-
class CustomRenderTest < Redcarpet::TestCase
|
5
|
-
class SimpleRender < Redcarpet::Render::HTML
|
6
|
-
def emphasis(text)
|
7
|
-
if @options[:no_intra_emphasis]
|
8
|
-
return %(<em class="no_intra_emphasis">#{text}</em>)
|
9
|
-
end
|
10
|
-
|
11
|
-
%(<em class="cool">#{text}</em>)
|
12
|
-
end
|
13
|
-
|
14
|
-
def header(text, level)
|
15
|
-
"My little poney" if @options[:with_toc_data]
|
16
|
-
end
|
17
|
-
end
|
18
|
-
|
19
|
-
def test_simple_overload
|
20
|
-
md = Redcarpet::Markdown.new(SimpleRender)
|
21
|
-
assert_equal "<p>This is <em class=\"cool\">just</em> a test</p>\n",
|
22
|
-
md.render("This is *just* a test")
|
23
|
-
end
|
24
|
-
|
25
|
-
def test_renderer_options
|
26
|
-
parser = Redcarpet::Markdown.new(SimpleRender.new(with_toc_data: true))
|
27
|
-
output = parser.render("# A title")
|
28
|
-
|
29
|
-
assert_match "My little poney", output
|
30
|
-
end
|
31
|
-
|
32
|
-
def test_markdown_options
|
33
|
-
parser = Redcarpet::Markdown.new(SimpleRender, no_intra_emphasis: true)
|
34
|
-
output = parser.render("*foo*")
|
35
|
-
|
36
|
-
assert_match "no_intra_emphasis", output
|
37
|
-
end
|
38
|
-
|
39
|
-
def test_original_options_hash_is_not_mutated
|
40
|
-
options = { with_toc_data: true }
|
41
|
-
render = SimpleRender.new(options)
|
42
|
-
parser = Redcarpet::Markdown.new(render, tables: true)
|
43
|
-
|
44
|
-
computed_options = render.instance_variable_get(:"@options")
|
45
|
-
|
46
|
-
refute_equal computed_options.object_id, options.object_id
|
47
|
-
end
|
48
|
-
|
49
|
-
class NilPreprocessRenderer < Redcarpet::Render::HTML
|
50
|
-
def preprocess(fulldoc)
|
51
|
-
nil
|
52
|
-
end
|
53
|
-
end
|
54
|
-
|
55
|
-
def test_preprocess_returning_nil
|
56
|
-
md = Redcarpet::Markdown.new(NilPreprocessRenderer)
|
57
|
-
assert_equal(nil,md.render("Anything"))
|
58
|
-
end
|
59
|
-
|
60
|
-
def test_base_render_without_quote_callback
|
61
|
-
# Regression test for https://github.com/vmg/redcarpet/issues/569
|
62
|
-
render = Class.new(Redcarpet::Render::Base)
|
63
|
-
parser = Redcarpet::Markdown.new render.new, quote: true
|
64
|
-
|
65
|
-
assert_equal "", parser.render(%(a "quote"))
|
66
|
-
end
|
67
|
-
end
|
data/test/fixtures/benchmark.md
DELETED
@@ -1,232 +0,0 @@
|
|
1
|
-
Download
|
2
|
-
--------
|
3
|
-
|
4
|
-
[Markdown 1.0.1][dl] (18 KB) -- 17 Dec 2004
|
5
|
-
|
6
|
-
[dl]: http://daringfireball.net/projects/downloads/Markdown_1.0.1.zip
|
7
|
-
|
8
|
-
|
9
|
-
Introduction
|
10
|
-
------------
|
11
|
-
|
12
|
-
Markdown is a text-to-HTML conversion tool for web writers. Markdown
|
13
|
-
allows you to write using an easy-to-read, easy-to-write plain text
|
14
|
-
format, then convert it to structurally valid XHTML (or HTML).
|
15
|
-
|
16
|
-
Thus, "Markdown" is two things: (1) a plain text formatting syntax;
|
17
|
-
and (2) a software tool, written in Perl, that converts the plain text
|
18
|
-
formatting to HTML. See the [Syntax][] page for details pertaining to
|
19
|
-
Markdown's formatting syntax. You can try it out, right now, using the
|
20
|
-
online [Dingus][].
|
21
|
-
|
22
|
-
[syntax]: /projects/markdown/syntax
|
23
|
-
[dingus]: /projects/markdown/dingus
|
24
|
-
|
25
|
-
The overriding design goal for Markdown's formatting syntax is to make
|
26
|
-
it as readable as possible. The idea is that a Markdown-formatted
|
27
|
-
document should be publishable as-is, as plain text, without looking
|
28
|
-
like it's been marked up with tags or formatting instructions. While
|
29
|
-
Markdown's syntax has been influenced by several existing text-to-HTML
|
30
|
-
filters, the single biggest source of inspiration for Markdown's
|
31
|
-
syntax is the format of plain text email.
|
32
|
-
|
33
|
-
The best way to get a feel for Markdown's formatting syntax is simply
|
34
|
-
to look at a Markdown-formatted document. For example, you can view
|
35
|
-
the Markdown source for the article text on this page here:
|
36
|
-
<http://daringfireball.net/projects/markdown/index.text>
|
37
|
-
|
38
|
-
(You can use this '.text' suffix trick to view the Markdown source for
|
39
|
-
the content of each of the pages in this section, e.g. the
|
40
|
-
[Syntax][s_src] and [License][l_src] pages.)
|
41
|
-
|
42
|
-
[s_src]: /projects/markdown/syntax.text
|
43
|
-
[l_src]: /projects/markdown/license.text
|
44
|
-
|
45
|
-
Markdown is free software, available under a BSD-style open source
|
46
|
-
license. See the [License] [pl] page for more information.
|
47
|
-
|
48
|
-
[pl]: /projects/markdown/license
|
49
|
-
|
50
|
-
|
51
|
-
Discussion List <a id="discussion-list" />
|
52
|
-
---------------
|
53
|
-
|
54
|
-
I've set up a public [mailing list for discussion about Markdown] [ml].
|
55
|
-
Any topic related to Markdown -- both its formatting syntax and
|
56
|
-
its software -- is fair game for discussion. Anyone who is interested
|
57
|
-
is welcome to join.
|
58
|
-
|
59
|
-
It's my hope that the mailing list will lead to good ideas for future
|
60
|
-
improvements to Markdown.
|
61
|
-
|
62
|
-
[ml]: http://six.pairlist.net/mailman/listinfo/markdown-discuss
|
63
|
-
|
64
|
-
|
65
|
-
Installation and Requirements <a id="install" />
|
66
|
-
-----------------------------
|
67
|
-
|
68
|
-
Markdown requires Perl 5.6.0 or later. Welcome to the 21st Century.
|
69
|
-
Markdown also requires the standard Perl library module [Digest::MD5]
|
70
|
-
[md5], which is probably already installed on your server.
|
71
|
-
|
72
|
-
[md5]: http://search.cpan.org/dist/Digest-MD5/MD5.pm
|
73
|
-
|
74
|
-
|
75
|
-
### Movable Type ###
|
76
|
-
|
77
|
-
Markdown works with Movable Type version 2.6 or later (including
|
78
|
-
Movable Type 3.0).
|
79
|
-
|
80
|
-
1. Copy the "Markdown.pl" file into your Movable Type "plugins"
|
81
|
-
directory. The "plugins" directory should be in the same directory
|
82
|
-
as "mt.cgi"; if the "plugins" directory doesn't already exist, use
|
83
|
-
your FTP program to create it. Your installation should look like
|
84
|
-
this:
|
85
|
-
|
86
|
-
(mt home)/plugins/Markdown.pl
|
87
|
-
|
88
|
-
2. Once installed, Markdown will appear as an option in Movable Type's
|
89
|
-
Text Formatting pop-up menu. This is selectable on a per-post basis:
|
90
|
-
|
91
|
-
![Screenshot of Movable Type 'Text Formatting' Menu][tfmenu]
|
92
|
-
|
93
|
-
Markdown translates your posts to HTML when you publish; the posts
|
94
|
-
themselves are stored in your MT database in Markdown format.
|
95
|
-
|
96
|
-
3. If you also install SmartyPants 1.5 (or later), Markdown will
|
97
|
-
offer a second text formatting option: "Markdown With
|
98
|
-
SmartyPants". This option is the same as the regular "Markdown"
|
99
|
-
formatter, except that it automatically uses SmartyPants to create
|
100
|
-
typographically correct curly quotes, em-dashes, and ellipses. See
|
101
|
-
the [SmartyPants web page][sp] for more information.
|
102
|
-
|
103
|
-
4. To make Markdown (or "Markdown With SmartyPants") your default
|
104
|
-
text formatting option for new posts, go to Weblog Config:
|
105
|
-
Preferences.
|
106
|
-
|
107
|
-
Note that by default, Markdown produces XHTML output. To configure
|
108
|
-
Markdown to produce HTML 4 output, see "Configuration", below.
|
109
|
-
|
110
|
-
[sp]: http://daringfireball.net/projects/smartypants/
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
### Blosxom ###
|
115
|
-
|
116
|
-
Markdown works with Blosxom version 2.0 or later.
|
117
|
-
|
118
|
-
1. Rename the "Markdown.pl" plug-in to "Markdown" (case is
|
119
|
-
important). Movable Type requires plug-ins to have a ".pl"
|
120
|
-
extension; Blosxom forbids it.
|
121
|
-
|
122
|
-
2. Copy the "Markdown" plug-in file to your Blosxom plug-ins folder.
|
123
|
-
If you're not sure where your Blosxom plug-ins folder is, see the
|
124
|
-
Blosxom documentation for information.
|
125
|
-
|
126
|
-
3. That's it. The entries in your weblog will now automatically be
|
127
|
-
processed by Markdown.
|
128
|
-
|
129
|
-
4. If you'd like to apply Markdown formatting only to certain
|
130
|
-
posts, rather than all of them, Markdown can optionally be used in
|
131
|
-
conjunction with Blosxom's [Meta][] plug-in. First, install the
|
132
|
-
Meta plug-in. Next, open the Markdown plug-in file in a text
|
133
|
-
editor, and set the configuration variable `$g_blosxom_use_meta`
|
134
|
-
to 1. Then, simply include a "`meta-markup: Markdown`" header line
|
135
|
-
at the top of each post you compose using Markdown.
|
136
|
-
|
137
|
-
[meta]: http://www.blosxom.com/plugins/meta/meta.htm
|
138
|
-
|
139
|
-
|
140
|
-
### BBEdit ###
|
141
|
-
|
142
|
-
Markdown works with BBEdit 6.1 or later on Mac OS X. It also works
|
143
|
-
with BBEdit 5.1 or later and MacPerl 5.6.1 on Mac OS 8.6 or later. If
|
144
|
-
you're running Mac OS X 10.2 (Jaguar), you may need to install the
|
145
|
-
Perl module [Digest::MD5] [md5] from CPAN; Digest::MD5 comes
|
146
|
-
pre-installed on Mac OS X 10.3 (Panther).
|
147
|
-
|
148
|
-
1. Copy the "Markdown.pl" file to appropriate filters folder in your
|
149
|
-
"BBEdit Support" folder. On Mac OS X, this should be:
|
150
|
-
|
151
|
-
BBEdit Support/Unix Support/Unix Filters/
|
152
|
-
|
153
|
-
See the BBEdit documentation for more details on the location of
|
154
|
-
these folders.
|
155
|
-
|
156
|
-
You can rename "Markdown.pl" to whatever you wish.
|
157
|
-
|
158
|
-
2. That's it. To use Markdown, select some text in a BBEdit document,
|
159
|
-
then choose Markdown from the Filters sub-menu in the "#!" menu, or
|
160
|
-
the Filters floating palette
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
Configuration <a id="configuration"></a>
|
165
|
-
-------------
|
166
|
-
|
167
|
-
By default, Markdown produces XHTML output for tags with empty elements.
|
168
|
-
E.g.:
|
169
|
-
|
170
|
-
<br />
|
171
|
-
|
172
|
-
Markdown can be configured to produce HTML-style tags; e.g.:
|
173
|
-
|
174
|
-
<br>
|
175
|
-
|
176
|
-
|
177
|
-
### Movable Type ###
|
178
|
-
|
179
|
-
You need to use a special `MTMarkdownOptions` container tag in each
|
180
|
-
Movable Type template where you want HTML 4-style output:
|
181
|
-
|
182
|
-
<MTMarkdownOptions output='html4'>
|
183
|
-
... put your entry content here ...
|
184
|
-
</MTMarkdownOptions>
|
185
|
-
|
186
|
-
The easiest way to use MTMarkdownOptions is probably to put the
|
187
|
-
opening tag right after your `<body>` tag, and the closing tag right
|
188
|
-
before `</body>`.
|
189
|
-
|
190
|
-
To suppress Markdown processing in a particular template, i.e. to
|
191
|
-
publish the raw Markdown-formatted text without translation into
|
192
|
-
(X)HTML, set the `output` attribute to 'raw':
|
193
|
-
|
194
|
-
<MTMarkdownOptions output='raw'>
|
195
|
-
... put your entry content here ...
|
196
|
-
</MTMarkdownOptions>
|
197
|
-
|
198
|
-
|
199
|
-
### Command-Line ###
|
200
|
-
|
201
|
-
Use the `--html4tags` command-line switch to produce HTML output from a
|
202
|
-
Unix-style command line. E.g.:
|
203
|
-
|
204
|
-
% perl Markdown.pl --html4tags foo.text
|
205
|
-
|
206
|
-
Type `perldoc Markdown.pl`, or read the POD documentation within the
|
207
|
-
Markdown.pl source code for more information.
|
208
|
-
|
209
|
-
|
210
|
-
Acknowledgements <a id="acknowledgements" />
|
211
|
-
----------------
|
212
|
-
|
213
|
-
[Aaron Swartz][] deserves a tremendous amount of credit for his feedback on the
|
214
|
-
design of Markdown's formatting syntax. Markdown is *much* better thanks
|
215
|
-
to Aaron's ideas, feedback, and testing. Also, Aaron's [html2text][]
|
216
|
-
is a very handy (and free) utility for turning HTML into
|
217
|
-
Markdown-formatted plain text.
|
218
|
-
|
219
|
-
[Nathaniel Irons][], [Dan Benjamin][], [Daniel Bogan][], and [Jason Perkins][]
|
220
|
-
also deserve thanks for their feedback.
|
221
|
-
|
222
|
-
[Michel Fortin][] has ported Markdown to PHP; it's a splendid port, and highly recommended for anyone looking for a PHP implementation of Markdown.
|
223
|
-
|
224
|
-
[Aaron Swartz]: http://www.aaronsw.com/
|
225
|
-
[Nathaniel Irons]: http://bumppo.net/
|
226
|
-
[Dan Benjamin]: http://hivelogic.com/
|
227
|
-
[Daniel Bogan]: http://waferbaby.com/
|
228
|
-
[Jason Perkins]: http://pressedpants.com/
|
229
|
-
[Michel Fortin]: http://www.michelf.com/projects/php-markdown/
|
230
|
-
[html2text]: http://www.aaronsw.com/2002/html2text/
|
231
|
-
|
232
|
-
[tfmenu]: /graphics/markdown/mt_textformat_menu.png
|
data/test/html5_test.rb
DELETED
@@ -1,82 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class HTML5Test < Redcarpet::TestCase
|
4
|
-
def test_that_html5_works
|
5
|
-
section = <<-HTML.chomp.strip_heredoc
|
6
|
-
<section>
|
7
|
-
<p>The quick brown fox jumps over the lazy dog.</p>
|
8
|
-
</section>
|
9
|
-
HTML
|
10
|
-
|
11
|
-
figure = <<-HTML.chomp.strip_heredoc
|
12
|
-
<figure>
|
13
|
-
<img src="http://example.org/image.jpg" alt="">
|
14
|
-
<figcaption>
|
15
|
-
<p>Hello world!</p>
|
16
|
-
</figcaption>
|
17
|
-
</figure>
|
18
|
-
HTML
|
19
|
-
|
20
|
-
assert_renders section, section
|
21
|
-
assert_renders figure, figure
|
22
|
-
end
|
23
|
-
|
24
|
-
def test_that_html5_works_with_code_blocks
|
25
|
-
section = <<-HTML
|
26
|
-
\t<section>
|
27
|
-
\t\t<p>The quick brown fox jumps over the lazy dog.</p>
|
28
|
-
\t</section>
|
29
|
-
HTML
|
30
|
-
|
31
|
-
section_expected = <<-HTML.chomp.strip_heredoc
|
32
|
-
<pre><code><section>
|
33
|
-
<p>The quick brown fox jumps over the lazy dog.</p>
|
34
|
-
</section>
|
35
|
-
</code></pre>
|
36
|
-
HTML
|
37
|
-
|
38
|
-
header = <<-HTML
|
39
|
-
<header>
|
40
|
-
<hgroup>
|
41
|
-
<h1>Section heading</h1>
|
42
|
-
<h2>Subhead</h2>
|
43
|
-
</hgroup>
|
44
|
-
</header>
|
45
|
-
HTML
|
46
|
-
|
47
|
-
header_expected = <<-HTML.chomp.strip_heredoc
|
48
|
-
<pre><code><header>
|
49
|
-
<hgroup>
|
50
|
-
<h1>Section heading</h1>
|
51
|
-
<h2>Subhead</h2>
|
52
|
-
</hgroup>
|
53
|
-
</header>
|
54
|
-
</code></pre>
|
55
|
-
HTML
|
56
|
-
|
57
|
-
assert_renders section_expected, section
|
58
|
-
assert_renders header_expected, header
|
59
|
-
end
|
60
|
-
|
61
|
-
def test_script_tag_recognition
|
62
|
-
html = <<-HTML.chomp.strip_heredoc
|
63
|
-
<script type="text/javascript">
|
64
|
-
alert('Foo!');
|
65
|
-
</script>
|
66
|
-
HTML
|
67
|
-
|
68
|
-
assert_renders html, html
|
69
|
-
end
|
70
|
-
|
71
|
-
def test_new_html5_tags_not_escaped
|
72
|
-
details = <<-HTML.chomp.strip_heredoc
|
73
|
-
<details>
|
74
|
-
log:
|
75
|
-
|
76
|
-
</details>
|
77
|
-
HTML
|
78
|
-
|
79
|
-
assert_renders details, details
|
80
|
-
end
|
81
|
-
|
82
|
-
end
|