vimwiki_markdown 0.5.1 → 0.6.0

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: 6acc95dd6a5614bd65208e682f3f92c60c19c48db675a27e21fdfb619ab4a97d
4
- data.tar.gz: e122a4b7e074c092bcb503c019441fe3c5e25c3d5fd6de03a97f95810e32ed13
3
+ metadata.gz: 94fcdf721504210b46ed56769e3529838982092414094c950ccddaa747086f9f
4
+ data.tar.gz: 219b35ea5da34b1cf75f962432073a8f97c972a62d14403b35dfae442f98b794
5
5
  SHA512:
6
- metadata.gz: c116b7dd75f305b1a7bdcdbc1eb5a952e2c95c6d78f236683a3cd96900f8b3d2c6b5843e1e7d37f5f2ec6bf2aca46b65d419ae1ec81583541a937868a033b390
7
- data.tar.gz: 4babd45bcc33303e45a0b46f909456733fc6c1be8d1cc24c3cdc1fdaaa4fd3d61762364fe050910e601da552149f9f6a2bbcbafe69be213f3d8b1d4ede2776ef
6
+ metadata.gz: 5c51b9de26115ee93f512404af7e84544088406df98a4c0861095da736dd78821f12e59b40e639f7bbea13f20bc460eb14bf9b4daa911c3bd00202ccd587f1e9
7
+ data.tar.gz: 5ccfb995fa5e7966379fc34dc40a0799614bf59b59d780fc0932a413a3876bebccdbc3bf4166cbda209a9e8bbc78593673816a44b4a5768cc90a80e6fc33f958
data/README.md CHANGED
@@ -56,13 +56,16 @@ of the site (e.g. `./` or `../../` etc)
56
56
  You can also have a `%date%` marker in your template file
57
57
  It will get rewritten with todays date in the format 29 March 2019
58
58
 
