vimwiki_markdown 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +18 -6
- data/bin/vimwiki_markdown +2 -40
- data/changelog.md +7 -0
- data/lib/vimwiki_markdown.rb +7 -7
- data/lib/vimwiki_markdown/options.rb +0 -7
- data/lib/vimwiki_markdown/version.rb +1 -1
- data/spec/lib/vimwiki_markdown/options_spec.rb +1 -21
- metadata +2 -4
- data/bin/vimwiki_server +0 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a8ab0a8dd31d4b4c7975ec0cca59cf275f3a6b92
|
4
|
+
data.tar.gz: 156a835b645f49cebc85d917ef1c996b45051e5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 70f9c33b1ca3b1db71d9ebd626a7a1cde1e6bffd9ba5a9a3375dfffaf489f01c6fec54a569ae91857bb18a2bba00254bcfe36b6bf0267925976ac40907ba7eba
|
7
|
+
data.tar.gz: d1df0e23ffd043ae42063d9d53d48cda6ff53952e065de6d7c5436ed00dc359c3d0a76c82c3f217d19adba79cbef81292695f9f778c5255118e110bdc0813402
|
data/README.md
CHANGED
@@ -20,12 +20,6 @@ for the generation of html. This was added on the master branch in [this commit
|
|
20
20
|
|
21
21
|
Currently you will need to make sure you are running the dev branch of vimwiki, or add that commit in yourself
|
22
22
|
|
23
|
-
## Druby
|
24
|
-
|
25
|
-
The version 0.1 introduced Druby which we use to greatly speed up the process. You might want to stick
|
26
|
-
with the 0.0.x version if things get interesting.
|
27
|
-
|
28
|
-
|
29
23
|
## Setup
|
30
24
|
|
31
25
|
Ensure that your vimiwiki directive in your .vimrc is setup for markdown. For
|
@@ -38,6 +32,24 @@ this we use the custom_wiki2html parameter. My .vimrc looks like this:
|
|
38
32
|
|
39
33
|
The most important part is the *'custom_wiki2html': 'vimwiki_markdown'*
|
40
34
|
|
35
|
+
### Note for ruby 2.2
|
36
|
+
This gem doesn't seem to work on 2.2 on osx.. seems to be a github/markup gem issue as near as I can tell.
|
37
|
+
For the moment.. use 2.1 or lower if you run into issues.
|
38
|
+
|
39
|
+
### Fix for vimwiki links.
|
40
|
+
In vimwiki at the moment, it deletes any files in the site_html directory which do not match
|
41
|
+
against the markdown files (once they are translated into linked html). Now, in vimwiki_markdown
|
42
|
+
we use ActiveSupports paramaterized method, as it's nicer on links. If you want to have a
|
43
|
+
significant speed up, then you need to patch your vimwiki plugin to not delete files it
|
44
|
+
shouldn't be. Here are links to the relevant bits:
|
45
|
+
|
46
|
+
1. [Add this function](https://github.com/patrickdavey/vimwiki-1/blob/9ebca2182fcf10e1bbf61abc8b4a535ce790480d/autoload/vimwiki/html.vim#L242-247)
|
47
|
+
2. [Make the is_html_uptodate look like this](https://github.com/patrickdavey/vimwiki-1/blob/9ebca2182fcf10e1bbf61abc8b4a535ce790480d/autoload/vimwiki/html.vim#L224-241)
|
48
|
+
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.
|
49
|
+
4. Might be some other things, check the diff in the above commits or open an issue.
|
50
|
+
|
51
|
+
|
52
|
+
|
41
53
|
### VimWiki Template
|
42
54
|
|
43
55
|
It is a requirement that your template file contain a placeholder
|
data/bin/vimwiki_markdown
CHANGED
@@ -1,42 +1,4 @@
|
|
1
|
-
require '
|
2
|
-
require "vimwiki_markdown/options"
|
1
|
+
require 'vimwiki_markdown'
|
3
2
|
|
4
|
-
|
5
|
-
start_time = Time.now
|
6
|
-
current_time = start_time
|
7
|
-
while (current_time - start_time) <= timeout
|
8
|
-
begin
|
9
|
-
TCPSocket.new(ip, port)
|
10
|
-
return true
|
11
|
-
rescue Errno::ECONNREFUSED
|
12
|
-
sleep 0.1
|
13
|
-
end
|
14
|
-
current_time = Time.now
|
15
|
-
end
|
3
|
+
VimwikiMarkdown.convert_wikimarkdown_to_html
|
16
4
|
|
17
|
-
return false
|
18
|
-
end
|
19
|
-
|
20
|
-
unless port_open?("127.0.0.1", 8787, 1)
|
21
|
-
server = fork do
|
22
|
-
exec "vimwiki_server"
|
23
|
-
end
|
24
|
-
|
25
|
-
Process.detach(server)
|
26
|
-
sleep(1)
|
27
|
-
end
|
28
|
-
|
29
|
-
options = VimwikiMarkdown::Options.new
|
30
|
-
|
31
|
-
# The URI to connect to
|
32
|
-
SERVER_URI="druby://localhost:8787"
|
33
|
-
|
34
|
-
# Start a local DRbServer to handle callbacks.
|
35
|
-
#
|
36
|
-
# Not necessary for this small example, but will be required
|
37
|
-
# as soon as we pass a non-marshallable object as an argument
|
38
|
-
# to a dRuby call.
|
39
|
-
DRb.start_service
|
40
|
-
|
41
|
-
vimwiki_service = DRbObject.new_with_uri(SERVER_URI)
|
42
|
-
vimwiki_service.generate_html(options)
|
data/changelog.md
CHANGED
@@ -1,9 +1,16 @@
|
|
1
|
+
## 0.1.1 [April 22nd 2015]
|
2
|
+
* Aaaaannnnd reverting that change. While it totally works, it probably
|
3
|
+
is overkill to have Druby running. The major issue is that vimwiki
|
4
|
+
deletes the old files as the filenames do not match. Have added a
|
5
|
+
note in the README to tell people how to make it faster.
|
6
|
+
|
1
7
|
## 0.1.0 [April 18th 2015]
|
2
8
|
* Quite a major change, we now spin up a Druby server in the background
|
3
9
|
and then send the files across the wire to it. This is somewhat
|
4
10
|
invasive, but, on the plus side, takes the compilation time from
|
5
11
|
several minutes down to seconds as we're not having to start
|
6
12
|
up and require a whole bunch of files all the time.
|
13
|
+
|
7
14
|
## 0.0.4 [Dec 9th 2014]
|
8
15
|
* Use Github::Markup to prerender the markdown
|
9
16
|
|
data/lib/vimwiki_markdown.rb
CHANGED
@@ -5,16 +5,16 @@ require "vimwiki_markdown/wiki_body"
|
|
5
5
|
require "vimwiki_markdown/exceptions"
|
6
6
|
|
7
7
|
module VimwikiMarkdown
|
8
|
-
def self.convert_wikimarkdown_to_html
|
8
|
+
def self.convert_wikimarkdown_to_html
|
9
9
|
::I18n.enforce_available_locales = false
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
11
|
+
options = Options.new
|
12
|
+
template_html = Template.new(options)
|
13
|
+
body_html = WikiBody.new(options)
|
14
|
+
combined_body_template = template_html.to_s.gsub('%content%', body_html.to_s)
|
15
|
+
|
16
|
+
File.write(options.output_fullpath, combined_body_template)
|
15
17
|
|
16
|
-
File.write(options.output_fullpath, combined_body_template)
|
17
|
-
end
|
18
18
|
rescue MissingRequiredParamError => e
|
19
19
|
warn e.message
|
20
20
|
exit(0)
|
@@ -72,13 +72,6 @@ module VimwikiMarkdown
|
|
72
72
|
"#{output_dir}#{title.parameterize}.html"
|
73
73
|
end
|
74
74
|
|
75
|
-
def unmodified?
|
76
|
-
return false unless File.exist?(output_fullpath)
|
77
|
-
|
78
|
-
File.mtime(input_file) < File.mtime(output_fullpath)
|
79
|
-
end
|
80
|
-
|
81
|
-
|
82
75
|
private
|
83
76
|
|
84
77
|
def arguments
|
@@ -3,7 +3,7 @@ require 'vimwiki_markdown/options'
|
|
3
3
|
|
4
4
|
module VimwikiMarkdown
|
5
5
|
describe Options do
|
6
|
-
|
6
|
+
subject { Options.new }
|
7
7
|
|
8
8
|
context "no options passed" do
|
9
9
|
before do
|
@@ -15,25 +15,5 @@ module VimwikiMarkdown
|
|
15
15
|
its(:output_fullpath) { should eq("#{subject.output_dir}#{subject.title.parameterize}.html") }
|
16
16
|
its(:template_filename) { should eq('/home/patrick/vimwiki/templates/default.tpl') }
|
17
17
|
end
|
18
|
-
|
19
|
-
context "with an already existing html output" do
|
20
|
-
let(:path) { options.output_fullpath }
|
21
|
-
|
22
|
-
before do
|
23
|
-
allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
|
24
|
-
end
|
25
|
-
|
26
|
-
it "#unmodified? should return false if the file does not exist" do
|
27
|
-
allow(File).to receive(:exist?).with(path) { false }
|
28
|
-
expect(options.unmodified?).to be(false)
|
29
|
-
end
|
30
|
-
|
31
|
-
it "#unmodified? should return true" do
|
32
|
-
allow(File).to receive(:exist?).with(path) { true }
|
33
|
-
allow(File).to receive(:mtime).with(path) { Date.today }
|
34
|
-
allow(File).to receive(:mtime).with(options.input_file) { Date.today - 1 }
|
35
|
-
expect(options.unmodified?).to be(true)
|
36
|
-
end
|
37
|
-
end
|
38
18
|
end
|
39
19
|
end
|
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.1.
|
4
|
+
version: 0.1.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: 2015-04-
|
11
|
+
date: 2015-04-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -198,7 +198,6 @@ email:
|
|
198
198
|
- patrick.davey@gmail.com
|
199
199
|
executables:
|
200
200
|
- vimwiki_markdown
|
201
|
-
- vimwiki_server
|
202
201
|
extensions: []
|
203
202
|
extra_rdoc_files: []
|
204
203
|
files:
|
@@ -210,7 +209,6 @@ files:
|
|
210
209
|
- README.md
|
211
210
|
- Rakefile
|
212
211
|
- bin/vimwiki_markdown
|
213
|
-
- bin/vimwiki_server
|
214
212
|
- changelog.md
|
215
213
|
- example_files/default.tpl
|
216
214
|
- lib/vimwiki_markdown.rb
|
data/bin/vimwiki_server
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
require 'drb/drb'
|
2
|
-
require 'vimwiki_markdown'
|
3
|
-
|
4
|
-
# The URI for the server to connect to
|
5
|
-
URI="druby://localhost:8787"
|
6
|
-
|
7
|
-
class VimwikiMarkdownService
|
8
|
-
|
9
|
-
def generate_html(options)
|
10
|
-
VimwikiMarkdown.convert_wikimarkdown_to_html(options)
|
11
|
-
end
|
12
|
-
|
13
|
-
end
|
14
|
-
|
15
|
-
# The object that handles requests on the server
|
16
|
-
FRONT_OBJECT=VimwikiMarkdownService.new
|
17
|
-
|
18
|
-
# $SAFE = 1 # disable eval() and friends
|
19
|
-
|
20
|
-
DRb.start_service(URI, FRONT_OBJECT)
|
21
|
-
# Wait for the drb server thread to finish before exiting.
|
22
|
-
DRb.thread.join
|