vimwiki_markdown 0.2.3 → 0.2.4

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: b1eedf430b8b2d456f161be94b5e8442fc067c65
4
- data.tar.gz: c93a44f60628a554df3f3b988b8b8fdae2814c96
3
+ metadata.gz: 5514b5493582d943801eb948380bc711d4b0f9de
4
+ data.tar.gz: 2e5ad2aa5650926176153d4b802a61de731a07e7
5
5
  SHA512:
6
- metadata.gz: 78fa1cd9bb2c713edcc40858970b6c9c72a309233b371bfed8b0f0ec4fb1230871a4192aa16782eb07dd084369e13f27a10f95e39a1d14b1a3275532ebae6a8f
7
- data.tar.gz: 8cbbaef17fd634549ef9f24e688480bfd9d50e48156b012a5e614fcf4fbc50d678d3d9cfba68ab981b3a8f275cfc5ccd8719e58dafc0ae33300e546de0cd7ca5
6
+ metadata.gz: 861f56b1a07d2d2a2b87a63d0d4a63931f5506d5134f81821d3f8813e4190f92f80e666522b843bcf5d503caedfd82694bdb085b232c8ce245c674c80f6b32df
7
+ data.tar.gz: d59361faa0a8a087484de556253a2d9deaef53545463800de7dca4ced42a95335cf31edb337ec67d412745a9ef6e8c8415fe0ebde9c575e73ddfd53b43e55b74
data/changelog.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## 0.2.4 [Jan 01 2017]
2
+ Make directory links work correctly. If you now link to
3
+ a directory [somedir](somedir/) then that link will be preserved
4
+ correctly.
5
+
1
6
  ## 0.2.3 [December 15th 2016]
2
7
  Bugfix - multiple links on the same line were not processed correctly.
3
8
 
@@ -45,7 +45,7 @@ module VimwikiMarkdown
45
45
  def initialize
46
46
  @force = arguments[FORCE] == "1" ? true : false
47
47
  @syntax = arguments[SYNTAX]
48
- @extension = arguments[EXTENSION]
48
+ @extension = ".#{arguments[EXTENSION]}"
49
49
  @output_dir = arguments[OUTPUT_DIR]
50
50
  @input_file = arguments[INPUT_FILE]
51
51
  @css_file = arguments[CSS_FILE]
@@ -1,3 +1,3 @@
1
1
  module VimwikiMarkdown
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -37,16 +37,16 @@ module VimwikiMarkdown
37
37
  end
38
38
 
39
39
  def vimwiki_markdown_file_exists?
40
- File.exist?(source_markdown_directory + uri) ||
41
- File.exist?(source_markdown_directory + "#{uri}.#{markdown_extension}") ||
42
- absolute_path_exists?
40
+ File.exist?((source_markdown_directory + uri).sub_ext(markdown_extension)) ||
41
+ absolute_path_to_markdown_file_exists?
43
42
  end
44
43
 
45
- def absolute_path_exists?
44
+ def absolute_path_to_markdown_file_exists?
46
45
  path = Pathname(uri)
47
- path.absolute? && (
48
- File.exist?(source_markdown_directory + root_path + path.to_s.sub(/^\//,"")) ||
49
- File.exist?(source_markdown_directory + root_path + path.to_s.sub(/^\//,"").sub(/$/, ".#{markdown_extension}")))
46
+ filepath = Pathname.new(source_markdown_directory + root_path + path.to_s.sub(/^\//,"")).
47
+ sub_ext(markdown_extension)
48
+
49
+ path.absolute? && File.exist?(filepath)
50
50
  end
51
51
  end
52
52
  end
@@ -4,7 +4,7 @@ module VimwikiMarkdown
4
4
  describe VimwikiLink do
5
5
  let(:markdown_link) { "[title](http://www.google.com)" }
6
6
  let(:source_filepath) { "unimportant" }
7
- let(:markdown_extension) { "md" }
7
+ let(:markdown_extension) { ".md" }
8
8
  let(:root_path) { "-" }
9
9
 
10
10
  it "should leave external links alone" do
@@ -14,8 +14,8 @@ module VimwikiMarkdown
14
14
  end
15
15
 
16
16
  context "with an existing markdown file matching name" do
17
- let(:existing_file) { "test.#{markdown_extension}" }
18
- let(:existing_file_no_extension) { existing_file.gsub(/\.#{markdown_extension}$/,"") }
17
+ let(:existing_file) { "test#{markdown_extension}" }
18
+ let(:existing_file_no_extension) { existing_file.gsub(/#{markdown_extension}$/,"") }
19
19
  let(:temp_wiki_dir) { Pathname.new(Dir.mktmpdir("temp_wiki_")) }
20
20
  let(:markdown_link) { "[test](#{existing_file})" }
21
21
  let(:source_filepath) { temp_wiki_dir + "index.md" }
@@ -52,6 +52,14 @@ module VimwikiMarkdown
52
52
  expect(link.title).to eq("test")
53
53
  expect(link.uri).to eq("#{existing_file_no_extension}.html")
54
54
  end
55
+
56
+ it "must convert directory links correctly" do
57
+ markdown_link = "[subdirectory](subdirectory/)"
58
+ link = VimwikiLink.new(markdown_link, source_filepath, markdown_extension, root_path)
59
+ expect(link.title).to eq("subdirectory")
60
+ expect(link.uri).to eq("subdirectory/")
61
+ end
62
+
55
63
  end
56
64
 
57
65
  context "../ style links" do
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.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Patrick Davey
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-26 00:00:00.000000000 Z
11
+ date: 2017-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler