multimarkdown-cli 0.0.1 → 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 +4 -4
- data/Gemfile.lock +2 -0
- data/lib/multimarkdown-cli.rb +21 -13
- data/lib/multimarkdown-cli/tilt_plugin.rb +33 -0
- data/lib/multimarkdown-cli/version.rb +1 -1
- data/multimarkdown-cli.gemspec +1 -0
- data/test/all_tests.rb +3 -0
- data/test/{test_writer.rb → mmd_test_suite_builder.rb} +0 -0
- data/test/test_beamer.rb +1 -1
- data/test/test_compat.rb +1 -1
- data/test/test_markdown.rb +1 -1
- data/test/test_memoir.rb +1 -1
- data/test/test_mmd.rb +1 -1
- data/test/test_module.rb +23 -0
- data/test/test_tilt_integration.rb +14 -0
- metadata +23 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6c1f95e85980744337201d4d206b483819bc3f99
|
4
|
+
data.tar.gz: aa8014cd7c02b996dae1b141a393ba3a0d87c996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c802db048bbb13a05f6d527a684d0172b7f8151e2520238bcfbb3b22327a44ff11e68c19661c3d714fb92650f62a0b9e8b2e5a2dd50bd124cd722f4dc573ce5b
|
7
|
+
data.tar.gz: 06138fd60fc9ff1e8a40cbaf370e412c152441b25fea33a276d3b2004b1ada651f90de7b77329e926986466013d276b09b3ddaa09d2101f7d53e4c5c52fe936c
|
data/Gemfile.lock
CHANGED
data/lib/multimarkdown-cli.rb
CHANGED
@@ -1,21 +1,29 @@
|
|
1
1
|
require "multimarkdown-cli/version"
|
2
|
+
require "multimarkdown-cli/tilt_plugin"
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
module MultiMarkdownCLI
|
5
|
+
def self._cli_installed?
|
6
|
+
# from http://stackoverflow.com/questions/2108727/which-in-ruby-checking-if-program-exists-in-path-from-ruby
|
7
|
+
exts = ENV['PATHEXT'] ? ENV['PATHEXT'].split(';') : ['']
|
8
|
+
mmd_cmd_found = false
|
9
|
+
ENV['PATH'].split(File::PATH_SEPARATOR).each do |path|
|
10
|
+
exts.each do |ext|
|
11
|
+
exe = File.join(path, "multimarkdown#{ext}")
|
12
|
+
if File.executable? exe
|
13
|
+
mmd_cmd_found = true
|
14
|
+
break
|
15
|
+
end
|
16
|
+
end
|
13
17
|
end
|
18
|
+
mmd_cmd_found
|
14
19
|
end
|
15
|
-
end
|
16
|
-
raise "Can't find the multimarkdown command in your path. Please install it" if !mmd_cmd_found
|
17
20
|
|
18
|
-
|
21
|
+
# check that the command line tool is installed when requiring
|
22
|
+
unless _cli_installed?
|
23
|
+
raise LoadError.new("Can't find the multimarkdown command in your path. Please install it")
|
24
|
+
end
|
25
|
+
|
26
|
+
|
19
27
|
class Parser
|
20
28
|
attr_reader :source
|
21
29
|
|
@@ -0,0 +1,33 @@
|
|
1
|
+
|
2
|
+
require 'tilt' unless defined? Tilt
|
3
|
+
|
4
|
+
require 'multimarkdown-cli'
|
5
|
+
|
6
|
+
module MultiMarkdownCLI
|
7
|
+
class Template < Tilt::Template
|
8
|
+
|
9
|
+
def self.engine_initialized?
|
10
|
+
require 'multimarkdown-cli'
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize_engine
|
14
|
+
end
|
15
|
+
|
16
|
+
def prepare
|
17
|
+
@source = data
|
18
|
+
end
|
19
|
+
|
20
|
+
def evaluate(scope, locals, &block)
|
21
|
+
parser = MultiMarkdownCLI::Parser.new(@source, :snippet)
|
22
|
+
parser.to_html
|
23
|
+
end
|
24
|
+
|
25
|
+
def allows_script?
|
26
|
+
false
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
Tilt.register Template, 'multimarkdown'
|
31
|
+
end
|
32
|
+
|
33
|
+
|
data/multimarkdown-cli.gemspec
CHANGED
data/test/all_tests.rb
CHANGED
File without changes
|
data/test/test_beamer.rb
CHANGED
data/test/test_compat.rb
CHANGED
data/test/test_markdown.rb
CHANGED
data/test/test_memoir.rb
CHANGED
data/test/test_mmd.rb
CHANGED
data/test/test_module.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
|
2
|
+
$: << File.join(File.dirname(__FILE__), "../lib")
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
class ModuleSuiteTest < Test::Unit::TestCase
|
7
|
+
|
8
|
+
# make sure the module throws an exception on import if
|
9
|
+
# the multimarkdown command can't be found
|
10
|
+
def test_import_exception
|
11
|
+
# blow out the path so that the command won't be found
|
12
|
+
old_path = ENV['PATH']
|
13
|
+
begin
|
14
|
+
ENV['PATH'] = ''
|
15
|
+
assert_raise LoadError do
|
16
|
+
require 'multimarkdown-cli'
|
17
|
+
end
|
18
|
+
ensure
|
19
|
+
ENV['PATH'] = old_path
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,14 @@
|
|
1
|
+
|
2
|
+
$: << File.join(File.dirname(__FILE__), "../lib")
|
3
|
+
|
4
|
+
require 'test/unit'
|
5
|
+
|
6
|
+
require 'multimarkdown-cli'
|
7
|
+
|
8
|
+
class TiltIntegrationSuiteTest < Test::Unit::TestCase
|
9
|
+
|
10
|
+
def test_registered_extension
|
11
|
+
assert_equal MultiMarkdownCLI::Template, Tilt['test.multimarkdown']
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: multimarkdown-cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Thomas Torsney-Weir
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -38,6 +38,20 @@ dependencies:
|
|
38
38
|
- - '>='
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: tilt
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
41
55
|
description: |2
|
42
56
|
A Ruby extension that can process MultiMarkdown-formatted
|
43
57
|
text using the multimarkdown command line tool.
|
@@ -55,15 +69,18 @@ files:
|
|
55
69
|
- README.md
|
56
70
|
- Rakefile
|
57
71
|
- lib/multimarkdown-cli.rb
|
72
|
+
- lib/multimarkdown-cli/tilt_plugin.rb
|
58
73
|
- lib/multimarkdown-cli/version.rb
|
59
74
|
- multimarkdown-cli.gemspec
|
60
75
|
- test/all_tests.rb
|
76
|
+
- test/mmd_test_suite_builder.rb
|
61
77
|
- test/test_beamer.rb
|
62
78
|
- test/test_compat.rb
|
63
79
|
- test/test_markdown.rb
|
64
80
|
- test/test_memoir.rb
|
65
81
|
- test/test_mmd.rb
|
66
|
-
- test/
|
82
|
+
- test/test_module.rb
|
83
|
+
- test/test_tilt_integration.rb
|
67
84
|
homepage: https://github.com/gabysbrain/rb-MultiMarkdown-4
|
68
85
|
licenses:
|
69
86
|
- MIT
|
@@ -90,9 +107,11 @@ specification_version: 4
|
|
90
107
|
summary: An interface to the multimarkdown command line tool
|
91
108
|
test_files:
|
92
109
|
- test/all_tests.rb
|
110
|
+
- test/mmd_test_suite_builder.rb
|
93
111
|
- test/test_beamer.rb
|
94
112
|
- test/test_compat.rb
|
95
113
|
- test/test_markdown.rb
|
96
114
|
- test/test_memoir.rb
|
97
115
|
- test/test_mmd.rb
|
98
|
-
- test/
|
116
|
+
- test/test_module.rb
|
117
|
+
- test/test_tilt_integration.rb
|