59
+ #### Support for tasklists
60
+ Vimwiki has support for complex todo lists which you can [read about in their help.txt](https://github.com/vimwiki/vimwiki/blob/619f04f89861c58e5a6415a4f83847752928252d/doc/vimwiki.txt#L1768). We do support turning them into HTML. This is _slightly different_ from the way that GitHub checklists are rendered, but, the syntax is a subset of GitHub lists so it should be fine. You can read about it in the [issue](https://github.com/patrickdavey/vimwiki_markdown/issues/27), but basically it should work fine. You will want to add `styles` in for the various states that the todo lists can be in. The easiest way is to simply add the `styles` into your template. You can see the styles [in the sample template here](https://github.com/patrickdavey/vimwiki_markdown/blob/293f99e656819b9c5ecc0c831698ce58904eb774/example_files/default.tpl#L7-L45)
61
+
59
62
  #### Support for :local and :file links
60
63
 
61
64
  We have partial support for the `:local` and `:file` link types for vimwiki.
62
65
  If you are editing `foo.md` (in the root dir of your wiki) and you are linking to `bar.txt` stored in the same directory as `foo.md` you can do:
63
66
 
64
- * `[link text](local:bar.txt)` when output to HTML becomes <a href="../bar.txt">link text</a>
65
- * `[link text](file:bar.txt)` when output to HTML becomes <a href="/absolute/path/to/file">link text</a>
67
+ * `[link text](local:bar.txt)` when output to HTML becomes `<a href="../bar.txt">link text</a>`
68
+ * `[link text](file:bar.txt)` when output to HTML becomes `<a href="/absolute/path/to/file">link text</a>`
66
69
 
67
70
  #### Optional %nohtml
68
71
 
@@ -1,5 +1,8 @@
1
+ ## 0.6.0 [April 26 2020]
2
+ Support for todo lists with enhanced state options. Thanks to @primercuervo
3
+
1
4
  ## 0.5.0 [April 26 2020]
2
- Partial support for `local` and `file` links in urls. Thanks to @tfachmann for [the PR](https://github.com/patrickdavey/vimwiki_markdown/pull/26).
5
+ Partial support for `local` and `file` links in urls. Thanks to @tfachmann for the PR
3
6
 
4
7
  ## 0.4.4 [June 16 2019]
5
8
  Allow fragments if they are for local vimwiki links only
@@ -4,6 +4,45 @@
4
4
  <title>%title%</title>
5
5
 
6
6
  %pygments%
7
+ <!--Style for Vimwiki Tasklist-->
8
+ <style>
9
+ .rejected {
10
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAACXBIWXMAAADFAAAAxQEdzbqoAAAAB3RJTUUH4QgEFhAtuWgv9wAAAPZQTFRFmpqam5iYnJaWnJeXnpSUn5OTopCQpoqKpouLp4iIqIiIrYCAt3V1vW1tv2xsmZmZmpeXnpKS/x4e/x8f/yAg/yIi/yQk/yUl/yYm/ygo/ykp/yws/zAw/zIy/zMz/zQ0/zU1/zY2/zw8/0BA/0ZG/0pK/1FR/1JS/1NT/1RU/1VV/1ZW/1dX/1pa/15e/19f/2Zm/2lp/21t/25u/3R0/3p6/4CA/4GB/4SE/4iI/46O/4+P/52d/6am/6ur/66u/7Oz/7S0/7e3/87O/9fX/9zc/93d/+Dg/+vr/+3t/+/v//Dw//Ly//X1//f3//n5//z8////gzaKowAAAA90Uk5T/Pz8/Pz8/Pz8/Pz8/f39ppQKWQAAAAFiS0dEEnu8bAAAAACuSURBVAhbPY9ZF4FQFEZPSKbIMmWep4gMGTKLkIv6/3/GPbfF97b3w17rA0kQOPgvAeHW6uJ6+5h7HqLdwowgOzejXRXBdx6UdSru216xuOMBHHNU0clTzeSUA6EhF8V8kqroluMiU6HKcuf4phGPr1o2q9kYZWwNq1qfRRmTaXpqsyjj17KkWCxKBUBgXWueHIyiAIg18gsse4KHkLF5IKIY10WQgv7fOy4ST34BRiopZ8WLNrgAAAAASUVORK5CYII=);
11
+ background-repeat: no-repeat;
12
+ background-position: 0 .2em;
13
+ padding-left: 5.5em;
14
+ }
15
+ .done0 {
16
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAA7SURBVCiR7dMxEgAgCANBI3yVRzF5KxNbW6wsuH7LQ2YKQK1mkswBVERYF5Os3UV3gwd/jF2SkXy66gAZkxS6BniubAAAAABJRU5ErkJggg==);
17
+ background-repeat: no-repeat;
18
+ background-position: 0 .2em;
19
+ padding-left: 1.5em;
20
+ }
21
+ .done1 {
22
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABtSURBVCiR1ZO7DYAwDER9BDmTeZQMFXmUbGYpOjrEryA0wOvO8itOslFrJYAug5BMM4BeSkmjsrv3aVTa8p48Xw1JSkSsWVUFwD05IqS1tmYzk5zzae9jnVVVzGyXb8sALjse+euRkEzu/uirFomVIdDGOLjuAAAAAElFTkSuQmCC);
23
+ background-repeat: no-repeat;
24
+ background-position: 0 .15em;
25
+ padding-left: 1.5em;
26
+ }
27
+ .done2 {
28
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAB1SURBVCiRzdO5DcAgDAVQGxjAYgTvxlDIu1FTIRYAp8qlFISkSH7l5kk+ZIwxKiI2mIyqWoeILYRgZ7GINDOLjnmF3VqklKCUMgTee2DmM661Qs55iI3Zm/1u5h9sm4ig9z4ERHTFzLyd4G4+nFlVrYg8+qoF/c0kdpeMsmcAAAAASUVORK5CYII=);
29
+ background-repeat: no-repeat;
30
+ background-position: 0 .15em;
31
+ padding-left: 1.5em;
32
+ }
33
+ .done3 {
34
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAYAAAA71pVKAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAxQAAAMUBHc26qAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAABoSURBVCiR7dOxDcAgDATA/0DtUdiKoZC3YhLkHjkVKF3idJHiztKfvrHZWnOSE8Fx95RJzlprimJVnXktvXeY2S0SEZRSAAAbmxnGGKH2I5T+8VfxPhIReQSuuY3XyYWa3T2p6quvOgGrvSFGlewuUAAAAABJRU5ErkJggg==);
35
+ background-repeat: no-repeat;
36
+ background-position: 0 .15em;
37
+ padding-left: 1.5em;
38
+ }
39
+ .done4 {
40
+ background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABIAAAAQCAYAAAAbBi9cAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAAzgAAAM4BlP6ToAAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAIISURBVDiNnZQ9SFtRFMd/773kpTaGJoQk1im4VDpWQcTNODhkFBcVTCNCF0NWyeDiIIiCm82QoIMIUkHUxcFBg1SEQoZszSat6cdTn1qNue92CMbEr9Sey+XC/Z/zu+f8h6ukUil3sVg0+M+4cFxk42/jH2wAqqqKSCSiPQdwcHHAnDHH9s/tN1h8V28ETdP+eU8fT9Nt62ancYdIPvJNtsu87bmjrJlrTDVM4RROJs1JrHPrD4Bar7A6cpc54iKOaTdJXCUI2UMVrQZ0Js7YPN18ECKkYNQcJe/OE/4dZsw7VqNXQMvHy3QZXQypQ6ycrtwDjf8aJ+PNEDSCzLpn7+m2pD8ZKHlKarYhy6XjEoCYGcN95qansQeA3fNdki+SaJZGTMQIOoL3W/Z89rxv+tokubNajlvk/vm+LFpF2XnUKZHI0I+QrI7Dw0OZTqdzUkpsM7mZTyfy5OPGyw1tK7AFSvmB/Ks8w8YwbUYbe6/3QEKv0vugfxWPnMLJun+d/kI/WLdizpNjMbAIKrhMF4OuwadBALqqs+RfInwUvuNi+fBd+wjogfogAFVRmffO02q01mZZ0HHdgXIzdz0QQLPezIQygX6llxNKKgOFARYCC49CqhoHIUTlss/Vx2phlYwjw8j1CAlfAiwQiJpiy7o1VHnsG5FISkoJu7Q/2YmmaV+i0ei7v38L2CBguSi5AAAAAElFTkSuQmCC);
41
+ background-repeat: no-repeat;
42
+ background-position: 0 .15em;
43
+ padding-left: 1.5em;
44
+ }
45
+ </style>
7
46
  </head>
