vimwiki_markdown 0.3.2 → 0.3.3
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.
- checksums.yaml +4 -4
- data/README.md +14 -12
- data/changelog.md +3 -0
- data/lib/vimwiki_markdown.rb +3 -0
- data/lib/vimwiki_markdown/template.rb +6 -2
- data/lib/vimwiki_markdown/version.rb +1 -1
- data/lib/vimwiki_markdown/wiki_body.rb +0 -1
- data/spec/lib/vimwiki_markdown/options_spec.rb +22 -1
- data/spec/lib/vimwiki_markdown/template_spec.rb +13 -0
- data/spec/spec_helper.rb +1 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3645fe30ab3bb81638bf374ee0299069ceee5680889609a6ae65bba411f1b4a6
|
4
|
+
data.tar.gz: 14e2433a0fdd60bb0cda3a424996746f85b3c07a2c8e846c24a0a4573d52d8ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e3afa0beac17b69d85c6aba84d2f2bf5f63925d84b0bd9867e2c210d151706416bcc330c58695975fde7abfd16934b702769696d7bacdf07d72ac176406004ca
|
7
|
+
data.tar.gz: 6557dfcd016610ddc5360478be922ffbf14ccc31182f4c1dde589800804a632900c89191a12e50132a42c0cda96c46c0abbf3eb34755366a2b0636fd1d475112
|
data/README.md
CHANGED
@@ -28,18 +28,6 @@ this we use the custom_wiki2html parameter. My .vimrc looks like this:
|
|
28
28
|
|
29
29
|
The most important part is the *'custom_wiki2html': 'vimwiki_markdown'*
|
30
30
|
|
31
|
-
### Fix for vimwiki links.
|
32
|
-
In vimwiki at the moment, it deletes any files in the site_html directory which do not match
|
33
|
-
against the markdown files (once they are translated into linked html). Now, in vimwiki_markdown
|
34
|
-
we use ActiveSupports paramaterized method, as it's nicer on links. If you want to have a
|
35
|
-
significant speed up, then you need to patch your vimwiki plugin to not delete files it
|
36
|
-
shouldn't be. Here are links to the relevant bits:
|
37
|
-
|
38
|
-
1. [Add this function](https://github.com/patrickdavey/vimwiki-1/blob/9ebca2182fcf10e1bbf61abc8b4a535ce790480d/autoload/vimwiki/html.vim#L242-247)
|
39
|
-
2. [Make the is_html_uptodate look like this](https://github.com/patrickdavey/vimwiki-1/blob/9ebca2182fcf10e1bbf61abc8b4a535ce790480d/autoload/vimwiki/html.vim#L224-241)
|
40
|
-
3. For the moment, remove the call to deleting files `call s:delete_html_files(path_html)` - will work out a way around that later, not there now.
|
41
|
-
4. Might be some other things, check the diff in the above commits or open an issue.
|
42
|
-
|
43
31
|
### Install issues.
|
44
32
|
There have been some issues with getting dependencies installed. Before opening an issue, please check if you can use [rvm](http://rvm.io/) to install the gem, as RVM is magic and makes everything work ;)
|
45
33
|
|
@@ -60,6 +48,15 @@ to [this commit](https://github.com/patrickdavey/vimwiki_markdown/commit/8645883
|
|
60
48
|
It will get rewritten with the relative path to the root
|
61
49
|
of the site (e.g. `./` or `../../` etc)
|
62
50
|
|
51
|
+
#### Optional %date% marker.
|
52
|
+
|
53
|
+
You can also have a `%date%` marker in your template file
|
54
|
+
It will get rewritten with todays date in the format 29 March 2019
|
55
|
+
|
56
|
+
#### Optional %nohtml
|
57
|
+
|
58
|
+
If you place the text %nohtml anywhere in a wiki page, it will not be processed into html
|
59
|
+
|
63
60
|
## Contributing
|
64
61
|
|
65
62
|
Pull requests are very welcome, especially if you want to implement some of the
|
@@ -71,6 +68,11 @@ more interesting vimwiki links (e.g. :local etc.)
|
|
71
68
|
4. Push to the branch (`git push origin my-new-feature`)
|
72
69
|
5. Create a new Pull Request
|
73
70
|
|
71
|
+
## Known Issues
|
72
|
+
|
73
|
+
In the `vimwiki_markdown` gem, links are written out using Rails' paramaterized method. That is, a link like "my awesome link" is turned into "my-awesome-link". Vimwikis built-in support for
|
74
|
+
checking whether a file needs to be re-generated or not uses a mixture of timestamp and whether the output file exists. Unfortunately, vimwiki _doesn't_ paramaterize their output files, so, quite often there's
|
75
|
+
a mismatch in terms of whether a file exists. I had patched previous version of vimwiki, but, I haven't done it with the latest version. If you _want_ to look at it, there's [some information in a previous version of this README](https://github.com/patrickdavey/vimwiki_markdown/blob/4cf18a3fb329895e2062a1a56c83074d215e93c4/README.md#fix-for-vimwiki-links), but, you're on your own ;)
|
74
76
|
|
75
77
|
## License
|
76
78
|
|
data/changelog.md
CHANGED
data/lib/vimwiki_markdown.rb
CHANGED
@@ -12,6 +12,9 @@ module VimwikiMarkdown
|
|
12
12
|
options = Options.new
|
13
13
|
template_html = Template.new(options)
|
14
14
|
body_html = WikiBody.new(options)
|
15
|
+
|
16
|
+
return if body_html.to_s =~ /%nohtml/
|
17
|
+
|
15
18
|
combined_body_template = template_html.to_s.gsub('%content%', body_html.to_s)
|
16
19
|
|
17
20
|
File.write(options.output_fullpath, combined_body_template)
|
@@ -1,4 +1,6 @@
|
|
1
1
|
require 'rouge'
|
2
|
+
require 'date'
|
3
|
+
|
2
4
|
module VimwikiMarkdown
|
3
5
|
class Template
|
4
6
|
|
@@ -24,8 +26,10 @@ module VimwikiMarkdown
|
|
24
26
|
end
|
25
27
|
|
26
28
|
def fixtags(template)
|
27
|
-
@template = template.gsub('%title%',title)
|
28
|
-
|
29
|
+
@template = template.gsub('%title%',title)
|
30
|
+
.gsub('%pygments%',pygments_wrapped_in_tags)
|
31
|
+
.gsub('%root_path%', root_path)
|
32
|
+
.gsub('%date%', Date.today.strftime("%e %b %Y"))
|
29
33
|
end
|
30
34
|
|
31
35
|
def pygments_wrapped_in_tags
|
@@ -12,7 +12,6 @@ module VimwikiMarkdown
|
|
12
12
|
|
13
13
|
its(:force) { should be(true) }
|
14
14
|
its(:syntax) { should eq('markdown') }
|
15
|
-
its(:output_fullpath) { should eq("#{subject.output_dir}#{subject.title.parameterize}.html") }
|
16
15
|
its(:template_filename) { should eq('~/vimwiki/templates/default.tpl') }
|
17
16
|
|
18
17
|
describe "extension" do
|
@@ -33,6 +32,28 @@ module VimwikiMarkdown
|
|
33
32
|
expect(Options.new.title).to eq("Index")
|
34
33
|
end
|
35
34
|
end
|
35
|
+
|
36
|
+
describe "#output_fullpath" do
|
37
|
+
it "must rewrite files so that they match the paramaterized title" do
|
38
|
+
expect(Options.new.output_fullpath).to eq("#{subject.output_dir}#{subject.title.parameterize}.html")
|
39
|
+
end
|
40
|
+
|
41
|
+
it "must correctly deal with filenames with spaces in them" do
|
42
|
+
allow_any_instance_of(Options).to receive(:input_file) { "~/foo/name with spaces.md" }
|
43
|
+
expect(Options.new.output_fullpath).to eq("#{subject.output_dir}name-with-spaces.html")
|
44
|
+
end
|
45
|
+
|
46
|
+
it "must correctly deal with filenames with capitalization issues" do
|
47
|
+
allow_any_instance_of(Options).to receive(:input_file) { "~/foo/NAME WITH SPACES.md" }
|
48
|
+
expect(Options.new.output_fullpath).to eq("#{subject.output_dir}name-with-spaces.html")
|
49
|
+
end
|
50
|
+
|
51
|
+
it "must correctly deal with filenames with spaces and a different extension" do
|
52
|
+
allow_any_instance_of(Options).to receive(:extension) { "wiki" }
|
53
|
+
allow_any_instance_of(Options).to receive(:input_file) { "~/foo/name with spaces.wiki" }
|
54
|
+
expect(Options.new.output_fullpath).to eq("#{subject.output_dir}name-with-spaces.html")
|
55
|
+
end
|
56
|
+
end
|
36
57
|
end
|
37
58
|
end
|
38
59
|
end
|
@@ -3,6 +3,7 @@ require 'vimwiki_markdown/options'
|
|
3
3
|
require 'vimwiki_markdown/template'
|
4
4
|
require 'vimwiki_markdown/exceptions'
|
5
5
|
require 'rspec-html-matchers'
|
6
|
+
require 'date'
|
6
7
|
|
7
8
|
module VimwikiMarkdown
|
8
9
|
describe Template do
|
@@ -44,5 +45,17 @@ module VimwikiMarkdown
|
|
44
45
|
expect(rendered_template).to include("./rootStyle.css")
|
45
46
|
end
|
46
47
|
end
|
48
|
+
|
49
|
+
context "using %date" do
|
50
|
+
before do
|
51
|
+
allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
|
52
|
+
end
|
53
|
+
|
54
|
+
it "replaces %date% with todays date" do
|
55
|
+
allow(File).to receive(:open).with(options.template_filename,"r").and_return(StringIO.new(wiki_template))
|
56
|
+
rendered_template = Template.new(options).to_s
|
57
|
+
expect(rendered_template).to include(Date.today.strftime("%e %b %Y"))
|
58
|
+
end
|
59
|
+
end
|
47
60
|
end
|
48
61
|
end
|
data/spec/spec_helper.rb
CHANGED
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.3.
|
4
|
+
version: 0.3.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Patrick Davey
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-03-
|
11
|
+
date: 2019-03-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|