html-pipeline-asciidoc_filter 1.5.0 → 1.5.2

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
  SHA1:
3
- metadata.gz: 5901d9931bfbdf81b3bab66bd246019233e70fc0
4
- data.tar.gz: 9aa593c80be0c7b19be53afd38be83af70f522a9
3
+ metadata.gz: 1cb83a426252b29fbe2cdb669cd77c7f26cd2a24
4
+ data.tar.gz: a396de19feb3671cfda7d43b0daf0b0f0aaca8e2
5
5
  SHA512:
6
- metadata.gz: 623ab2f5ada3e0ce8de5b96c87f0c11a6ebe436954163beca85029991b72b15da0a0eec5ce42945431bcecbd4644f669f83b4b4be336a68be2c917df85d4cc92
7
- data.tar.gz: 403757cdfdc92971bff5d9839f5f51d961fcd2271c0dc1d81a252d8fc1de5052afced57bdd1d4df044c20806efeb00b3fe789a88373724fcdfc6f7016d92811d
6
+ metadata.gz: 5508bdf750c784bf569c4602589b7bc88c5c49642d39dec181080402bdb62c71ee874bd3db68d3d088e78a5eb541346d94c06a436adbafa496ef843516792647
7
+ data.tar.gz: 0d23908f882de071c3b43b3f49ef8c751a687e83868689c844906e669e3bbe31b85e82c39839cc31e86bee1434bc11d6be76ca1915f665d2c63c1adac93db231
data/examples/Gemfile CHANGED
@@ -1,7 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
- gem 'html-pipeline', '1.9.0'
4
- gem 'asciidoctor', '0.1.4'
3
+ gem 'html-pipeline', '1.11.0'
4
+ gem 'asciidoctor', '1.5.2'
5
5
  gem 'gemoji', '~> 1.0'
6
6
  gem 'rinku', '~> 1.7'
7
7
  gem 'sanitize', '~> 2.0'
data/examples/example.rb CHANGED
@@ -8,12 +8,17 @@ filters = [
8
8
  HTML::Pipeline::EmojiFilter,
9
9
  HTML::Pipeline::MentionFilter,
10
10
  HTML::Pipeline::AutolinkFilter,
11
- HTML::Pipeline::TableOfContentsFilter,
12
- HTML::Pipeline::SyntaxHighlightFilter
11
+ HTML::Pipeline::TableOfContentsFilter
13
12
  ]
14
13
 
14
+ begin
15
+ require 'linguist'
16
+ filters << HTML::Pipeline::SyntaxHighlightFilter
17
+ rescue LoadError
18
+ end
19
+
15
20
  context = {
16
- :asset_root => 'https://github.global.ssl.fastly.net/images/icons/emoji'
21
+ :asset_root => 'https://assets-cdn.github.com/images/icons'
17
22
  }
18
23
 
19
24
  pipeline = HTML::Pipeline.new filters, context
@@ -38,10 +43,28 @@ Section content.
38
43
  --
39
44
  require 'asciidoctor'
40
45
 
41
- puts Asciidoctor.render('This filter brought to you by http://asciidoctor.org[Asciidoctor].')
46
+ puts Asciidoctor.convert('This filter brought to you by http://asciidoctor.org[Asciidoctor].')
42
47
  --
43
48
 
44
- :shipit:
49
+ See <<Sample Section>>.
50
+
51
+ [normal]
52
+ :ship:
45
53
  EOS
46
54
 