8
47
  <body id="%title%">
9
48
  <h2 id="title">%title%</h2>
@@ -1,3 +1,3 @@
1
1
  module VimwikiMarkdown
2
- VERSION = "0.5.1"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -25,8 +25,9 @@ class VimwikiMarkdown::WikiBody
25
25
  HTML::Pipeline::SyntaxHighlightFilter,
26
26
  HTML::Pipeline::TableOfContentsFilter
27
27
  ], { scope: "highlight"})
28
- result = pipeline.call(html)
29
- result[:output].to_s
28
+ @result = pipeline.call(html)
29
+ @result = @result[:output].to_s
30
+ enrich_li_class!
30
31
  end
31
32
 
32
33
 
@@ -74,4 +75,15 @@ class VimwikiMarkdown::WikiBody
74
75
  CommonMarker.render_html(content, commonmarker_opts, commonmarker_exts)
75
76
  }
76
77
  end
78
+
79
+ def enrich_li_class!
80
+ syms_hash = { " ]" => 0, ".]" => 1, "o]" => 2, "O]" => 3, "X]" => 4 }
81
+ checkbox = /<li>\s*\[[\s.oOX]\]/
82
+ checkbox_start = /<li>\s*\[/
83
+ @result.gsub!(checkbox) do |m|
84
+ m.sub(checkbox_start, '<li class="done')
85
+ .sub(/[\s.oOX\]]*$/, syms_hash) << '">'
86
+ end
87
+ @result
88
+ end
77
89
  end
