vimwiki_markdown 0.7.0 → 0.8.1

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: d4893e1d18542936cff19882c791e51c9d8234cefaaec3751cff7fc9724eb70e
4
- data.tar.gz: 1e51ef4d9df34eb09ad1cf0528efad3b3471e11790a3628594b27224e1560176
3
+ metadata.gz: df82303f4e7c42a37b10f251dc47ff99f7f8bdb47213320647ec9e287b18e349
4
+ data.tar.gz: 87779ad8e73e817a491a4b02d5dfdee31c0486c6c53a71a3f7777f8eea039326
5
5
  SHA512:
6
- metadata.gz: d4301871b6d662d7f02c8c549dcdcd239633183f4bfb9a05f3c04c6d40405778da03ef88948a1d954a0d6b6b41c2c4df3a43602f2d3673108cbf1402b484442e
7
- data.tar.gz: 908c6005ba6107459aa00297331a62eac008ccc88e4feb526943225d01dd6bdbd21307db1466303424a9fb0378c03cd29f7ca6a586b1274e82b39264739728d1
6
+ metadata.gz: ae0332624f846dd12436ea09f2c01b57a1f3828161304cd422dbbb5525fadacdf3c3681675901478ee92a06566cff7fdbb946e7dee68e64fbe053cf67a055cdf
7
+ data.tar.gz: 39d46583937bcea223d642b8432ea555de284d8e4e0f623ab38681f39cd66fce12982cdcb526591aaccf547bdf88c9f2fefc11e0d19910fe986fb59f9e5ba456
data/changelog.md CHANGED
@@ -1,3 +1,17 @@
1
+ ## 0.8.1 [March 7 2022]
2
+ Update commonmarker version, fixes security issue!
3
+
4
+ ## 0.8.0 [March 7 2022]
5
+ Fixes an issue where VimwikiTOC generated table of contents where there are duplicate heading names did not match the output HTML from the Github pipeline.
6
+
7
+ This means any generated (dupliate) bookmarks are going to be broken though, so, this is backwardly incompatible
8
+
9
+ see https://github.com/patrickdavey/vimwiki_markdown/pull/39
10
+
11
+ ## 0.7.0 [July 8 2021]
12
+ Fixes an issue whereby non english filenames were being replaced with empty strings
13
+ see https://github.com/patrickdavey/vimwiki_markdown/pull/35
14
+
1
15
  ## 0.6.0 [April 26 2020]
2
16
  Support for todo lists with enhanced state options. Thanks to @primercuervo
3
17
 
@@ -1,3 +1,3 @@
1
1
  module VimwikiMarkdown
2
- VERSION = "0.7.0"
2
+ VERSION = "0.8.1"
3
3
  end
@@ -0,0 +1,32 @@
1
+ class VimwikiTOCFilter < HTML::Pipeline::TableOfContentsFilter
2
+ def call
3
+ result[:toc] = String.new('')
4
+
5
+ headers = Hash.new(1)
6
+ doc.css('h1, h2, h3, h4, h5, h6').each do |node|
7
+ text = node.text
8
+ id = ascii_downcase(text)
9
+ id.gsub!(PUNCTUATION_REGEXP, '') # remove punctuation
10
+ id.tr!(' ', '-') # replace spaces with dash
11
+
12
+ uniq = headers[id] > 1 ? "-#{headers[id]}" : ''
13
+ headers[id] += 1
14
+ if header_content = node.children.first
15
+ result[:toc] << %(<li><a href="##{id}#{uniq}">#{EscapeUtils.escape_html(text)}</a></li>\n)
16
+ header_content.add_previous_sibling(%(<a id="#{id}#{uniq}" class="anchor" href="##{id}#{uniq}" aria-hidden="true">#{anchor_icon}</a>))
17
+ end
18
+ end
19
+ result[:toc] = %(<ul class="section-nav">\n#{result[:toc]}</ul>) unless result[:toc].empty?
20
+ doc
21
+ end
22
+
23
+ if RUBY_VERSION >= '2.4'
24
+ def ascii_downcase(str)
25
+ str.downcase(:ascii)
26
+ end
27
+ else
28
+ def ascii_downcase(str)
29
+ str.downcase
30
+ end
31
+ end
32
+ end
@@ -3,6 +3,7 @@ require 'github/markup'
3
3
  require 'html/pipeline'
4
4
  require 'pathname'
5
5
  require "vimwiki_markdown/vimwiki_link"
6
+ require "vimwiki_markdown/vimwiki_toc_filter"
6
7
 
7
8
  class VimwikiMarkdown::WikiBody
8
9
 
@@ -23,7 +24,7 @@ class VimwikiMarkdown::WikiBody
23
24
 
24
25
  pipeline = HTML::Pipeline.new([
25
26
  HTML::Pipeline::SyntaxHighlightFilter,
26
- HTML::Pipeline::TableOfContentsFilter
27
+ VimwikiTOCFilter
27
28
  ], { scope: "highlight"})
28
29
  @result = pipeline.call(html)
29
30
  @result = @result[:output].to_s
@@ -29,7 +29,7 @@ Gem::Specification.new do |spec|
29
29
 
30
30
  spec.add_runtime_dependency "activesupport", "~> 4.1"
31
31
  spec.add_runtime_dependency "github-markup", "~> 3.0"
32
- spec.add_runtime_dependency "commonmarker", "~> 0.20"
32
+ spec.add_runtime_dependency "commonmarker", "~> 0.23.4"
33
33
  spec.add_runtime_dependency "html-pipeline", "~> 2.0"
34
34
  spec.add_runtime_dependency "rouge", "~> 3.3"
35
35
  spec.add_runtime_dependency "escape_utils", "~> 1.2"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimwiki_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.7.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Davey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-07-08 00:00:00.000000000 Z
11
+ date: 2022-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -156,14 +156,14 @@ dependencies:
156
156
  requirements:
157
157
  - - "~>"
158
158
  - !ruby/object:Gem::Version
159
- version: '0.20'
159
+ version: 0.23.4
160
160
  type: :runtime
161
161
  prerelease: false
162
162
  version_requirements: !ruby/object:Gem::Requirement
163
163
  requirements:
164
164
  - - "~>"
165
165
  - !ruby/object:Gem::Version
166
- version: '0.20'
166
+ version: 0.23.4
167
167
  - !ruby/object:Gem::Dependency
168
168
  name: html-pipeline
169
169
  requirement: !ruby/object:Gem::Requirement
@@ -236,6 +236,7 @@ files:
236
236
  - lib/vimwiki_markdown/template.rb
237
237
  - lib/vimwiki_markdown/version.rb
238
238
  - lib/vimwiki_markdown/vimwiki_link.rb
239
+ - lib/vimwiki_markdown/vimwiki_toc_filter.rb
239
240
  - lib/vimwiki_markdown/wiki_body.rb
240
241
  - spec/lib/vimwiki_markdown/options_spec.rb
241
242
  - spec/lib/vimwiki_markdown/template_spec.rb