rmultimarkdown 4.5.2.2

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.
Files changed (51) hide show
  1. data/LICENSE +75 -0
  2. data/MultiMarkdown-4/GLibFacade.c +294 -0
  3. data/MultiMarkdown-4/GLibFacade.h +95 -0
  4. data/MultiMarkdown-4/beamer.c +179 -0
  5. data/MultiMarkdown-4/beamer.h +11 -0
  6. data/MultiMarkdown-4/critic.c +111 -0
  7. data/MultiMarkdown-4/critic.h +15 -0
  8. data/MultiMarkdown-4/glib.h +11 -0
  9. data/MultiMarkdown-4/html.c +1062 -0
  10. data/MultiMarkdown-4/html.h +14 -0
  11. data/MultiMarkdown-4/latex.c +1137 -0
  12. data/MultiMarkdown-4/latex.h +16 -0
  13. data/MultiMarkdown-4/libMultiMarkdown.h +157 -0
  14. data/MultiMarkdown-4/lyx.c +2163 -0
  15. data/MultiMarkdown-4/lyx.h +36 -0
  16. data/MultiMarkdown-4/lyxbeamer.c +267 -0
  17. data/MultiMarkdown-4/lyxbeamer.h +11 -0
  18. data/MultiMarkdown-4/memoir.c +79 -0
  19. data/MultiMarkdown-4/memoir.h +10 -0
  20. data/MultiMarkdown-4/multimarkdown.c +469 -0
  21. data/MultiMarkdown-4/odf.c +1202 -0
  22. data/MultiMarkdown-4/odf.h +18 -0
  23. data/MultiMarkdown-4/opml.c +188 -0
  24. data/MultiMarkdown-4/opml.h +15 -0
  25. data/MultiMarkdown-4/parse_utilities.c +752 -0
  26. data/MultiMarkdown-4/parser.c +15679 -0
  27. data/MultiMarkdown-4/parser.h +188 -0
  28. data/MultiMarkdown-4/rng.c +117 -0
  29. data/MultiMarkdown-4/rtf.c +648 -0
  30. data/MultiMarkdown-4/rtf.h +17 -0
  31. data/MultiMarkdown-4/strtok.c +56 -0
  32. data/MultiMarkdown-4/strtok.h +9 -0
  33. data/MultiMarkdown-4/text.c +53 -0
  34. data/MultiMarkdown-4/text.h +11 -0
  35. data/MultiMarkdown-4/transclude.c +218 -0
  36. data/MultiMarkdown-4/transclude.h +26 -0
  37. data/MultiMarkdown-4/writer.c +576 -0
  38. data/MultiMarkdown-4/writer.h +34 -0
  39. data/README.md +75 -0
  40. data/Rakefile +85 -0
  41. data/bin/rmultimarkdown +128 -0
  42. data/ext/extconf.h +3 -0
  43. data/ext/extconf.rb +10 -0
  44. data/ext/multi_markdown.c +100 -0
  45. data/lib/multi_markdown.bundle +0 -0
  46. data/lib/multi_markdown.rb +88 -0
  47. data/lib/multi_markdown/version.rb +6 -0
  48. data/lib/rmultimarkdown.rb +1 -0
  49. data/rmultimarkdown.gemspec +37 -0
  50. data/test/multi_markdown_test.rb +64 -0
  51. metadata +122 -0