@@ -52,6 +52,36 @@ module VimwikiMarkdown
52
52
  expect(wiki_body.to_s).to match(/<a href="there.html">there<\/a>/)
53
53
  end
54
54
 
55
+ it "must enrich task list unchecked" do
56
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
57
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("- [ ] This is one line")
58
+ expect(wiki_body.to_s).to match(/<li class="done0"> This is one line<\/li>/)
59
+ end
60
+
61
+ it "must enrich task list checked" do
62
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
63
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("- [X] This is a checked line")
64
+ expect(wiki_body.to_s).to match(/<li class="done4"> This is a checked line<\/li>/)
65
+ end
66
+
67
+ it "must enrich task list parent 1" do
68
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
69
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("- [.] This is a parent 1 line")
70
+ expect(wiki_body.to_s).to match(/<li class="done1"> This is a parent 1 line<\/li>/)
71
+ end
72
+
73
+ it "must enrich task list parent 2" do
74
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
75
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("- [o] This is a parent 2 line")
76
+ expect(wiki_body.to_s).to match(/<li class="done2"> This is a parent 2 line<\/li>/)
77
+ end
78
+
79
+ it "must enrich task list parent 3" do
80
+ allow_any_instance_of(VimwikiMarkdown::VimwikiLink).to receive(:vimwiki_markdown_file_exists?).and_return(true)
81
+ allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return("- [O] This is a parent 3 line")
82
+ expect(wiki_body.to_s).to match(/<li class="done3"> This is a parent 3 line<\/li>/)
83
+ end
84
+
55
85
  describe "syntax highlighting" do
56
86
  it "must give correct classes" do
57
87
  allow(wiki_body).to receive(:get_wiki_markdown_contents)
@@ -107,6 +107,28 @@ def wiki_index_markdown
107
107
 
108
108
  > this is a blockquote
109
109
  > without a linebreak
110
+
111
+ ## Test for checks
112
+
113
+ - [ ] This is one line
114
+ - [X] This is a checked line
115
+ - [ ] This is a parent line 1
116
+ - [ ] This is a child line 1
117
+ - [ ] This is a child line 2
118
+ - [.] This is a parent line 2
119
+ - [X] This is a child line 1
120
+ - [ ] This is a child line 2
121
+ - [ ] This is a child line 3
122
+ - [o] This is a parent line 2
123
+ - [X] This is a child line 1
124
+ - [X] This is a child line 2
125
+ - [ ] This is a child line 3
126
+ - [O] This is a parent line 3
127
+ - [X] This is a child line 1
128
+ - [X] This is a child line 2
129
+ - [X] This is a child line 3
130
+ - [ ] This is a child line 4
131
+
110
132
  "
111
133
  end
112
134
 
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ["lib"]
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.0"
22
- spec.add_development_dependency "rake", "~> 11.2"
22
+ spec.add_development_dependency "rake", "~> 12.3"
23
23
  spec.add_development_dependency "rspec", "~> 3.0"
24
24
  spec.add_development_dependency "pry", "~> 0.12"
25
25
  spec.add_development_dependency "rspec-its", "~> 1.1"
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.5.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Davey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-25 00:00:00.000000000 Z
11
+ date: 2020-06-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '11.2'
33
+ version: '12.3'
34
34
  type: :development
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: '11.2'
40
+ version: '12.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rspec
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -260,8 +260,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
260
  - !ruby/object:Gem::Version
261
261
  version: '0'
262
262
  requirements: []
263
- rubyforge_project:
264
- rubygems_version: 2.7.9
263
+ rubygems_version: 3.0.4
265
264
  signing_key:
266
265
  specification_version: 4
267
266
  summary: Converts a github flavoured markdown vimwiki file into html.