jekyll-pandoc 1.0.2 → 2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +13 -5
- data/lib/jekyll-pandoc.rb +32 -2
- data/lib/jekyll-pandoc/version.rb +1 -1
- metadata +34 -36
- data/lib/jekyll/converters/markdown.rb +0 -34
- data/lib/jekyll/converters/markdown/pandoc_parser.rb +0 -38
checksums.yaml
CHANGED
@@ -1,7 +1,15 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MGYyN2FhN2M4MmU2M2Y2MTE3NDU3MzQ5MDcwMTgxOTE5ZDgwMzFjYg==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
MDhlZGM1NDMzZTQzOGU2NWVhM2U0ODM5ZGJhNmRjZmFiOTc1M2I5MQ==
|
5
7
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
ZjliNzZkMDJiMjQ4ODM2OWY5NzJlNzcwMTAwNjY0MTU1NDA2MzZmM2I5NDM3
|
10
|
+
MTUwNmVhZDA2ODkwZmQ4NjYxMmFlZDE4YTRlZjgxMjdmOTZmZTczM2Y2ODM5
|
11
|
+
YjZkM2VhZjFiM2ZlYTA3OTg3YjQzMGJhMDQzYjI4MmY0MjY5N2M=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
ODEyMmMwZjIzMTYwNDQ3NjY1MzAwMzU5ZDg2Zjc3ZTNiZTJjNjU0YmE2NmIy
|
14
|
+
NGUwZTFhNWJlODJlMDlhYzc0MTEzYTIxYmI1MThmZGVhNDI2OTJmYTg5OWI0
|
15
|
+
NmIxZTk3NjZhM2NlOGU5NDFmNzhiMjM2NmYxMmJjODMyZjFkMjg=
|
data/lib/jekyll-pandoc.rb
CHANGED
@@ -1,2 +1,32 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
module Jekyll
|
2
|
+
module Converters
|
3
|
+
class Markdown::Pandoc
|
4
|
+
DEFAULT_EXTENSIONS = []
|
5
|
+
DEFAULT_FORMAT = 'html5'
|
6
|
+
|
7
|
+
def initialize(config)
|
8
|
+
Jekyll::External.require_with_graceful_fail "pandoc-ruby"
|
9
|
+
|
10
|
+
@config = config
|
11
|
+
end
|
12
|
+
|
13
|
+
def convert(content)
|
14
|
+
extensions = config_option('extensions', DEFAULT_EXTENSIONS)
|
15
|
+
format = config_option('format', DEFAULT_FORMAT)
|
16
|
+
|
17
|
+
content = PandocRuby.new(content, *extensions).send("to_#{format}")
|
18
|
+
raise Erros::FatalException, "Conversion returned empty string" unless content.length > 0
|
19
|
+
content
|
20
|
+
end
|
21
|
+
|
22
|
+
def config_option(key, default=nil)
|
23
|
+
if @config['pandoc']
|
24
|
+
@config.fetch('pandoc', {}).fetch(key, default)
|
25
|
+
else
|
26
|
+
default
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,113 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-pandoc
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: '2.0'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Martin Fenner
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: jekyll
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ~>
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
20
|
-
- -
|
19
|
+
version: '3.1'
|
20
|
+
- - ! '>='
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version:
|
22
|
+
version: 3.1.3
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '
|
30
|
-
- -
|
29
|
+
version: '3.1'
|
30
|
+
- - ! '>='
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version:
|
32
|
+
version: 3.1.3
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pandoc-ruby
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
36
36
|
requirements:
|
37
|
-
- -
|
37
|
+
- - ~>
|
38
38
|
- !ruby/object:Gem::Version
|
39
|
-
version: '
|
40
|
-
- -
|
39
|
+
version: '2.0'
|
40
|
+
- - ! '>='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version:
|
42
|
+
version: 2.0.0
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
|
-
- -
|
47
|
+
- - ~>
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version: '
|
50
|
-
- -
|
49
|
+
version: '2.0'
|
50
|
+
- - ! '>='
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version:
|
52
|
+
version: 2.0.0
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: rake
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
56
56
|
requirements:
|
57
|
-
- -
|
57
|
+
- - ~>
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: '0'
|
60
60
|
type: :development
|
61
61
|
prerelease: false
|
62
62
|
version_requirements: !ruby/object:Gem::Requirement
|
63
63
|
requirements:
|
64
|
-
- -
|
64
|
+
- - ~>
|
65
65
|
- !ruby/object:Gem::Version
|
66
66
|
version: '0'
|
67
67
|
- !ruby/object:Gem::Dependency
|
68
68
|
name: rspec
|
69
69
|
requirement: !ruby/object:Gem::Requirement
|
70
70
|
requirements:
|
71
|
-
- -
|
71
|
+
- - ~>
|
72
72
|
- !ruby/object:Gem::Version
|
73
|
-
version: '3.
|
73
|
+
version: '3.4'
|
74
74
|
type: :development
|
75
75
|
prerelease: false
|
76
76
|
version_requirements: !ruby/object:Gem::Requirement
|
77
77
|
requirements:
|
78
|
-
- -
|
78
|
+
- - ~>
|
79
79
|
- !ruby/object:Gem::Version
|
80
|
-
version: '3.
|
80
|
+
version: '3.4'
|
81
81
|
- !ruby/object:Gem::Dependency
|
82
82
|
name: rdiscount
|
83
83
|
requirement: !ruby/object:Gem::Requirement
|
84
84
|
requirements:
|
85
|
-
- -
|
85
|
+
- - ~>
|
86
86
|
- !ruby/object:Gem::Version
|
87
87
|
version: '2.1'
|
88
|
-
- -
|
88
|
+
- - ! '>='
|
89
89
|
- !ruby/object:Gem::Version
|
90
90
|
version: 2.1.8
|
91
91
|
type: :development
|
92
92
|
prerelease: false
|
93
93
|
version_requirements: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
|
-
- -
|
95
|
+
- - ~>
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: '2.1'
|
98
|
-
- -
|
98
|
+
- - ! '>='
|
99
99
|
- !ruby/object:Gem::Version
|
100
100
|
version: 2.1.8
|
101
101
|
description: A Jekyll markdown converter that uses Pandoc (via the pandoc-ruby gem).
|
102
|
-
email:
|
102
|
+
email: mfenner@datacite.org
|
103
103
|
executables: []
|
104
104
|
extensions: []
|
105
105
|
extra_rdoc_files: []
|
106
106
|
files:
|
107
107
|
- lib/jekyll-pandoc.rb
|
108
108
|
- lib/jekyll-pandoc/version.rb
|
109
|
-
- lib/jekyll/converters/markdown.rb
|
110
|
-
- lib/jekyll/converters/markdown/pandoc_parser.rb
|
111
109
|
homepage: https://github.com/mfenner/jekyll-pandoc
|
112
110
|
licenses:
|
113
111
|
- MIT
|
@@ -118,17 +116,17 @@ require_paths:
|
|
118
116
|
- lib
|
119
117
|
required_ruby_version: !ruby/object:Gem::Requirement
|
120
118
|
requirements:
|
121
|
-
- -
|
119
|
+
- - ! '>='
|
122
120
|
- !ruby/object:Gem::Version
|
123
|
-
version:
|
121
|
+
version: '2.2'
|
124
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
123
|
requirements:
|
126
|
-
- -
|
124
|
+
- - ! '>='
|
127
125
|
- !ruby/object:Gem::Version
|
128
|
-
version:
|
126
|
+
version: '0'
|
129
127
|
requirements: []
|
130
128
|
rubyforge_project:
|
131
|
-
rubygems_version: 2.
|
129
|
+
rubygems_version: 2.5.1
|
132
130
|
signing_key:
|
133
131
|
specification_version: 4
|
134
132
|
summary: Jekyll Pandoc markdown converter
|
@@ -1,34 +0,0 @@
|
|
1
|
-
# monkey patch Jekyll Markdown setup method for compatibility
|
2
|
-
module Jekyll
|
3
|
-
module Converters
|
4
|
-
class Markdown
|
5
|
-
|
6
|
-
PARSERS = { 'redcarpet' => RedcarpetParser,
|
7
|
-
'kramdown' => KramdownParser,
|
8
|
-
'rdiscount' => RDiscountParser }
|
9
|
-
|
10
|
-
def setup
|
11
|
-
return if @setup
|
12
|
-
@parser = parser(@config['markdown']).new(@config)
|
13
|
-
@setup = true
|
14
|
-
rescue NameError
|
15
|
-
Jekyll.logger.error "Invalid Markdown Processor:", "#{@config['markdown']}"
|
16
|
-
Jekyll.logger.error "", "Valid options are [ #{PARSERS.keys.join(" | ")} ]"
|
17
|
-
raise Jekyll::Errors::FatalException, "Invalid Markdown Processor: #{@config['markdown']}"
|
18
|
-
end
|
19
|
-
|
20
|
-
private
|
21
|
-
|
22
|
-
def parser(name)
|
23
|
-
if PARSERS.keys.include?(name.downcase)
|
24
|
-
PARSERS[name.downcase]
|
25
|
-
elsif name =~ /[^A-Za-z0-9]/
|
26
|
-
InvalidParser
|
27
|
-
else
|
28
|
-
eval "#{name.capitalize}Parser"
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
@@ -1,38 +0,0 @@
|
|
1
|
-
module Jekyll
|
2
|
-
module Converters
|
3
|
-
class Markdown
|
4
|
-
class PandocParser
|
5
|
-
|
6
|
-
DEFAULT_EXTENSIONS = []
|
7
|
-
DEFAULT_FORMAT = 'html5'
|
8
|
-
|
9
|
-
def initialize(config)
|
10
|
-
require 'pandoc-ruby'
|
11
|
-
@config = config
|
12
|
-
rescue LoadError
|
13
|
-
STDERR.puts 'You are missing a library required for Pandoc. Please run:'
|
14
|
-
STDERR.puts ' $ [sudo] gem install pandoc-ruby'
|
15
|
-
raise Errors::FatalException, "Missing dependency: pandoc-ruby"
|
16
|
-
end
|
17
|
-
|
18
|
-
def convert(content)
|
19
|
-
extensions = config_option('extensions', DEFAULT_EXTENSIONS)
|
20
|
-
format = config_option('format', DEFAULT_FORMAT)
|
21
|
-
|
22
|
-
content = PandocRuby.new(content, *extensions).send("to_#{format}")
|
23
|
-
raise Erros::FatalException, "Conversion returned empty string" unless content.length > 0
|
24
|
-
content
|
25
|
-
end
|
26
|
-
|
27
|
-
def config_option(key, default=nil)
|
28
|
-
if @config['pandoc']
|
29
|
-
@config['pandoc'].fetch(key, default)
|
30
|
-
else
|
31
|
-
default
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|