@@ -0,0 +1,88 @@
1
+ require 'multi_markdown.so'
2
+ require 'multi_markdown/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
+ # Set `true` to have smarty-like quote translation performed.
17
+ attr_accessor :smart
18
+
19
+ # Set `true` to have footnotes processed.
20
+ attr_accessor :notes
21
+
22
+ # Do not output `<style>` tags included in the source text.
23
+ attr_accessor :filter_styles
24
+
25
+ # Do not output any raw HTML included in the source text.
26
+ attr_accessor :filter_html
27
+
28
+ # Process MultiMarkdown inside of raw HTML
29
+ attr_accessor :process_html
30
+
31
+ # Markdown compatibility mode
32
+ attr_accessor :compatibility
33
+
34
+ # Included for compatibility with RedCloth's interface.
35
+ attr_accessor :fold_lines
36
+
37
+ # Create a new MultiMarkdown processor. The `text` argument is a string
38
+ # containing MultiMarkdown text. Variable other arguments may be supplied to
39
+ # set various processing options:
40
+ #
41
+ # * `:smart` - Enable SmartyPants processing.
42
+ # * `:notes` - Enable footnotes.
43
+ # * `:filter_styles` - Do not output `<style>` tags included in the
44
+ # source text.
45
+ # * `:filter_html` - Do not output raw HTML included in the
46
+ # source text.
47
+ # * `:process_html` - Process MultiMarkdown code inside HTML tags.
48
+ # * `:compatibility` - Process MultiMarkdown code in Markdown
49
+ # compatibility mode (disables all other extensions)
50
+ # * `:fold_lines` - RedCloth compatible line folding (not used).
51
+ #
52
+ def initialize(text, *extensions)
53
+ @text = text
54
+ @smart = true
55
+ @notes = true
56
+ @filter_styles = false
57
+ @filter_html = false
58
+ @process_html = false
59
+ @compatibility = false
60
+ extensions.each { |e| send("#{e}=", true) }
61
+ if @compatibility
62
+ @smart = false
63
+ @notes = false
64
+ @process_html = false
65
+ end
66
+ end
67
+
68
+ alias extract_metadata extract_metadata_value
69
+
70
+ # Returns a Hash cointaining all Metadata
71
+ #
72
+ #
73
+ def metadata(key = nil)
74
+ if @cached_metadata.nil?
75
+ @cached_metadata = {}
76
+ extract_metadata_keys.each do |k|
77
+ @cached_metadata[k.downcase] = extract_metadata_value(k)
78
+ end
79
+ end
80
+
81
+ if key
82
+ @cached_metadata[key.to_s.downcase]
83
+ else
84
+ @cached_metadata.dup
85
+ end
86
+ end
87
+
88
+ end
@@ -0,0 +1,6 @@
1
+ class MultiMarkdown
2
+
3
+ # The ruby 'multimarkdown' gem version
4
+ VERSION = "4.5.2.2"
5
+
6
+ end
@@ -0,0 +1 @@
1
+ require 'multi_markdown'
@@ -0,0 +1,37 @@
1
+ # Copyright 2014 Till Schulte-Coerne
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 "multi_markdown/version"
18
+
19
+ Gem::Specification.new do |s|
20
+ s.name = "rmultimarkdown"
21
+ s.version = MultiMarkdown::VERSION
22
+ s.platform = Gem::Platform::RUBY
23
+ s.authors = ["Till Schulte-Coerne"]
24
+ s.email = ["till.schulte-coerne@innoq.com"]
25
+ s.homepage = "http://github.com/tillsc/multi_markdown"
26
+ s.summary = "A MultiMarkdown 4 binding 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 rmultimarkdown.gemspec) + Dir.glob("{bin,lib,test}/**/*") + Dir.glob("{ext,MultiMarkdown-4}/*.{c,h,rb}")
33
+ s.test_files = Dir.glob("{test}/**/*")
34
+ s.executables = "rmultimarkdown"
35
+ s.extensions = ['ext/extconf.rb']
36
+ s.require_paths = ["lib"]
37
+ end
@@ -0,0 +1,64 @@
1
+ $: << File.join(File.dirname(__FILE__), "../lib")
2
+
3
+ require 'test/unit'
4
+ require 'multi_markdown'
5
+
6
+ class MultiMarkdownTest < Test::Unit::TestCase
7
+
8
+ def test_extension_methods_present_on_multimarkdown_class
9
+ assert MultiMarkdown.instance_methods.include?(:to_html),
10
+ "MultiMarkdown class should respond to #to_html"
11
+ end
12
+
13
+ def test_simple_one_liner_to_html
14
+ multimarkdown = MultiMarkdown.new('Hello World.')
15
+ assert_respond_to multimarkdown, :to_html
16
+ assert_equal "<p>Hello World.</p>", multimarkdown.to_html.strip
17
+ end
18
+
19
+ def test_inline_multimarkdown_to_html
20
+ multimarkdown = MultiMarkdown.new('_Hello World_!')
21
+ assert_respond_to multimarkdown, :to_html
22
+ assert_equal "<p><em>Hello World</em>!</p>", multimarkdown.to_html.strip
23
+ end
24
+
25
+ def test_multimarkdown_in_html_to_html
26
+ multimarkdown = MultiMarkdown.new('Hello <span>_World_</span>!',:process_html)
27
+ assert_respond_to multimarkdown, :to_html
28
+ assert_equal "<p>Hello <span><em>World</em></span>!</p>", multimarkdown.to_html.strip
29
+ end
30
+
31
+ def test_version_fits
32
+ assert MultiMarkdown::VERSION =~ /^#{MultiMarkdown::MMD_VERSION}/,
33
+ "Expected MultiMarkdown's version (#{MultiMarkdown::VERSION}) to start with the C library's version (#{MultiMarkdown::MMD_VERSION})"
34
+ end
35
+
36
+ def test_meta_attributes
37
+ multimarkdown = MultiMarkdown.new(<<-eof)
38
+ meta1: Foo
39
+ meta2: Bar
40
+
41
+ Lorem Ipsum
42
+ eof
43
+ assert_equal ["meta1", "meta2"], multimarkdown.extract_metadata_keys()
44
+
45
+ assert_equal "Foo", multimarkdown.extract_metadata_value("Meta1")
46
+ assert_equal "Bar", multimarkdown.extract_metadata_value("Meta2")
47
+ end
48
+
49
+ def test_cached_metadata
50
+ multimarkdown = MultiMarkdown.new(<<-eof)
51
+ MetaTheMeta1: Foo
52
+ MetaTheMeta2: Bar
53
+
54
+ Lorem Ipsum
55
+ eof
56
+
57
+ assert_equal({"metathemeta1" => "Foo", "metathemeta2" => "Bar"}, multimarkdown.metadata)
58
+
59
+ assert_equal("Foo", multimarkdown.metadata("MetaTheMeta1"))
60
+ assert_equal(nil, multimarkdown.metadata["MetaTheMeta1"])
61
+ end
62
+
63
+
64
+ end
metadata ADDED
@@ -0,0 +1,122 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: rmultimarkdown
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.5.2.2
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Till Schulte-Coerne
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2014-02-28 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: bundler
16
+ requirement: !ruby/object:Gem::Requirement
17
+ none: false
18
+ requirements:
19
+ - - ! '>='
20
+ - !ruby/object:Gem::Version
21
+ version: '0'
22
+ type: :runtime
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
30
+ description: A MultiMarkdown 4 binding for Ruby
31
+ email:
32
+ - till.schulte-coerne@innoq.com
33
+ executables:
34
+ - rmultimarkdown
35
+ extensions:
36
+ - ext/extconf.rb
37
+ extra_rdoc_files:
38
+ - README.md
39
+ - LICENSE
40
+ files:
41
+ - LICENSE
42
+ - README.md
43
+ - Rakefile
44
+ - rmultimarkdown.gemspec
45
+ - bin/rmultimarkdown
46
+ - lib/multi_markdown/version.rb
47
+ - lib/multi_markdown.bundle
48
+ - lib/multi_markdown.rb
49
+ - lib/rmultimarkdown.rb
50
+ - test/multi_markdown_test.rb
51
+ - ext/multi_markdown.c
52
+ - ext/extconf.h
53
+ - ext/extconf.rb
54
+ - MultiMarkdown-4/beamer.c
55
+ - MultiMarkdown-4/critic.c
56
+ - MultiMarkdown-4/GLibFacade.c
57
+ - MultiMarkdown-4/html.c
58
+ - MultiMarkdown-4/latex.c
59
+ - MultiMarkdown-4/lyx.c
60
+ - MultiMarkdown-4/lyxbeamer.c
61
+ - MultiMarkdown-4/memoir.c
62
+ - MultiMarkdown-4/multimarkdown.c
63
+ - MultiMarkdown-4/odf.c
64
+ - MultiMarkdown-4/opml.c
65
+ - MultiMarkdown-4/parse_utilities.c
66
+ - MultiMarkdown-4/parser.c
67
+ - MultiMarkdown-4/rng.c
68
+ - MultiMarkdown-4/rtf.c
69
+ - MultiMarkdown-4/strtok.c
70
+ - MultiMarkdown-4/text.c
71
+ - MultiMarkdown-4/transclude.c
72
+ - MultiMarkdown-4/writer.c
73
+ - MultiMarkdown-4/beamer.h
74
+ - MultiMarkdown-4/critic.h
75
+ - MultiMarkdown-4/glib.h
76
+ - MultiMarkdown-4/GLibFacade.h
77
+ - MultiMarkdown-4/html.h
78
+ - MultiMarkdown-4/latex.h
79
+ - MultiMarkdown-4/libMultiMarkdown.h
80
+ - MultiMarkdown-4/lyx.h
81
+ - MultiMarkdown-4/lyxbeamer.h
82
+ - MultiMarkdown-4/memoir.h
83
+ - MultiMarkdown-4/odf.h
84
+ - MultiMarkdown-4/opml.h
85
+ - MultiMarkdown-4/parser.h
86
+ - MultiMarkdown-4/rtf.h
87
+ - MultiMarkdown-4/strtok.h
88
+ - MultiMarkdown-4/text.h
89
+ - MultiMarkdown-4/transclude.h
90
+ - MultiMarkdown-4/writer.h
91
+ homepage: http://github.com/tillsc/multi_markdown
92
+ licenses: []
93
+ post_install_message:
94
+ rdoc_options: []
95
+ require_paths:
96
+ - lib
97
+ required_ruby_version: !ruby/object:Gem::Requirement
98
+ none: false
99
+ requirements:
100
+ - - ! '>='
101
+ - !ruby/object:Gem::Version
102
+ version: '0'
103
+ segments:
104
+ - 0
105
+ hash: 219010029404225192
106
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
+ none: false
108
+ requirements:
109
+ - - ! '>='
110
+ - !ruby/object:Gem::Version
111
+ version: '0'
112
+ segments:
113
+ - 0
114
+ hash: 219010029404225192
115
+ requirements: []
116
+ rubyforge_project:
117
+ rubygems_version: 1.8.23
118
+ signing_key:
119
+ specification_version: 3
120
+ summary: A MultiMarkdown 4 binding for Ruby
121
+ test_files:
122
+ - test/multi_markdown_test.rb