jekyll-org 1.0.2 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.org +18 -4
- data/VERSION +1 -1
- data/jekyll-org.gemspec +4 -4
- data/lib/jekyll-org.rb +74 -49
- metadata +3 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e8867c7504d6f7a0543a5f9964076c2bda053cccf1cc2064eaa2625faf1a68b9
|
4
|
+
data.tar.gz: '087b4270646205c5c7a9129cc4a70df21c8904f8e44bbab81833a51af768435e'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5125e60fff01be04c2023a0184a7700a66be2ab7b9ba8b72ebbcaf219233f46b932505335001d0c63a876270c19a23f28f931696bc27e0b340ff92c5d648850a
|
7
|
+
data.tar.gz: 6233e0e5100393fba66ec0457b209ea9ae385e3213f543228f421eca9d14559e28bbb24f1b58ea738c04181c34bfff526a7bdaad55324be9175766baedff2baa
|
data/README.org
CHANGED
@@ -37,7 +37,7 @@ following lines:
|
|
37
37
|
source 'https://rubygems.org'
|
38
38
|
|
39
39
|
gem 'jekyll' , '>= 3.0.0'
|
40
|
-
gem 'jekyll-org', '>= 1.0
|
40
|
+
gem 'jekyll-org', '>= 1.1.0'
|
41
41
|
#+end_src
|
42
42
|
|
43
43
|
Install the gems with bundler:
|
@@ -49,7 +49,7 @@ bundle install
|
|
49
49
|
To use the new converter add the following line to your ~_config.yml~:
|
50
50
|
|
51
51
|
#+begin_src yml
|
52
|
-
|
52
|
+
plugins:
|
53
53
|
- jekyll-org
|
54
54
|
#+end_src
|
55
55
|
|
@@ -65,12 +65,15 @@ with no lines:
|
|
65
65
|
|
66
66
|
#+BEGIN_EXAMPLE
|
67
67
|
#+TITLE: Jekyll and Org together
|
68
|
-
#+LAYOUT:
|
69
|
-
#+TAGS: jekyll org-mode
|
68
|
+
#+LAYOUT: post
|
69
|
+
#+TAGS: jekyll org-mode "tag with spaces"
|
70
70
|
|
71
71
|
This is a blog post about Jekyll and Org mode.
|
72
72
|
#+END_EXAMPLE
|
73
73
|
|
74
|
+
The value of =#+TAGS= is parsed into a list by splitting it on spaces,
|
75
|
+
tags containing spaces can be wrapped into quotes.
|
76
|
+
|
74
77
|
** Liquid templating
|
75
78
|
|
76
79
|
By default the all content is exported to raw HTML with org-ruby, but
|
@@ -99,6 +102,17 @@ then you will get output like
|
|
99
102
|
<p>2014-07-02T08:20:28+08:00</p>
|
100
103
|
#+END_EXAMPLE
|
101
104
|
|
105
|
+
*** Site wide config
|
106
|
+
|
107
|
+
Alternatively, if you'd rather enable liquid by default for every
|
108
|
+
org file being converted, you can enable it in your /_config.yml/
|
109
|
+
file.
|
110
|
+
|
111
|
+
#+BEGIN_EXAMPLE
|
112
|
+
org:
|
113
|
+
liquid: true
|
114
|
+
#+END_EXAMPLE
|
115
|
+
|
102
116
|
** Source code highlighting
|
103
117
|
|
104
118
|
Add a source code block as you would in Org, for example Ruby:
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0
|
1
|
+
1.1.0
|
data/jekyll-org.gemspec
CHANGED
@@ -2,16 +2,16 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: jekyll-org 1.0
|
5
|
+
# stub: jekyll-org 1.1.0 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "jekyll-org".freeze
|
9
|
-
s.version = "1.0
|
9
|
+
s.version = "1.1.0"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["eggcaker".freeze]
|
14
|
-
s.date = "
|
14
|
+
s.date = "2019-12-11"
|
15
15
|
s.description = "So you want org-mode support for Jekyll. Write your _posts in org-mode, then add 'gems: [jekyll-org]' to your _config.yml. Thats it!".freeze
|
16
16
|
s.email = "eggcaker@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
@@ -36,7 +36,7 @@ Gem::Specification.new do |s|
|
|
36
36
|
]
|
37
37
|
s.homepage = "http://eggcaker.github.io/jekyll-org".freeze
|
38
38
|
s.licenses = ["MIT".freeze]
|
39
|
-
s.rubygems_version = "
|
39
|
+
s.rubygems_version = "3.0.3".freeze
|
40
40
|
s.summary = "Jekyll converter for org-mode files".freeze
|
41
41
|
|
42
42
|
if s.respond_to? :specification_version then
|
data/lib/jekyll-org.rb
CHANGED
@@ -1,13 +1,13 @@
|
|
1
|
+
require 'csv'
|
1
2
|
require 'org-ruby'
|
2
3
|
|
3
|
-
if Jekyll::VERSION <
|
4
|
-
raise Jekyll::FatalException,
|
4
|
+
if Jekyll::VERSION < '3.0'
|
5
|
+
raise Jekyll::FatalException, 'This version of jekyll-org is only compatible with Jekyll v3 and above.'
|
5
6
|
end
|
6
7
|
|
7
8
|
module Jekyll
|
8
9
|
class OrgConverter < Converter
|
9
10
|
safe true
|
10
|
-
|
11
11
|
priority :low
|
12
12
|
|
13
13
|
def matches(ext)
|
@@ -15,7 +15,7 @@ module Jekyll
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def output_ext(ext)
|
18
|
-
|
18
|
+
'.html'
|
19
19
|
end
|
20
20
|
|
21
21
|
def convert(content)
|
@@ -31,65 +31,90 @@ module Jekyll
|
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
DATE_FILENAME_MATCHER = %r!^(?:.+/)*(\d{4}-\d{2}-\d{2})-(.*)(\.[^.]+)$!
|
34
|
+
module OrgDocument
|
35
|
+
def org_file?
|
36
|
+
extname.eql?(".org")
|
37
|
+
end
|
39
38
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
39
|
+
def site
|
40
|
+
@site ||= Jekyll.configuration({})
|
41
|
+
end
|
42
|
+
|
43
|
+
def org_config
|
44
|
+
site.config["org"] || Hash.new()
|
45
|
+
end
|
45
46
|
|
46
|
-
|
47
|
+
# see https://github.com/bdewey/org-ruby/blob/master/lib/org-ruby/parser.rb
|
48
|
+
def _org_parser_options
|
49
|
+
org_config.fetch("_org_parser_options", { markup_file: 'html.tags.yml' })
|
50
|
+
end
|
51
|
+
|
52
|
+
## override: read file & parse YAML... in this case, don't parse YAML
|
53
|
+
# see also: https://github.com/jekyll/jekyll/blob/master/lib/jekyll/document.rb
|
54
|
+
def read_content(opts = {})
|
55
|
+
return super unless org_file? # defer to default behaviour when not org file
|
47
56
|
|
48
57
|
self.content = File.read(path, Utils.merged_file_read_opts(site, opts))
|
49
|
-
self.data ||= {}
|
50
|
-
liquid_enabled = false
|
51
58
|
|
52
|
-
org_text = Orgmode::Parser.new(content,
|
59
|
+
org_text = Orgmode::Parser.new(content, _org_parser_options)
|
60
|
+
@liquid_enabled = org_config.fetch("liquid", false)
|
61
|
+
|
53
62
|
org_text.in_buffer_settings.each_pair do |key, value|
|
54
63
|
# Remove #+TITLE from the buffer settings to avoid double exporting
|
55
64
|
org_text.in_buffer_settings.delete(key) if key =~ /title/i
|
56
|
-
|
65
|
+
org_assign_setting(key, value)
|
66
|
+
end
|
57
67
|
|
58
|
-
|
59
|
-
|
60
|
-
end
|
68
|
+
self.content = _org_buffer_handle_liquid(org_text)
|
69
|
+
end
|
61
70
|
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
+
def org_assign_setting(key, value)
|
72
|
+
key = key.downcase
|
73
|
+
|
74
|
+
case key
|
75
|
+
when "liquid"
|
76
|
+
value = _parse_boolean_value(value, "unknown LIQUID setting")
|
77
|
+
@liquid_enabled = value unless value.nil?
|
78
|
+
when "tags", "categories"
|
79
|
+
# Parse a string of tags separated by spaces into a list.
|
80
|
+
# Tags containing spaces can be wrapped in quotes,
|
81
|
+
# e.g. '#+TAGS: foo "with spaces"'.
|
82
|
+
#
|
83
|
+
# The easiest way to do this is to use rubys builtin csv parser
|
84
|
+
# and use spaces instead of commas as column separator.
|
85
|
+
self.data[key] = CSV::parse_line(value, col_sep: ' ')
|
86
|
+
else
|
87
|
+
value_bool = _parse_boolean_value(value)
|
88
|
+
self.data[key] = (value_bool.nil?) ? value : value_bool
|
71
89
|
end
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
if liquid_enabled
|
78
|
-
|
79
|
-
self.content = self.content.gsub("‘","'")
|
80
|
-
self.content = self.content.gsub("’", "'")
|
90
|
+
end
|
91
|
+
|
92
|
+
# format the org buffer text by enabling or disabling
|
93
|
+
# the presence of liquid tags.
|
94
|
+
def _org_buffer_handle_liquid(org_text)
|
95
|
+
if @liquid_enabled
|
96
|
+
org_text.to_html.gsub("‘", "'").gsub("’", "'")
|
81
97
|
else
|
82
|
-
|
83
|
-
'{% raw %}',
|
84
|
-
org_text.to_html,
|
85
|
-
'{% endraw %}'
|
86
|
-
].join(" ")
|
98
|
+
'{% raw %} ' + org_text.to_html + ' {% endraw %}'
|
87
99
|
end
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
100
|
+
end
|
101
|
+
|
102
|
+
@@truthy_regexps = [/enabled/, /yes/, /true/]
|
103
|
+
@@falsy_regexps = [/disabled/, /no/, /false/]
|
104
|
+
|
105
|
+
def _parse_boolean_value(value, error_msg=nil)
|
106
|
+
case value.downcase
|
107
|
+
when *@@truthy_regexps
|
108
|
+
true
|
109
|
+
when *@@falsy_regexps
|
110
|
+
false
|
111
|
+
else
|
112
|
+
unless error_msg.nil?
|
113
|
+
Jekyll.logger.warn("OrgDocument:", error_msg + ": #{value}")
|
114
|
+
end
|
92
115
|
end
|
93
116
|
end
|
94
117
|
end
|
95
118
|
end
|
119
|
+
|
120
|
+
Jekyll::Document.prepend(Jekyll::OrgDocument)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jekyll-org
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- eggcaker
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-12-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: org-ruby
|
@@ -178,8 +178,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
178
178
|
- !ruby/object:Gem::Version
|
179
179
|
version: '0'
|
180
180
|
requirements: []
|
181
|
-
|
182
|
-
rubygems_version: 2.6.14
|
181
|
+
rubygems_version: 3.0.3
|
183
182
|
signing_key:
|
184
183
|
specification_version: 4
|
185
184
|
summary: Jekyll converter for org-mode files
|