vimwiki_markdown 0.0.2
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 +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/Gemfile +4 -0
- data/Guardfile +11 -0
- data/LICENSE.txt +22 -0
- data/README.md +28 -0
- data/Rakefile +11 -0
- data/bin/vimwiki_markdown +4 -0
- data/lib/vimwiki_markdown/options.rb +81 -0
- data/lib/vimwiki_markdown/template.rb +34 -0
- data/lib/vimwiki_markdown/version.rb +3 -0
- data/lib/vimwiki_markdown/wiki_body.rb +40 -0
- data/lib/vimwiki_markdown.rb +17 -0
- data/spec/options_spec.rb +19 -0
- data/spec/spec_helper.rb +155 -0
- data/spec/template_spec.rb +22 -0
- data/spec/wiki_body_spec.rb +21 -0
- data/vimwiki_markdown.gemspec +36 -0
- metadata +250 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: e37c0a3c822ebbda20854bb19ea14a7d0e528c06
|
4
|
+
data.tar.gz: 12f867ec84d491a59e58e2baed0eb625c1bf4b47
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 812bcf4b95827c58ec36ed25329078067d10a48edbb093fd038b14cafe5fcad51fe9421f278865af915bd3dc6c879edb51c14fd5c7807ae94be08ff0a2143eaa
|
7
|
+
data.tar.gz: 9f801937fa659e5b5b68b036dffcc40869a85aa8ca494e10dc2243c25c53f324abb92b60ba5dcfec0ee269a5c1820bc3bc48576d369e08fb200de162e50cc3f7
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Patrick Davey
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# VimwikiMarkdown
|
2
|
+
|
3
|
+
This gem allows vimwiki pages written in (github enhanced) markdown
|
4
|
+
to be converted to HTML.
|
5
|
+
|
6
|
+
It is currently a work in progress (but working for me ;)
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
gem 'vimwiki_markdown'
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install vimwiki_markdown
|
21
|
+
|
22
|
+
## Contributing
|
23
|
+
|
24
|
+
1. Fork it ( https://github.com/patrickdavey/vimwiki_markdown/fork )
|
25
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
26
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
27
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
28
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
|
4
|
+
# Default directory to look in is `/specs`
|
5
|
+
# Run with `rake spec`
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |task|
|
7
|
+
task.rspec_opts = ['--color', '--format', 'documentation']
|
8
|
+
end
|
9
|
+
|
10
|
+
task :default => :spec
|
11
|
+
|
@@ -0,0 +1,81 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
|
3
|
+
module VimwikiMarkdown
|
4
|
+
class Options
|
5
|
+
DEFAULTS = ["1", #force - 1/0
|
6
|
+
"markdown",
|
7
|
+
"md",
|
8
|
+
"/home/patrick/vimwiki/site_html/",
|
9
|
+
"/home/patrick/vimwiki/index.md",
|
10
|
+
"/home/patrick/vimwiki/site_html/style.css",
|
11
|
+
"/home/patrick/vimwiki/templates/",
|
12
|
+
"default",
|
13
|
+
".tpl",
|
14
|
+
"-"]
|
15
|
+
|
16
|
+
FORCE = 0
|
17
|
+
SYNTAX = 1
|
18
|
+
EXTENSION = 2
|
19
|
+
OUTPUT_DIR = 3
|
20
|
+
INPUT_FILE = 4
|
21
|
+
CSS_FILE = 5
|
22
|
+
TEMPLATE_PATH = 6
|
23
|
+
TEMPLATE_DEFAULT = 7
|
24
|
+
TEMPLATE_EXT = 8
|
25
|
+
ROOT_PATH = 9
|
26
|
+
|
27
|
+
attr_reader :force, :syntax, :extension, :output_dir,
|
28
|
+
:input_file, :css_file, :template_path,
|
29
|
+
:template_default, :template_ext, :root_path
|
30
|
+
|
31
|
+
=begin force : [0/1] overwrite an existing file
|
32
|
+
syntax : the syntax chosen for this wiki
|
33
|
+
extension : the file extension for this wiki
|
34
|
+
output_dir : the full path of the output directory, i.e. 'path_html'
|
35
|
+
input_file : the full path of the wiki page
|
36
|
+
css_file : the full path of the css file for this wiki
|
37
|
+
template_path : the full path to the wiki's templates
|
38
|
+
template_default : the default template name
|
39
|
+
template_ext : the extension of template files
|
40
|
+
root_path : a count of ../ for pages buried in subdirs
|
41
|
+
if you have wikilink [[dir1/dir2/dir3/my page in a subdir]]
|
42
|
+
then e %root_path% is replaced by '../../../'.
|
43
|
+
=end
|
44
|
+
|
45
|
+
def initialize
|
46
|
+
@force = arguments[FORCE] == "1" ? true : false
|
47
|
+
@syntax = arguments[SYNTAX]
|
48
|
+
@extension = arguments[EXTENSION]
|
49
|
+
@output_dir = arguments[OUTPUT_DIR]
|
50
|
+
@input_file = arguments[INPUT_FILE]
|
51
|
+
@css_file = arguments[CSS_FILE]
|
52
|
+
@template_path = arguments[TEMPLATE_PATH]
|
53
|
+
@template_default = arguments[TEMPLATE_DEFAULT]
|
54
|
+
@template_ext = arguments[TEMPLATE_EXT]
|
55
|
+
@root_path = arguments[ROOT_PATH]
|
56
|
+
raise "Must be markdown" unless syntax == 'markdown'
|
57
|
+
end
|
58
|
+
|
59
|
+
def template_filename
|
60
|
+
"#{template_path}#{template_default}#{template_ext}"
|
61
|
+
end
|
62
|
+
|
63
|
+
def self.arguments
|
64
|
+
ARGV.empty? ? DEFAULTS : ARGV
|
65
|
+
end
|
66
|
+
|
67
|
+
def title
|
68
|
+
File.basename(input_file, ".md").capitalize
|
69
|
+
end
|
70
|
+
|
71
|
+
def output_fullpath
|
72
|
+
"#{output_dir}#{title.parameterize}.html"
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
def arguments
|
78
|
+
Options.arguments
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'pygments.rb'
|
2
|
+
|
3
|
+
module VimwikiMarkdown
|
4
|
+
class Template
|
5
|
+
|
6
|
+
def initialize(options)
|
7
|
+
@options = options
|
8
|
+
get_template_contents
|
9
|
+
|
10
|
+
end
|
11
|
+
|
12
|
+
def to_s
|
13
|
+
fixtags(template)
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
attr_reader :options, :template
|
20
|
+
|
21
|
+
def get_template_contents
|
22
|
+
file = File.open(options.template_filename, "r")
|
23
|
+
@template = file.read
|
24
|
+
end
|
25
|
+
|
26
|
+
def fixtags(template)
|
27
|
+
@template = template.gsub('%title%',title).gsub('%pygments%', Pygments.css('.highlight'))
|
28
|
+
end
|
29
|
+
|
30
|
+
def title
|
31
|
+
options.title
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'active_support/inflector'
|
2
|
+
require 'github/markup'
|
3
|
+
require 'html/pipeline'
|
4
|
+
|
5
|
+
class VimwikiMarkdown::WikiBody
|
6
|
+
|
7
|
+
def initialize(options)
|
8
|
+
@options = options
|
9
|
+
end
|
10
|
+
|
11
|
+
def to_s
|
12
|
+
@markdown_body = get_wiki_markdown_contents
|
13
|
+
fixlinks
|
14
|
+
pipeline = HTML::Pipeline.new [
|
15
|
+
HTML::Pipeline::MarkdownFilter,
|
16
|
+
HTML::Pipeline::SyntaxHighlightFilter
|
17
|
+
]
|
18
|
+
result = pipeline.call(markdown_body)
|
19
|
+
result[:output].to_s
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
private
|
24
|
+
|
25
|
+
attr_reader :options, :markdown_body
|
26
|
+
|
27
|
+
def get_wiki_markdown_contents
|
28
|
+
file = File.open(options.input_file, "r")
|
29
|
+
file.read
|
30
|
+
end
|
31
|
+
|
32
|
+
def fixlinks
|
33
|
+
#convert wiki_links to markdown links
|
34
|
+
# [This link](http://example.net/)
|
35
|
+
@markdown_body.gsub!(/\[\[(.*?)\]\]/) do
|
36
|
+
link_title = Regexp.last_match[1]
|
37
|
+
"[#{link_title}](#{link_title.parameterize}.html)"
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "vimwiki_markdown/version"
|
2
|
+
require "vimwiki_markdown/options"
|
3
|
+
require "vimwiki_markdown/template"
|
4
|
+
require "vimwiki_markdown/wiki_body"
|
5
|
+
|
6
|
+
module VimwikiMarkdown
|
7
|
+
def self.convert_wikimardown_to_html
|
8
|
+
::I18n.enforce_available_locales = false
|
9
|
+
|
10
|
+
options = Options.new
|
11
|
+
template_html = Template.new(options)
|
12
|
+
body_html = WikiBody.new(options)
|
13
|
+
combined_body_template = template_html.to_s.gsub('%content%', body_html.to_s)
|
14
|
+
|
15
|
+
File.write(options.output_fullpath, combined_body_template)
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vimwiki_markdown/options'
|
3
|
+
|
4
|
+
module VimwikiMarkdown
|
5
|
+
describe Options do
|
6
|
+
subject { Options.new }
|
7
|
+
|
8
|
+
context "no options passed" do
|
9
|
+
before do
|
10
|
+
allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
|
11
|
+
end
|
12
|
+
|
13
|
+
its(:force) { should be(true) }
|
14
|
+
its(:syntax) { should eq('markdown') }
|
15
|
+
its(:output_fullpath) { should eq("#{subject.output_dir}#{subject.title.parameterize}.html") }
|
16
|
+
its(:template_filename) { should eq('/home/patrick/vimwiki/templates/default.tpl') }
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,155 @@
|
|
1
|
+
require 'bundler/setup'
|
2
|
+
require 'pry'
|
3
|
+
require 'rspec/its'
|
4
|
+
require 'vimwiki_markdown'
|
5
|
+
|
6
|
+
RSpec.configure do |config|
|
7
|
+
# rspec-expectations config goes here. You can use an alternate
|
8
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
9
|
+
# assertions if you prefer.
|
10
|
+
config.expect_with :rspec do |expectations|
|
11
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
12
|
+
# and `failure_message` of custom matchers include text for helper methods
|
13
|
+
# defined using `chain`, e.g.:
|
14
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
15
|
+
# # => "be bigger than 2 and smaller than 4"
|
16
|
+
# ...rather than:
|
17
|
+
# # => "be bigger than 2"
|
18
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
19
|
+
end
|
20
|
+
|
21
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
22
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
23
|
+
config.mock_with :rspec do |mocks|
|
24
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
25
|
+
# a real object. This is generally recommended, and will default to
|
26
|
+
# `true` in RSpec 4.
|
27
|
+
mocks.verify_partial_doubles = true
|
28
|
+
end
|
29
|
+
|
30
|
+
# The settings below are suggested to provide a good initial experience
|
31
|
+
# with RSpec, but feel free to customize to your heart's content.
|
32
|
+
=begin
|
33
|
+
# These two settings work together to allow you to limit a spec run
|
34
|
+
# to individual examples or groups you care about by tagging them with
|
35
|
+
# `:focus` metadata. When nothing is tagged with `:focus`, all examples
|
36
|
+
# get run.
|
37
|
+
config.filter_run :focus
|
38
|
+
config.run_all_when_everything_filtered = true
|
39
|
+
|
40
|
+
# Limits the available syntax to the non-monkey patched syntax that is recommended.
|
41
|
+
# For more details, see:
|
42
|
+
# - http://myronmars.to/n/dev-blog/2012/06/rspecs-new-expectation-syntax
|
43
|
+
# - http://teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
44
|
+
# - http://myronmars.to/n/dev-blog/2014/05/notable-changes-in-rspec-3#new__config_option_to_disable_rspeccore_monkey_patching
|
45
|
+
config.disable_monkey_patching!
|
46
|
+
|
47
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
48
|
+
# be too noisy due to issues in dependencies.
|
49
|
+
config.warnings = true
|
50
|
+
|
51
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
52
|
+
# file, and it's useful to allow more verbose output when running an
|
53
|
+
# individual spec file.
|
54
|
+
if config.files_to_run.one?
|
55
|
+
# Use the documentation formatter for detailed output,
|
56
|
+
# unless a formatter has already been configured
|
57
|
+
# (e.g. via a command-line flag).
|
58
|
+
config.default_formatter = 'doc'
|
59
|
+
end
|
60
|
+
|
61
|
+
# Print the 10 slowest examples and example groups at the
|
62
|
+
# end of the spec run, to help surface which specs are running
|
63
|
+
# particularly slow.
|
64
|
+
config.profile_examples = 10
|
65
|
+
|
66
|
+
# Run specs in random order to surface order dependencies. If you find an
|
67
|
+
# order dependency and want to debug it, you can fix the order by providing
|
68
|
+
# the seed, which is printed after each run.
|
69
|
+
# --seed 1234
|
70
|
+
config.order = :random
|
71
|
+
|
72
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
73
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
74
|
+
# test failures related to randomization by passing the same `--seed` value
|
75
|
+
# as the one that triggered the failure.
|
76
|
+
Kernel.srand config.seed
|
77
|
+
=end
|
78
|
+
end
|
79
|
+
|
80
|
+
def wiki_index_markdown
|
81
|
+
"
|
82
|
+
## Patrick Davey personal Wiki
|
83
|
+
* [[Books]] -- to read
|
84
|
+
* [[Vim Tips]]-- anything to do with vim.
|
85
|
+
* [[Git Tips]]-- anything to do with git.
|
86
|
+
* [[Bash Tips]]-- anything to do with bash.
|
87
|
+
* [[Mysql Tips]]-- anything to do with mysql.
|
88
|
+
* [[css - responsive - design Tips]]-- anything to do with css etc..
|
89
|
+
* [[Refinery]]-- useful Refinery Stuff
|
90
|
+
* [[Backbone]]-- useful Backbone Stuff
|
91
|
+
* [[Tmux]]-- useful Tmux Stuff
|
92
|
+
* [[Rails]]-- useful Rails Stuff
|
93
|
+
* [[Scratchpad]] temporary stuff.
|
94
|
+
* [[Server Setup]] -- checklist to setup a server.
|
95
|
+
* [[Todo]] -- things to do
|
96
|
+
* [[Quotes]] -- Nothing to do with programming!
|
97
|
+
* [[Movies to watch]] -- Movies to watch
|
98
|
+
* [[lent items]]
|
99
|
+
* [[bike stuff]]
|
100
|
+
* [[raspberrypi]]
|
101
|
+
|
102
|
+
|
103
|
+
## Languages
|
104
|
+
* [[Ruby]]-- useful Ruby Stuff
|
105
|
+
* [[iOS]]-- useful iOS Stuff
|
106
|
+
* [[JavaScript]]-- useful JS Stuff
|
107
|
+
"
|
108
|
+
end
|
109
|
+
|
110
|
+
def wiki_template
|
111
|
+
<<-WIKITEMPLATE
|
112
|
+
<!DOCTYPE html>
|
113
|
+
<html lang="en">
|
114
|
+
<head>
|
115
|
+
<meta charset="utf-8">
|
116
|
+
<link type="text/css" rel="stylesheet" href="./style.css" />
|
117
|
+
<link type="text/css" rel="stylesheet" href="./styles/bootstrap.min.css" />
|
118
|
+
<link type="text/css" rel="stylesheet" href="./overrides.css" />
|
119
|
+
<link type="text/css" rel="stylesheet" href="./styles/shCore.css" />
|
120
|
+
<link type="text/css" rel="stylesheet" href="./styles/shThemeDefault.css" />
|
121
|
+
<script type="text/javascript" src="./scripts/shCore.js"></script>
|
122
|
+
<script type="text/javascript" src="./scripts/shBrushRuby.js"></script>
|
123
|
+
<script type="text/javascript" src="./scripts/shObjectiveC.js"></script>
|
124
|
+
<script type="text/javascript" src="./scripts/shBrushBash.js"></script>
|
125
|
+
<script type="text/javascript" src="./scripts/shBrushJScript.js"></script>
|
126
|
+
<script type="text/javascript">
|
127
|
+
SyntaxHighlighter.all();
|
128
|
+
</script>
|
129
|
+
<title>%title%</title>
|
130
|
+
<meta http-equiv="Content-Type" content="text/html; charset=%encoding%">
|
131
|
+
<style>
|
132
|
+
%pygments%
|
133
|
+
</style>
|
134
|
+
</head>
|
135
|
+
<body id="%title%">
|
136
|
+
<div class="navbar navbar-inverse navbar-fixed-top">
|
137
|
+
<div class="navbar-inner">
|
138
|
+
<div class="container">
|
139
|
+
<a class="brand" href="index.html">Wiki</a>
|
140
|
+
</div>
|
141
|
+
</div>
|
142
|
+
</div>
|
143
|
+
|
144
|
+
<div class="container">
|
145
|
+
<div class="row">
|
146
|
+
<div class="span12">
|
147
|
+
<h2 id="title">%title%</h2>
|
148
|
+
%content%
|
149
|
+
</div>
|
150
|
+
</div>
|
151
|
+
</div>
|
152
|
+
</body>
|
153
|
+
</html>
|
154
|
+
WIKITEMPLATE
|
155
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vimwiki_markdown/options'
|
3
|
+
require 'vimwiki_markdown/template'
|
4
|
+
require 'rspec-html-matchers'
|
5
|
+
|
6
|
+
module VimwikiMarkdown
|
7
|
+
describe Template do
|
8
|
+
|
9
|
+
context "template" do
|
10
|
+
let(:options) { Options.new }
|
11
|
+
|
12
|
+
subject { Template.new(options).to_s }
|
13
|
+
before do
|
14
|
+
allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
|
15
|
+
allow(File).to receive(:open).with(options.template_filename,"r").and_return(StringIO.new(wiki_template))
|
16
|
+
end
|
17
|
+
|
18
|
+
it { should have_tag('title', text: 'Index') }
|
19
|
+
it { should have_tag('h2', text: 'Index') }
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'vimwiki_markdown/options'
|
3
|
+
require 'vimwiki_markdown/wiki_body'
|
4
|
+
require 'rspec-html-matchers'
|
5
|
+
|
6
|
+
module VimwikiMarkdown
|
7
|
+
describe WikiBody do
|
8
|
+
|
9
|
+
let(:options) { Options.new }
|
10
|
+
let(:wiki_body) { WikiBody.new(options) }
|
11
|
+
before do
|
12
|
+
allow(Options).to receive(:arguments).and_return(Options::DEFAULTS)
|
13
|
+
allow(wiki_body).to receive(:get_wiki_markdown_contents).and_return(wiki_index_markdown)
|
14
|
+
end
|
15
|
+
|
16
|
+
it "must convert wiki links" do
|
17
|
+
expect(wiki_body.to_s).to match(/<a href="books.html">Books<\/a>/)
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'pry'
|
2
|
+
# coding: utf-8
|
3
|
+
lib = File.expand_path('../lib', __FILE__)
|
4
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
5
|
+
require 'vimwiki_markdown/version'
|
6
|
+
|
7
|
+
Gem::Specification.new do |spec|
|
8
|
+
spec.name = "vimwiki_markdown"
|
9
|
+
spec.version = VimwikiMarkdown::VERSION
|
10
|
+
spec.authors = ["Patrick Davey"]
|
11
|
+
spec.email = ["patrick.davey@gmail.com"]
|
12
|
+
spec.summary = %q{Converts a github flavoured markdown vimwiki file into html.}
|
13
|
+
spec.description = %q{Converts a vimwiki markdown file to html. It parses [[links]] and has support for syntax highlighting.}
|
14
|
+
spec.homepage = "https://github.com/patrickdavey/wimwiki_markdown"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0")
|
18
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_development_dependency "bundler", "~> 1.6"
|
23
|
+
spec.add_development_dependency "rake"
|
24
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
25
|
+
spec.add_development_dependency "pry"
|
26
|
+
spec.add_development_dependency "rspec-its"
|
27
|
+
spec.add_development_dependency "rspec-html-matchers"
|
28
|
+
spec.add_development_dependency "guard-rspec"
|
29
|
+
|
30
|
+
spec.add_runtime_dependency "activesupport", "~> 4.1.6"
|
31
|
+
spec.add_runtime_dependency "github-markup"
|
32
|
+
spec.add_runtime_dependency "github-markdown"
|
33
|
+
spec.add_runtime_dependency "github-linguist", "~> 3.1.5"
|
34
|
+
spec.add_runtime_dependency "redcarpet", "~> 3.1.2"
|
35
|
+
spec.add_runtime_dependency "html-pipeline"
|
36
|
+
end
|
metadata
ADDED
@@ -0,0 +1,250 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: vimwiki_markdown
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Patrick Davey
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-10-14 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec-its
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-html-matchers
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: guard-rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: activesupport
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 4.1.6
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 4.1.6
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: github-markup
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: github-markdown
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: github-linguist
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 3.1.5
|
160
|
+
type: :runtime
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - "~>"
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 3.1.5
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: redcarpet
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - "~>"
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 3.1.2
|
174
|
+
type: :runtime
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - "~>"
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 3.1.2
|
181
|
+
- !ruby/object:Gem::Dependency
|
182
|
+
name: html-pipeline
|
183
|
+
requirement: !ruby/object:Gem::Requirement
|
184
|
+
requirements:
|
185
|
+
- - ">="
|
186
|
+
- !ruby/object:Gem::Version
|
187
|
+
version: '0'
|
188
|
+
type: :runtime
|
189
|
+
prerelease: false
|
190
|
+
version_requirements: !ruby/object:Gem::Requirement
|
191
|
+
requirements:
|
192
|
+
- - ">="
|
193
|
+
- !ruby/object:Gem::Version
|
194
|
+
version: '0'
|
195
|
+
description: Converts a vimwiki markdown file to html. It parses [[links]] and has
|
196
|
+
support for syntax highlighting.
|
197
|
+
email:
|
198
|
+
- patrick.davey@gmail.com
|
199
|
+
executables:
|
200
|
+
- vimwiki_markdown
|
201
|
+
extensions: []
|
202
|
+
extra_rdoc_files: []
|
203
|
+
files:
|
204
|
+
- ".gitignore"
|
205
|
+
- ".rspec"
|
206
|
+
- Gemfile
|
207
|
+
- Guardfile
|
208
|
+
- LICENSE.txt
|
209
|
+
- README.md
|
210
|
+
- Rakefile
|
211
|
+
- bin/vimwiki_markdown
|
212
|
+
- lib/vimwiki_markdown.rb
|
213
|
+
- lib/vimwiki_markdown/options.rb
|
214
|
+
- lib/vimwiki_markdown/template.rb
|
215
|
+
- lib/vimwiki_markdown/version.rb
|
216
|
+
- lib/vimwiki_markdown/wiki_body.rb
|
217
|
+
- spec/options_spec.rb
|
218
|
+
- spec/spec_helper.rb
|
219
|
+
- spec/template_spec.rb
|
220
|
+
- spec/wiki_body_spec.rb
|
221
|
+
- vimwiki_markdown.gemspec
|
222
|
+
homepage: https://github.com/patrickdavey/wimwiki_markdown
|
223
|
+
licenses:
|
224
|
+
- MIT
|
225
|
+
metadata: {}
|
226
|
+
post_install_message:
|
227
|
+
rdoc_options: []
|
228
|
+
require_paths:
|
229
|
+
- lib
|
230
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
231
|
+
requirements:
|
232
|
+
- - ">="
|
233
|
+
- !ruby/object:Gem::Version
|
234
|
+
version: '0'
|
235
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
236
|
+
requirements:
|
237
|
+
- - ">="
|
238
|
+
- !ruby/object:Gem::Version
|
239
|
+
version: '0'
|
240
|
+
requirements: []
|
241
|
+
rubyforge_project:
|
242
|
+
rubygems_version: 2.2.2
|
243
|
+
signing_key:
|
244
|
+
specification_version: 4
|
245
|
+
summary: Converts a github flavoured markdown vimwiki file into html.
|
246
|
+
test_files:
|
247
|
+
- spec/options_spec.rb
|
248
|
+
- spec/spec_helper.rb
|
249
|
+
- spec/template_spec.rb
|
250
|
+
- spec/wiki_body_spec.rb
|