vimwiki_markdown 0.6.0 → 0.7.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: 94fcdf721504210b46ed56769e3529838982092414094c950ccddaa747086f9f
4
- data.tar.gz: 219b35ea5da34b1cf75f962432073a8f97c972a62d14403b35dfae442f98b794
3
+ metadata.gz: d4893e1d18542936cff19882c791e51c9d8234cefaaec3751cff7fc9724eb70e
4
+ data.tar.gz: 1e51ef4d9df34eb09ad1cf0528efad3b3471e11790a3628594b27224e1560176
5
5
  SHA512:
6
- metadata.gz: 5c51b9de26115ee93f512404af7e84544088406df98a4c0861095da736dd78821f12e59b40e639f7bbea13f20bc460eb14bf9b4daa911c3bd00202ccd587f1e9
7
- data.tar.gz: 5ccfb995fa5e7966379fc34dc40a0799614bf59b59d780fc0932a413a3876bebccdbc3bf4166cbda209a9e8bbc78593673816a44b4a5768cc90a80e6fc33f958
6
+ metadata.gz: d4301871b6d662d7f02c8c549dcdcd239633183f4bfb9a05f3c04c6d40405778da03ef88948a1d954a0d6b6b41c2c4df3a43602f2d3673108cbf1402b484442e
7
+ data.tar.gz: 908c6005ba6107459aa00297331a62eac008ccc88e4feb526943225d01dd6bdbd21307db1466303424a9fb0378c03cd29f7ca6a586b1274e82b39264739728d1
data/.travis.yml CHANGED
@@ -4,6 +4,8 @@ before_install:
4
4
  language: ruby
5
5
  rvm:
6
6
  - 2.3.8
7
- - 2.4.2
8
- - 2.5.3
9
- - 2.6.1
7
+ - 2.4.10
8
+ - 2.5.8
9
+ - 2.6.6
10
+ - 2.7.2
11
+ - 3.0.0
data/A.png ADDED
Binary file
data/B.png ADDED
Binary file
data/README.md CHANGED
@@ -6,6 +6,15 @@ to be converted to HTML.
6
6
 
7
7
  It is currently a work in progress (but working for me ;)
8
8
 
9
+ ## Example
10
+ It turns this:
11
+
12
+ ![markdown](A.png)
13
+
14
+ into
15
+
16
+ ![finished](B.png)
17
+
9
18
  ## Requirements
10
19
 
11
20
  Ruby installed on your computer & up to date version of vimwiki
@@ -70,7 +70,8 @@ module VimwikiMarkdown
70
70
  end
71
71
 
72
72
  def output_fullpath
73
- "#{output_dir}#{title.parameterize}.html"
73
+ filename = title.parameterize =~ /^\s*$/ ? title : title.parameterize
74
+ "#{output_dir}#{filename}.html"
74
75
  end
75
76
 
76
77
 
@@ -1,3 +1,3 @@
1
1
  module VimwikiMarkdown
2
- VERSION = "0.6.0"
2
+ VERSION = "0.7.0"
3
3
  end
@@ -34,7 +34,12 @@ module VimwikiMarkdown
34
34
  def rewrite_local_links!
35
35
  if vimwiki_markdown_file_exists?
36
36
  path = Pathname.new(uri)
37
- @uri = "#{path.dirname + path.basename(markdown_extension).to_s.parameterize}.html"
37
+
38
+ link_path = path.basename(markdown_extension).to_s.parameterize
39
+
40
+ link_path = path.basename(markdown_extension).to_s if link_path.match(/^\s*$/)
41
+
42
+ @uri = "#{path.dirname + link_path}.html"
38
43
  @fragment = fragment.parameterize.prepend("#") unless fragment.empty?
39
44
  elsif /^file:/.match(uri)
40
45
  # begins with file: -> force absolute path if file exists
@@ -43,6 +43,11 @@ module VimwikiMarkdown
43
43
  expect(Options.new.output_fullpath).to eq("#{subject.output_dir}name-with-spaces.html")
44
44
  end
45
45
 
46
+ it "must not change filenames if paramteriezed returns an empty string" do
47
+ allow_any_instance_of(Options).to receive(:input_file) { "~/foo/世界.md" }
48
+ expect(Options.new.output_fullpath).to eq("#{subject.output_dir}世界.html")
49
+ end
50
+
46
51
  it "must correctly deal with filenames with capitalization issues" do
47
52
  allow_any_instance_of(Options).to receive(:input_file) { "~/foo/NAME WITH SPACES.md" }
48
53
  expect(Options.new.output_fullpath).to eq("#{subject.output_dir}name-with-spaces.html")
@@ -68,6 +68,17 @@ module VimwikiMarkdown
68
68
  expect(link.to_s).to eq("[test](#{existing_file_no_extension}.html#wiki-heading)")
69
69
  end
70
70
 
71
+ context "with chinese or unparamaterizable chars" do
72
+ let(:existing_file) { "世界#{markdown_extension}" }
73
+
74
+ it "must convert same-directory markdown links without paramaterization correctly" do
75
+ markdown_link = "[test](#{existing_file_no_extension})"
76
+
77
+ link = VimwikiLink.new(markdown_link, source_filepath, markdown_extension, root_path, output_dir)
78
+ expect(link.to_s).to eq("[test](#{existing_file_no_extension}.html)")
79
+ end
80
+ end
81
+
71
82
  context "subdirectory linked files" do
72
83
  let(:existing_file) { "subdirectory/test.md" }
73
84
 
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.0"
21
+ spec.add_development_dependency "bundler"
22
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"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vimwiki_markdown
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Davey
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-06-04 00:00:00.000000000 Z
11
+ date: 2021-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '0'
20
20
  type: :development
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.0'
26
+ version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -220,6 +220,8 @@ files:
220
220
  - ".rspec"
221
221
  - ".rubocop.yml"
222
222
  - ".travis.yml"
223
+ - A.png
224
+ - B.png
223
225
  - Gemfile
224
226
  - Guardfile
225
227
  - LICENSE.txt
@@ -245,7 +247,7 @@ homepage: https://github.com/patrickdavey/wimwiki_markdown
245
247
  licenses:
246
248
  - MIT
247
249
  metadata: {}
248
- post_install_message:
250
+ post_install_message:
249
251
  rdoc_options: []
250
252
  require_paths:
251
253
  - lib
@@ -260,8 +262,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
260
262
  - !ruby/object:Gem::Version
261
263
  version: '0'
262
264
  requirements: []
263
- rubygems_version: 3.0.4
264
- signing_key:
265
+ rubygems_version: 3.2.3
266
+ signing_key:
265
267
  specification_version: 4
266
268
  summary: Converts a github flavoured markdown vimwiki file into html.
267
269
  test_files: