mmd-ruby 5.2.0.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 +7 -0
- data/LICENSE +78 -0
- data/MultiMarkdown-5/src/GLibFacade.c +310 -0
- data/MultiMarkdown-5/src/GLibFacade.h +100 -0
- data/MultiMarkdown-5/src/beamer.c +182 -0
- data/MultiMarkdown-5/src/beamer.h +11 -0
- data/MultiMarkdown-5/src/critic.c +117 -0
- data/MultiMarkdown-5/src/critic.h +15 -0
- data/MultiMarkdown-5/src/glib.h +11 -0
- data/MultiMarkdown-5/src/html.c +1171 -0
- data/MultiMarkdown-5/src/html.h +14 -0
- data/MultiMarkdown-5/src/latex.c +1234 -0
- data/MultiMarkdown-5/src/latex.h +16 -0
- data/MultiMarkdown-5/src/libMultiMarkdown.h +257 -0
- data/MultiMarkdown-5/src/lyx.c +2269 -0
- data/MultiMarkdown-5/src/lyx.h +37 -0
- data/MultiMarkdown-5/src/lyxbeamer.c +265 -0
- data/MultiMarkdown-5/src/lyxbeamer.h +11 -0
- data/MultiMarkdown-5/src/memoir.c +80 -0
- data/MultiMarkdown-5/src/memoir.h +10 -0
- data/MultiMarkdown-5/src/multimarkdown.c +559 -0
- data/MultiMarkdown-5/src/odf.c +1241 -0
- data/MultiMarkdown-5/src/odf.h +18 -0
- data/MultiMarkdown-5/src/opml.c +189 -0
- data/MultiMarkdown-5/src/opml.h +15 -0
- data/MultiMarkdown-5/src/parse_utilities.c +912 -0
- data/MultiMarkdown-5/src/parser.c +17341 -0
- data/MultiMarkdown-5/src/parser.h +190 -0
- data/MultiMarkdown-5/src/rng.c +117 -0
- data/MultiMarkdown-5/src/rtf.c +665 -0
- data/MultiMarkdown-5/src/rtf.h +17 -0
- data/MultiMarkdown-5/src/strtok.c +56 -0
- data/MultiMarkdown-5/src/strtok.h +9 -0
- data/MultiMarkdown-5/src/text.c +56 -0
- data/MultiMarkdown-5/src/text.h +11 -0
- data/MultiMarkdown-5/src/toc.c +157 -0
- data/MultiMarkdown-5/src/toc.h +15 -0
- data/MultiMarkdown-5/src/transclude.c +335 -0
- data/MultiMarkdown-5/src/transclude.h +28 -0
- data/MultiMarkdown-5/src/version.h +59 -0
- data/MultiMarkdown-5/src/writer.c +767 -0
- data/MultiMarkdown-5/src/writer.h +38 -0
- data/README.md +77 -0
- data/Rakefile +88 -0
- data/bin/mmd-ruby +123 -0
- data/ext/extconf.h +3 -0
- data/ext/extconf.rb +10 -0
- data/ext/multimarkdown.c +133 -0
- data/lib/mmd-jekyll.rb +19 -0
- data/lib/mmd-ruby.rb +1 -0
- data/lib/mmd.rb +1 -0
- data/lib/multimarkdown-ruby.rb +1 -0
- data/lib/multimarkdown.bundle +0 -0
- data/lib/multimarkdown.rb +69 -0
- data/lib/multimarkdown/version.rb +6 -0
- data/mmd-ruby.gemspec +37 -0
- data/test/extensions_test.rb +174 -0
- data/test/multimarkdown_test.rb +77 -0
- metadata +120 -0
data/lib/mmd-jekyll.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
# mmd-jekyll - Ruby MultiMarkdown Parser for Jekyll
|
2
|
+
# Set your Markdown parser to 'MultiMarkdown' to use MultiMardown as your parser.
|
3
|
+
# Made by Sl (Shahaf Levi) - slsrepo.com
|
4
|
+
# © Copyright Sl's Repository Ltd, 2016. All Rights Reserved.
|
5
|
+
|
6
|
+
class Jekyll::Converters::Markdown::MultiMarkdown
|
7
|
+
def initialize(config)
|
8
|
+
require 'mmd-ruby'
|
9
|
+
@config = config
|
10
|
+
rescue LoadError
|
11
|
+
STDERR.puts 'You are missing a library required for Markdown. Please run:'
|
12
|
+
STDERR.puts ' $ [sudo] gem install mmd-ruby'
|
13
|
+
raise FatalException.new("Missing dependency: mmd-ruby")
|
14
|
+
end
|
15
|
+
|
16
|
+
def convert(content)
|
17
|
+
MultiMarkdown.new(content, :escaped_line_breaks).to_html
|
18
|
+
end
|
19
|
+
end
|
data/lib/mmd-ruby.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'multimarkdown'
|
data/lib/mmd.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'multimarkdown'
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'multimarkdown'
|
Binary file
|
@@ -0,0 +1,69 @@
|
|
1
|
+
require 'multimarkdown.so'
|
2
|
+
require 'multimarkdown/version'
|
3
|
+
|
4
|
+
# Front-end to fletcher penney's implementation of MultiMarkdown
|
5
|
+
#
|
6
|
+
# A simple processor:
|
7
|
+
# >> puts MultiMarkdown.new("Hello, World.").to_html
|
8
|
+
# <p>Hello, World.</p>
|
9
|
+
#
|
10
|
+
# With other stuff:
|
11
|
+
# >> puts MultiMarkdown.new("_Hello World!_", :smart, :filter_html).to_html
|
12
|
+
# <p><em>Hello World!</em></p>
|
13
|
+
#
|
14
|
+
class MultiMarkdown
|
15
|
+
|
16
|
+
EXTENSIONS = {
|
17
|
+
"compatibility" => {:desc => "Markdown compatibility mode (disables all other options)", :short => "c"},
|
18
|
+
"complete" => {:desc => "Force complete document", :short => "f"},
|
19
|
+
"snippet" => {:desc => "Force snippet only", :short => "s"},
|
20
|
+
"no_smart_quotes" => {:desc => "Disable Smart quotes", :short => false},
|
21
|
+
"no_footnotes" => {:desc => "Disable Footnotes", :short => false},
|
22
|
+
"no_anchors" => {:desc => "Don't add anchors to headers, etc.", :short => false},
|
23
|
+
"filter_styles" => {:desc => "Filter out style blocks", :short => false},
|
24
|
+
"filter_html" => {:desc => "Filter out raw HTML", :short => false},
|
25
|
+
"process_html" => {:desc => "Process Markdown inside HTML", :short => false},
|
26
|
+
"no_metadata" => {:desc => "Don't parse Metadata", :short => false},
|
27
|
+
"obfuscate_email_addresses" => {:desc => "Mask email addresses", :short => false},
|
28
|
+
"critic_markup_accept_all" => {:desc => "CriticMarkup: Accept all proposed changes", :short => "a"},
|
29
|
+
"critic_markup_reject_all" => {:desc => "CriticMarkup: Reject all proposed changes", :short => "r"},
|
30
|
+
"random_footnote_anchor_numbers" => {:desc => "Use random numbers for footnote link anchors", :short => false},
|
31
|
+
"escaped_line_breaks" => {:desc => "Escaped line break", :short => false}
|
32
|
+
}
|
33
|
+
|
34
|
+
EXTENSIONS.keys.each do |ext|
|
35
|
+
attr_accessor ext
|
36
|
+
end
|
37
|
+
|
38
|
+
# Create a new MultiMarkdown processor. The `text` argument is a string
|
39
|
+
# containing MultiMarkdown text. Variable other arguments may be supplied to
|
40
|
+
# set various processing options. See MultiMarkdown::EXTENSIONS for more.
|
41
|
+
def initialize(text, *extensions)
|
42
|
+
@text = text
|
43
|
+
extensions.each do |ext|
|
44
|
+
raise "Unknown extension: #{ext.inspect}" unless EXTENSIONS.keys.include?(ext.to_s)
|
45
|
+
send("#{ext}=", true)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
alias extract_metadata extract_metadata_value
|
50
|
+
|
51
|
+
# Returns a Hash cointaining all Metadata
|
52
|
+
#
|
53
|
+
#
|
54
|
+
def metadata(key = nil)
|
55
|
+
if @cached_metadata.nil?
|
56
|
+
@cached_metadata = {}
|
57
|
+
extract_metadata_keys.each do |k|
|
58
|
+
@cached_metadata[k.downcase] = extract_metadata_value(k)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
if key
|
63
|
+
@cached_metadata[key.to_s.downcase]
|
64
|
+
else
|
65
|
+
@cached_metadata.dup
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
data/mmd-ruby.gemspec
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Copyright 2016 Sl's Repository Ltd
|
2
|
+
#
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
|
+
# you may not use this file except in compliance with the License.
|
5
|
+
# You may obtain a copy of the License at
|
6
|
+
#
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
8
|
+
#
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
12
|
+
# See the License for the specific language governing permissions and
|
13
|
+
# limitations under the License.
|
14
|
+
|
15
|
+
# -*- encoding: utf-8 -*-
|
16
|
+
$:.push File.expand_path("../lib", __FILE__)
|
17
|
+
require "multimarkdown/version"
|
18
|
+
|
19
|
+
Gem::Specification.new do |s|
|
20
|
+
s.name = "mmd-ruby"
|
21
|
+
s.version = MultiMarkdown::VERSION
|
22
|
+
s.platform = Gem::Platform::RUBY
|
23
|
+
s.authors = ["Sl's Repository Ltd"]
|
24
|
+
s.email = ["admin@slsrepo.com"]
|
25
|
+
s.homepage = "https://slsrepo.com/products"
|
26
|
+
s.summary = "MultiMarkdown wrapper for Ruby"
|
27
|
+
s.description = s.summary
|
28
|
+
s.extra_rdoc_files = ['README.md', 'LICENSE']
|
29
|
+
|
30
|
+
s.add_dependency "bundler"
|
31
|
+
|
32
|
+
s.files = %w(LICENSE README.md Rakefile mmd-ruby.gemspec) + Dir.glob("{bin,lib,test}/**/*") + Dir.glob("{ext,MultiMarkdown-5/src}/*.{c,h,rb}")
|
33
|
+
s.test_files = Dir.glob("{test}/**/*")
|
34
|
+
s.executables = "mmd-ruby"
|
35
|
+
s.extensions = ['ext/extconf.rb']
|
36
|
+
s.require_paths = ["lib"]
|
37
|
+
end
|
@@ -0,0 +1,174 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
$: << File.join(File.dirname(__FILE__), "../lib")
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'multimarkdown'
|
7
|
+
|
8
|
+
class ExtensionsTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_force_complete_document
|
11
|
+
mmd = 'Some very simple _Markdown_'
|
12
|
+
|
13
|
+
# Don't change anything (default)
|
14
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
15
|
+
assert !multimarkdown.to_html.include?('<html>'), "Found '<html>' tag: '#{multimarkdown.to_html}'"
|
16
|
+
|
17
|
+
# Force complete document
|
18
|
+
multimarkdown = MultiMarkdown.new(mmd, :complete)
|
19
|
+
assert multimarkdown.to_html.include?('<html>'), "Didn't find '<html>' tag: '#{multimarkdown.to_html}'"
|
20
|
+
end
|
21
|
+
|
22
|
+
def test_force_snippet_mode
|
23
|
+
mmd = "Meta1: Value\nMeta2: Value2\n\nHello!"
|
24
|
+
|
25
|
+
# Don't change anything (default)
|
26
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
27
|
+
assert multimarkdown.to_html.include?('<html>'), "Didn't find '<html>' tag: '#{multimarkdown.to_html}'"
|
28
|
+
|
29
|
+
# Force snippet
|
30
|
+
multimarkdown = MultiMarkdown.new(mmd, :snippet)
|
31
|
+
assert !multimarkdown.to_html.include?('<html>'), "Found '<html>' tag: '#{multimarkdown.to_html}'"
|
32
|
+
end
|
33
|
+
|
34
|
+
def test_smart_quotes
|
35
|
+
mmd = 'Quotes are "beautiful"'
|
36
|
+
|
37
|
+
# Don't change anything (default)
|
38
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
39
|
+
assert multimarkdown.to_html.include?('“'), "Didn't find nice quote '“': '#{multimarkdown.to_html}'"
|
40
|
+
assert multimarkdown.to_html.include?('”'), "Didn't find nice quote '”': '#{multimarkdown.to_html}'"
|
41
|
+
assert !multimarkdown.to_html.include?('"'), "Found quote '"': '#{multimarkdown.to_html}'"
|
42
|
+
|
43
|
+
# Disble smart quotes
|
44
|
+
multimarkdown = MultiMarkdown.new(mmd, :no_smart_quotes)
|
45
|
+
assert_equal '<p>Quotes are "beautiful"</p>', multimarkdown.to_html.strip
|
46
|
+
end
|
47
|
+
|
48
|
+
def test_footnotes
|
49
|
+
mmd = <<eof
|
50
|
+
Here is some text containing a footnote.[^somesamplefootnote]
|
51
|
+
|
52
|
+
[^somesamplefootnote]: Here is the text of the footnote itself.
|
53
|
+
eof
|
54
|
+
|
55
|
+
# Don't change anything (default)
|
56
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
57
|
+
assert multimarkdown.to_html.include?('class="footnotes"'), "Didn't find footnote container: '#{multimarkdown.to_html}'"
|
58
|
+
assert multimarkdown.to_html.include?('text of the footnote itself'), "Didn't find footnote text: '#{multimarkdown.to_html}'"
|
59
|
+
assert multimarkdown.to_html.include?('#fnref:1'), "Didn't find footnote anchor '#fnref:1': '#{multimarkdown.to_html}'"
|
60
|
+
|
61
|
+
multimarkdown = MultiMarkdown.new(mmd, :random_footnote_anchor_numbers)
|
62
|
+
assert !multimarkdown.to_html.include?('#fnref:1'), "Found footnote anchor '#fnref:1': '#{multimarkdown.to_html}'"
|
63
|
+
|
64
|
+
multimarkdown = MultiMarkdown.new(mmd, :no_footnotes)
|
65
|
+
assert !multimarkdown.to_html.include?('class="footnotes"'), "Found footnote container: '#{multimarkdown.to_html}'"
|
66
|
+
assert multimarkdown.to_html.include?('[^somesamplefootnote]'), "Didn't find footnote markdown text: '#{multimarkdown.to_html}'"
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_anchors
|
71
|
+
mmd = '# A Heading'
|
72
|
+
|
73
|
+
# Don't change anything (default)
|
74
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
75
|
+
assert multimarkdown.to_html.include?('id="aheading"'), "Didn't find a tag with 'id=\"aheading\"': '#{multimarkdown.to_html}'"
|
76
|
+
|
77
|
+
# Turn off auto anchors
|
78
|
+
multimarkdown = MultiMarkdown.new(mmd, :no_anchors)
|
79
|
+
assert !multimarkdown.to_html.include?('id="aheading"'), "Found a tag with 'id=\"aheading\"': '#{multimarkdown.to_html}'"
|
80
|
+
end
|
81
|
+
|
82
|
+
def test_filter_styles
|
83
|
+
mmd = '<style>p {color: red}</style> <span style="color: blue">It is blue!</span>'
|
84
|
+
|
85
|
+
# Don't change anything (default)
|
86
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
87
|
+
assert multimarkdown.to_html.include?('<style>p {color: red}</style>'), "Didn't find '<style>' tag: '#{multimarkdown.to_html}'"
|
88
|
+
assert multimarkdown.to_html.include?('style="color: blue"'), "Didn't inline 'style': '#{multimarkdown.to_html}'"
|
89
|
+
|
90
|
+
# Disbale styles
|
91
|
+
multimarkdown = MultiMarkdown.new(mmd, :filter_styles)
|
92
|
+
assert !multimarkdown.to_html.include?('<style>p {color: red}</style>'), "Found '<style>' tag: '#{multimarkdown.to_html}'"
|
93
|
+
# Doesn't work: assert !multimarkdown.to_html.include?('style="color: blue"'), "Found inline 'style': '#{multimarkdown.to_html}'"
|
94
|
+
end
|
95
|
+
|
96
|
+
def test_filter_html
|
97
|
+
mmd = '<span>Hello from HTML</span>Pure Markdown'
|
98
|
+
|
99
|
+
# Don't change anything (default)
|
100
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
101
|
+
assert multimarkdown.to_html.include?('<span>Hello from HTML</span>'), "Didn't find '<span>' tag: '#{multimarkdown.to_html}'"
|
102
|
+
assert multimarkdown.to_html.include?('Pure Markdown<'), "Didn't find Markdown: '#{multimarkdown.to_html}'"
|
103
|
+
|
104
|
+
# Disbale html
|
105
|
+
multimarkdown = MultiMarkdown.new(mmd, :filter_html)
|
106
|
+
assert_equal "<p>Hello from HTMLPure Markdown</p>", multimarkdown.to_html.strip
|
107
|
+
end
|
108
|
+
|
109
|
+
# TODO
|
110
|
+
# See https://github.com/fletcher/MultiMarkdown-4/issues/97
|
111
|
+
def disabled_test_markdown_in_html
|
112
|
+
mmd = 'Hello <span>[World](http://world.de)</span>!'
|
113
|
+
|
114
|
+
# No Markdown in html supported (default)
|
115
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
116
|
+
assert_equal "<p>Hello <span>_World_</span>!</p>", multimarkdown.to_html.strip
|
117
|
+
|
118
|
+
# now with the extension turned on
|
119
|
+
multimarkdown = MultiMarkdown.new(mmd, :process_html)
|
120
|
+
assert_equal "<p>Hello <span><em>World</em></span>!</p>", multimarkdown.to_html.strip
|
121
|
+
end
|
122
|
+
|
123
|
+
|
124
|
+
def test_no_metadata
|
125
|
+
mmd = "A: B\n\nBlabla"
|
126
|
+
|
127
|
+
# Don't do anything (default)
|
128
|
+
multimarkdown = MultiMarkdown.new(mmd, :no_metadata)
|
129
|
+
assert multimarkdown.to_html.include?('A: B'), "Didn't find metadata style text: '#{multimarkdown.to_html}'"
|
130
|
+
end
|
131
|
+
|
132
|
+
def test_obfuscation
|
133
|
+
mmd = '[Contact me](mailto:mail@example.com)'
|
134
|
+
|
135
|
+
# Don't do anything (default)
|
136
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
137
|
+
assert multimarkdown.to_html.include?('mail@example.com'), "Didn't find email address: '#{multimarkdown.to_html}'"
|
138
|
+
|
139
|
+
# Obfuscate
|
140
|
+
multimarkdown = MultiMarkdown.new(mmd, :obfuscate_email_addresses)
|
141
|
+
assert !multimarkdown.to_html.include?('mail@example.com'), "Found email address: '#{multimarkdown.to_html}'"
|
142
|
+
end
|
143
|
+
|
144
|
+
def test_critic_markup
|
145
|
+
mmd = 'This is a {++green ++} test.'
|
146
|
+
|
147
|
+
# Don't do anything (default)
|
148
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
149
|
+
assert_equal "<p>This is a {++green ++} test.</p>", multimarkdown.to_html.strip
|
150
|
+
|
151
|
+
# Include changes
|
152
|
+
multimarkdown = MultiMarkdown.new(mmd, :critic_markup_accept_all)
|
153
|
+
assert_equal "<p>This is a green test.</p>", multimarkdown.to_html.strip
|
154
|
+
|
155
|
+
# Ignore changes
|
156
|
+
multimarkdown = MultiMarkdown.new(mmd, :critic_markup_reject_all)
|
157
|
+
assert_equal "<p>This is a test.</p>", multimarkdown.to_html.strip
|
158
|
+
end
|
159
|
+
|
160
|
+
def test_escaped_line_breaks
|
161
|
+
mmd = <<eof
|
162
|
+
This is a cool MultiMarkdown\\
|
163
|
+
Feature
|
164
|
+
eof
|
165
|
+
|
166
|
+
# Don't do anything (default)
|
167
|
+
multimarkdown = MultiMarkdown.new(mmd)
|
168
|
+
assert !multimarkdown.to_html.include?('<br/>'), "Found '<br/>' tag: '#{multimarkdown.to_html}'"
|
169
|
+
|
170
|
+
multimarkdown = MultiMarkdown.new(mmd, :escaped_line_breaks)
|
171
|
+
assert multimarkdown.to_html.include?('<br/>'), "Didn't find '<br/>' tag: '#{multimarkdown.to_html}'"
|
172
|
+
end
|
173
|
+
|
174
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# encoding: UTF-8
|
2
|
+
|
3
|
+
$: << File.join(File.dirname(__FILE__), "../lib")
|
4
|
+
|
5
|
+
require 'test/unit'
|
6
|
+
require 'multimarkdown'
|
7
|
+
|
8
|
+
class MultiMarkdownTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_extension_methods_present_on_multimarkdown_class
|
11
|
+
assert MultiMarkdown.instance_methods.include?(:to_html),
|
12
|
+
"MultiMarkdown class should respond to #to_html"
|
13
|
+
end
|
14
|
+
|
15
|
+
def test_simple_one_liner_to_html
|
16
|
+
multimarkdown = MultiMarkdown.new('Hello World.')
|
17
|
+
assert_respond_to multimarkdown, :to_html
|
18
|
+
assert_equal "<p>Hello World.</p>", multimarkdown.to_html.strip
|
19
|
+
end
|
20
|
+
|
21
|
+
def test_inline_multimarkdown_to_html
|
22
|
+
multimarkdown = MultiMarkdown.new('_Hello World_!')
|
23
|
+
assert_respond_to multimarkdown, :to_html
|
24
|
+
assert_equal "<p><em>Hello World</em>!</p>", multimarkdown.to_html.strip
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_multimarkdown_in_html_to_html
|
28
|
+
multimarkdown = MultiMarkdown.new('Hello <span>_World_</span>!',:process_html)
|
29
|
+
assert_respond_to multimarkdown, :to_html
|
30
|
+
assert_equal "<p>Hello <span><em>World</em></span>!</p>", multimarkdown.to_html.strip
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_version_fits
|
34
|
+
assert MultiMarkdown::VERSION =~ /^#{MultiMarkdown::MMD_VERSION}/,
|
35
|
+
"Expected MultiMarkdown's version (#{MultiMarkdown::VERSION}) to start with the C library's version (#{MultiMarkdown::MMD_VERSION})"
|
36
|
+
end
|
37
|
+
|
38
|
+
def test_meta_attributes
|
39
|
+
multimarkdown = MultiMarkdown.new(<<-eof)
|
40
|
+
meta1: Foo
|
41
|
+
meta2: Bar
|
42
|
+
|
43
|
+
Lorem Ipsum
|
44
|
+
eof
|
45
|
+
assert_equal ["meta1", "meta2"], multimarkdown.extract_metadata_keys()
|
46
|
+
|
47
|
+
assert_equal "Foo", multimarkdown.extract_metadata_value("Meta1")
|
48
|
+
assert_equal "Bar", multimarkdown.extract_metadata_value("Meta2")
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_cached_metadata
|
52
|
+
multimarkdown = MultiMarkdown.new(<<-eof)
|
53
|
+
MetaTheMeta1: Foo
|
54
|
+
MetaTheMeta2: Bar
|
55
|
+
|
56
|
+
Lorem Ipsum
|
57
|
+
eof
|
58
|
+
|
59
|
+
assert_equal({"metathemeta1" => "Foo", "metathemeta2" => "Bar"}, multimarkdown.metadata)
|
60
|
+
|
61
|
+
assert_equal("Foo", multimarkdown.metadata("MetaTheMeta1"))
|
62
|
+
assert_equal(nil, multimarkdown.metadata["MetaTheMeta1"])
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_encoding
|
66
|
+
multimarkdown = MultiMarkdown.new(<<-eof)
|
67
|
+
umlauts: M€tädätä
|
68
|
+
|
69
|
+
ÄÖÜßäöüµ√
|
70
|
+
=========
|
71
|
+
|
72
|
+
eof
|
73
|
+
assert_match(/<h1[^>]*>ÄÖÜßäöüµ√<\/h1>/, multimarkdown.to_html.strip)
|
74
|
+
assert_equal("M€tädätä", multimarkdown.metadata('umlauts'))
|
75
|
+
end
|
76
|
+
|
77
|
+
end
|
metadata
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mmd-ruby
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 5.2.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Sl's Repository Ltd
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
description: MultiMarkdown wrapper for Ruby
|
28
|
+
email:
|
29
|
+
- admin@slsrepo.com
|
30
|
+
executables:
|
31
|
+
- mmd-ruby
|
32
|
+
extensions:
|
33
|
+
- ext/extconf.rb
|
34
|
+
extra_rdoc_files:
|
35
|
+
- README.md
|
36
|
+
- LICENSE
|
37
|
+
files:
|
38
|
+
- LICENSE
|
39
|
+
- README.md
|
40
|
+
- Rakefile
|
41
|
+
- mmd-ruby.gemspec
|
42
|
+
- bin/mmd-ruby
|
43
|
+
- lib/mmd-jekyll.rb
|
44
|
+
- lib/mmd-ruby.rb
|
45
|
+
- lib/mmd.rb
|
46
|
+
- lib/multimarkdown/version.rb
|
47
|
+
- lib/multimarkdown-ruby.rb
|
48
|
+
- lib/multimarkdown.bundle
|
49
|
+
- lib/multimarkdown.rb
|
50
|
+
- test/extensions_test.rb
|
51
|
+
- test/multimarkdown_test.rb
|
52
|
+
- ext/multimarkdown.c
|
53
|
+
- ext/extconf.h
|
54
|
+
- ext/extconf.rb
|
55
|
+
- MultiMarkdown-5/src/beamer.c
|
56
|
+
- MultiMarkdown-5/src/critic.c
|
57
|
+
- MultiMarkdown-5/src/GLibFacade.c
|
58
|
+
- MultiMarkdown-5/src/html.c
|
59
|
+
- MultiMarkdown-5/src/latex.c
|
60
|
+
- MultiMarkdown-5/src/lyx.c
|
61
|
+
- MultiMarkdown-5/src/lyxbeamer.c
|
62
|
+
- MultiMarkdown-5/src/memoir.c
|
63
|
+
- MultiMarkdown-5/src/multimarkdown.c
|
64
|
+
- MultiMarkdown-5/src/odf.c
|
65
|
+
- MultiMarkdown-5/src/opml.c
|
66
|
+
- MultiMarkdown-5/src/parse_utilities.c
|
67
|
+
- MultiMarkdown-5/src/parser.c
|
68
|
+
- MultiMarkdown-5/src/rng.c
|
69
|
+
- MultiMarkdown-5/src/rtf.c
|
70
|
+
- MultiMarkdown-5/src/strtok.c
|
71
|
+
- MultiMarkdown-5/src/text.c
|
72
|
+
- MultiMarkdown-5/src/toc.c
|
73
|
+
- MultiMarkdown-5/src/transclude.c
|
74
|
+
- MultiMarkdown-5/src/writer.c
|
75
|
+
- MultiMarkdown-5/src/beamer.h
|
76
|
+
- MultiMarkdown-5/src/critic.h
|
77
|
+
- MultiMarkdown-5/src/glib.h
|
78
|
+
- MultiMarkdown-5/src/GLibFacade.h
|
79
|
+
- MultiMarkdown-5/src/html.h
|
80
|
+
- MultiMarkdown-5/src/latex.h
|
81
|
+
- MultiMarkdown-5/src/libMultiMarkdown.h
|
82
|
+
- MultiMarkdown-5/src/lyx.h
|
83
|
+
- MultiMarkdown-5/src/lyxbeamer.h
|
84
|
+
- MultiMarkdown-5/src/memoir.h
|
85
|
+
- MultiMarkdown-5/src/odf.h
|
86
|
+
- MultiMarkdown-5/src/opml.h
|
87
|
+
- MultiMarkdown-5/src/parser.h
|
88
|
+
- MultiMarkdown-5/src/rtf.h
|
89
|
+
- MultiMarkdown-5/src/strtok.h
|
90
|
+
- MultiMarkdown-5/src/text.h
|
91
|
+
- MultiMarkdown-5/src/toc.h
|
92
|
+
- MultiMarkdown-5/src/transclude.h
|
93
|
+
- MultiMarkdown-5/src/version.h
|
94
|
+
- MultiMarkdown-5/src/writer.h
|
95
|
+
homepage: https://slsrepo.com/products
|
96
|
+
licenses: []
|
97
|
+
metadata: {}
|
98
|
+
post_install_message:
|
99
|
+
rdoc_options: []
|
100
|
+
require_paths:
|
101
|
+
- lib
|
102
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
requirements: []
|
113
|
+
rubyforge_project:
|
114
|
+
rubygems_version: 2.0.14.1
|
115
|
+
signing_key:
|
116
|
+
specification_version: 4
|
117
|
+
summary: MultiMarkdown wrapper for Ruby
|
118
|
+
test_files:
|
119
|
+
- test/extensions_test.rb
|
120
|
+
- test/multimarkdown_test.rb
|