47
- puts pipeline.call(input)[:output]
55
+ puts <<-EOS
56
+ <!DOCTYPE html>
57
+ <html>
58
+ <head>
59
+ <link rel="stylesheet" href="https://assets-cdn.github.com/assets/github-2a88a7bf0ff1b660d7ff29c3220a68751650b37fc53d40d3a7068e835fd213ec.css">
60
+ <link rel="stylesheet" href="https://assets-cdn.github.com/assets/github2-ee4170e0122d252766e3edc8c97b6cc6ae381c974013b5047ed5ad8895c56fe0.css">
61
+ </head>
62
+ <body>
63
+ <div id="readme">
64
+ <article class="markdown-body entry-content">
65
+ #{pipeline.call(input)[:output]}
66
+ </article>
67
+ </div>
68
+ </body>
69
+ </html>
70
+ EOS
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(/^test\//)
18
18
  gem.require_paths = ['lib']
19
19
 
20
- gem.add_dependency 'html-pipeline', '~> 1.9.0'
21
- gem.add_dependency 'asciidoctor', '~> 1.5.0'
20
+ gem.add_dependency 'html-pipeline', '~> 1.11.0'
21
+ gem.add_dependency 'asciidoctor', '~> 1.5.2'
22
22
  end
@@ -2,6 +2,8 @@ require 'asciidoctor'
2
2
  require 'html/pipeline/filter'
3
3
  require 'html/pipeline/text_filter'
4
4
 
5
+ Asciidoctor::Compliance.unique_id_start_index = 1
6
+
5
7
  class HTML::Pipeline
6
8
  # HTML Filter that converts AsciiDoc text into HTML.
7
9
  #
@@ -2,6 +2,6 @@
2
2
  # and we don't want to define it here inadvertently
3
3
  module HTML_Pipeline
4
4
  class AsciiDocFilter
5
- VERSION = '1.5.0'
5
+ VERSION = '1.5.2'
6
6
  end
7
7
  end
@@ -25,6 +25,18 @@ Author Name
25
25
  Paragraph content
26
26
  EOS
27
27
 
28
+ @duplicate_heading_example = <<-EOS
29
+ = Sample Document
30
+
31
+ == Section Heading
32
+
33
+ content
34
+
35
+ == Section Heading
36
+
37
+ content
38
+ EOS
39
+
28
40
  @source_code_example = <<-EOS
29
41
  ```ruby
30
42
  def hello()
@@ -32,6 +44,28 @@ def hello()
32
44
  end
33
45
  ```
34
46
  EOS
47
+
48
+ @checklist_example = <<-EOS
49
+ * [ ] todo
50
+ * [x] done
51
+ EOS
52
+
53
+ @compatibility_example = <<-EOS
54
+ `monospaced`
55
+
56
+ +{empty}+
57
+
58
+ `+{blank}+`
59
+ EOS
60
+ end
61
+
62
+ def test_for_document_structure
63
+ result = {}
64
+ AsciiDocPipeline.call(@doctitle_example, {}, result)
65
+ output = result[:output]
66
+ assert_equal 1, output.css('h1').size
67
+ assert_equal 1, output.css('h2').size
68
+ assert_equal 2, output.css('p').size
35
69
  end
36
70
 
37
71
  def test_for_document_title
@@ -49,6 +83,14 @@ end
49
83
  assert_equal 1, doc.css('.paragraph p').size
50
84
  end
51
85
 
86
+ def test_for_id_deduplication_count
87
+ doc = AsciiDocFilter.to_document(@duplicate_heading_example)
88
+ assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
89
+ assert_equal 1, doc.css('h2#section-heading').size
90
+ assert_equal 1, doc.css('h2#section-heading-1').size
91
+ assert_equal 0, doc.css('h2#section-heading-2').size
92
+ end
93
+
52
94
  def test_for_lang_attribute_on_source_code_block
53
95
  doc = AsciiDocFilter.to_document(@source_code_example)
54
96
  assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
@@ -78,12 +120,26 @@ end
78
120
  </div>), result[:output].to_s
79
121
  end
80
122
 
81
- def test_for_document_structure
123
+ def test_for_checklist_markers
82
124
  result = {}
83
- AsciiDocPipeline.call(@doctitle_example, {}, result)
84
- output = result[:output]
85
- assert_equal 1, output.css('h1').size
86
- assert_equal 1, output.css('h2').size
87
- assert_equal 2, output.css('p').size
125
+ AsciiDocPipeline.call(@checklist_example, {}, result)
126
+ fragment = result[:output]
127
+ assert fragment.kind_of?(HTML::Pipeline::DocumentFragment)
128
+ output = fragment.to_s
129
+ assert output.include?(%(#{entity 10063} todo))
130
+ assert output.include?(%(#{entity 10003} done))
131
+ end
132
+
133
+ def test_for_compat_mode_off_by_default
134
+ doc = AsciiDocFilter.to_document(@compatibility_example)
135
+ assert doc.kind_of?(HTML::Pipeline::DocumentFragment)
136
+ assert_equal 2, doc.css('code').size
137
+ assert_equal 'monospaced', doc.css('code')[0].text
138
+ assert_equal '{blank}', doc.css('code')[1].text
139
+ assert_equal '{empty}', doc.css('p')[1].text
140
+ end
141
+
142
+ def entity(number)
143
+ [number].pack('U*')
88
144
  end
89
145
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: html-pipeline-asciidoc_filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.0
4
+ version: 1.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan Allen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-17 00:00:00.000000000 Z
11
+ date: 2014-12-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: html-pipeline
@@ -16,28 +16,28 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: 1.9.0
19
+ version: 1.11.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: 1.9.0
26
+ version: 1.11.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: asciidoctor
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ~>
32
32
  - !ruby/object:Gem::Version
33
- version: 1.5.0
33
+ version: 1.5.2
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - ~>
39
39
  - !ruby/object:Gem::Version
40
- version: 1.5.0
40
+ version: 1.5.2
41
41
  description: An AsciiDoc processing filter for html-pipeline powered by Asciidoctor
42
42
  email:
43
43
  - dan.j.allen@gmail.com
@@ -74,7 +74,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
74
  version: '0'
75
75
  requirements: []
76
76
  rubyforge_project:
77
- rubygems_version: 2.2.2
77
+ rubygems_version: 2.4.3
78
78
  signing_key:
79
79
  specification_version: 4
80
80
  summary: An AsciiDoc processing filter for html-pipeline powered by Asciidoctor