github-markup 3.0.4 → 3.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73045cfbb77a29fb57c75a078223e159987e9a94f322e3576e25d737947d2d6f
4
- data.tar.gz: 0ad5872c59d15208af1be39b165634f29e7719de546dbaf3f14da47ac21f224f
3
+ metadata.gz: ed10cd1dbc1a7163fdf02e5cb7ee8ca2a7b2fca74f740b862c051aee1bc1547b
4
+ data.tar.gz: f0bda9286bc09c5409e805d20ac67c5f0d5ea25e41b97e3512526597c439a573
5
5
  SHA512:
6
- metadata.gz: 7687ca88baf80f98ba8bba10ba4ce5ab0ac909accfbb54dae340ceebf90f8ba0df36428b32b64c3850f0734b62b4e8573e5c005c85eb33c1d389272d6009805a
7
- data.tar.gz: d33b942a879b556ac9e56913ea287ac64c9d702556a600c8bb8ba3a6c05f11641f846379cbbf504ce65568c98cf05ef1cda5a8d8932dcd99c37b29cea28da7b4
6
+ metadata.gz: f2b9ce502ae753a9cdc2559803d4e3dc24a578f09de84ff4899a886e3252a4ec89a9fb045f0c69ca2ba440638e552487c7f51ddeb56c32f6a9841fdd52f777aa
7
+ data.tar.gz: 2031883234215ba63e23c4f7be7aef7daf8b270ce4ce82a5723caca12a32182beea84046db399ee551e34df72a1bbdd3340407f3c54e1ee13300e3111bf17578
data/HISTORY.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 3.0.5 - 2020-11-12
2
+
3
+ * Add commonmarker_exts to commonmarker options [#1268](https://github.com/github/markup/pull/1268)
4
+ * Check whether filename is set when rendering Asciidoc. [#1290](https://github.com/github/markup/pull/1290)
5
+
1
6
  ## 3.0.4 - 2019-04-03
2
7
 
3
8
  * Expose options in #render_s [#1249](https://github.com/github/markup/pull/1249)
@@ -4,8 +4,10 @@ Gem::Specification.new do |s|
4
4
  s.name = "github-markup"
5
5
  s.version = GitHub::Markup::VERSION
6
6
  s.summary = "The code GitHub uses to render README.markup"
7
- s.description = "This gem is used by GitHub to render any fancy markup such " +
8
- "as Markdown, Textile, Org-Mode, etc. Fork it and add your own!"
7
+ s.description = <<~DESC
8
+ This gem is used by GitHub to render any fancy markup such as Markdown,
9
+ Textile, Org-Mode, etc. Fork it and add your own!
10
+ DESC
9
11
  s.authors = ["Chris Wanstrath"]
10
12
  s.email = "chris@ozmm.org"
11
13
  s.homepage = "https://github.com/github/markup"
@@ -21,7 +23,7 @@ Gem::Specification.new do |s|
21
23
  s.add_development_dependency 'activesupport', '~> 4.0'
22
24
  s.add_development_dependency 'minitest', '~> 5.4', '>= 5.4.3'
23
25
  s.add_development_dependency 'html-pipeline', '~> 1.0'
24
- s.add_development_dependency 'sanitize', '~> 2.1', '>= 2.1.0'
26
+ s.add_development_dependency 'sanitize', '>= 4.6.3'
25
27
  s.add_development_dependency 'nokogiri', '~> 1.8.1'
26
28
  s.add_development_dependency 'nokogiri-diff', '~> 0.2.0'
27
29
  s.add_development_dependency "github-linguist", ">= 7.1.3"
@@ -1,6 +1,6 @@
1
1
  module GitHub
2
2
  module Markup
3
- VERSION = '3.0.4'
3
+ VERSION = '3.0.5'
4
4
  Version = VERSION
5
5
  end
6
6
  end
@@ -6,7 +6,8 @@ module GitHub
6
6
  MARKDOWN_GEMS = {
7
7
  "commonmarker" => proc { |content, options: {}|
8
8
  commonmarker_opts = [:GITHUB_PRE_LANG].concat(options.fetch(:commonmarker_opts, []))
9
- CommonMarker.render_html(content, commonmarker_opts, [:tagfilter, :autolink, :table, :strikethrough])
9
+ commonmarker_exts = options.fetch(:commonmarker_exts, [:tagfilter, :autolink, :table, :strikethrough])
10
+ CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
10
11
  },
11
12
  "github/markdown" => proc { |content, options: {}|
12
13
  GitHub::Markdown.render(content)
@@ -33,13 +33,16 @@ markup(::GitHub::Markups::MARKUP_ASCIIDOC, :asciidoctor, /adoc|asc(iidoc)?/, ["A
33
33
  'idprefix' => '',
34
34
  'idseparator' => '-',
35
35
  'sectanchors' => nil,
36
- 'docname' => File.basename(filename, (extname = File.extname(filename))),
37
- 'docfilesuffix' => extname,
38
- 'outfilesuffix' => extname,
39
36
  'env' => 'github',
40
37
  'env-github' => '',
41
38
  'source-highlighter' => 'html-pipeline'
42
39
  }
40
+ if filename
41
+ attributes['docname'] = File.basename(filename, (extname = File.extname(filename)))
42
+ attributes['docfilesuffix'] = attributes['outfilesuffix'] = extname
43
+ else
44
+ attributes['outfilesuffix'] = '.adoc'
45
+ end
43
46
  Asciidoctor::Compliance.unique_id_start_index = 1
44
47
  Asciidoctor.convert(content, :safe => :secure, :attributes => attributes)
45
48
  end
@@ -94,7 +94,10 @@ message
94
94
  end
95
95
 
96
96
  def test_rendering_by_symbol
97
- assert_equal '<p><code>test</code></p>', GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, '`test`').strip
97
+ markup = '`test`'
98
+ result = /<p><code>test<\/code><\/p>/
99
+ assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, markup).strip
100
+ assert_match result, GitHub::Markup.render_s(GitHub::Markups::MARKUP_ASCIIDOC, markup).split.join
98
101
  end
99
102
 
100
103
  def test_raises_error_if_command_exits_non_zero
@@ -120,5 +123,11 @@ message
120
123
 
121
124
  assert_equal "<p>hello <!-- raw HTML omitted --> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world")
122
125
  assert_equal "<p>hello <bad> world</p>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "hello <bad> world", options: {commonmarker_opts: [:UNSAFE]})
126
+
127
+ assert_equal "&lt;style>.red{color: red;}&lt;/style>\n", GitHub::Markup.render("test.md", "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE]})
128
+ assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render("test.md", "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]})
129
+
130
+ assert_equal "&lt;style>.red{color: red;}&lt;/style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE]})
131
+ assert_equal "<style>.red{color: red;}</style>\n", GitHub::Markup.render_s(GitHub::Markups::MARKUP_MARKDOWN, "<style>.red{color: red;}</style>", options: {commonmarker_opts: [:UNSAFE], commonmarker_exts: [:autolink, :table, :strikethrough]})
123
132
  end
124
133
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: github-markup
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chris Wanstrath
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-02 00:00:00.000000000 Z
11
+ date: 2020-11-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -76,22 +76,16 @@ dependencies:
76
76
  name: sanitize
77
77
  requirement: !ruby/object:Gem::Requirement
78
78
  requirements:
79
- - - "~>"
80
- - !ruby/object:Gem::Version
81
- version: '2.1'
82
79
  - - ">="
83
80
  - !ruby/object:Gem::Version
84
- version: 2.1.0
81
+ version: 4.6.3
85
82
  type: :development
86
83
  prerelease: false
87
84
  version_requirements: !ruby/object:Gem::Requirement
88
85
  requirements:
89
- - - "~>"
90
- - !ruby/object:Gem::Version
91
- version: '2.1'
92
86
  - - ">="
93
87
  - !ruby/object:Gem::Version
94
- version: 2.1.0
88
+ version: 4.6.3
95
89
  - !ruby/object:Gem::Dependency
96
90
  name: nokogiri
97
91
  requirement: !ruby/object:Gem::Requirement
@@ -134,7 +128,8 @@ dependencies:
134
128
  - - ">="
135
129
  - !ruby/object:Gem::Version
136
130
  version: 7.1.3
137
- description: This gem is used by GitHub to render any fancy markup such as Markdown,
131
+ description: |
132
+ This gem is used by GitHub to render any fancy markup such as Markdown,
138
133
  Textile, Org-Mode, etc. Fork it and add your own!
139
134
  email: chris@ozmm.org
140
135
  executables:
@@ -225,8 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
225
220
  - !ruby/object:Gem::Version
226
221
  version: '0'
227
222
  requirements: []
228
- rubyforge_project:
229
- rubygems_version: 2.7.6
223
+ rubygems_version: 3.0.3
230
224
  signing_key:
231
225
  specification_version: 4
232
226
  summary: The code GitHub uses to render README.markup