monad 0.0.2 → 0.0.3
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/CONTRIBUTING.markdown +91 -0
- data/Gemfile +1 -1
- data/History.markdown +772 -0
- data/{README.md → README.markdown} +5 -2
- data/Rakefile +163 -1
- data/bin/monad +86 -30
- data/features/create_sites.feature +54 -25
- data/features/data.feature +65 -0
- data/features/data_sources.feature +10 -10
- data/features/drafts.feature +5 -5
- data/features/embed_filters.feature +10 -10
- data/features/include_tag.feature +48 -0
- data/features/markdown.feature +5 -5
- data/features/pagination.feature +38 -10
- data/features/permalinks.feature +31 -11
- data/features/post_data.feature +41 -41
- data/features/post_excerpts.feature +50 -0
- data/features/site_configuration.feature +47 -26
- data/features/site_data.feature +30 -24
- data/features/step_definitions/{monad_steps.rb → jekyll_steps.rb} +66 -52
- data/features/support/env.rb +27 -8
- data/lib/jekyll.rb +99 -0
- data/lib/jekyll/cleaner.rb +73 -0
- data/lib/{monad → jekyll}/command.rb +6 -6
- data/lib/{monad → jekyll}/commands/build.rb +9 -9
- data/lib/jekyll/commands/doctor.rb +67 -0
- data/lib/jekyll/commands/new.rb +67 -0
- data/lib/jekyll/commands/serve.rb +65 -0
- data/lib/{monad → jekyll}/configuration.rb +60 -18
- data/lib/{monad → jekyll}/converter.rb +1 -1
- data/lib/{monad → jekyll}/converters/identity.rb +1 -1
- data/lib/{monad → jekyll}/converters/markdown.rb +2 -2
- data/lib/jekyll/converters/markdown/kramdown_parser.rb +29 -0
- data/lib/{monad → jekyll}/converters/markdown/maruku_parser.rb +12 -8
- data/lib/{monad → jekyll}/converters/markdown/rdiscount_parser.rb +4 -2
- data/lib/{monad → jekyll}/converters/markdown/redcarpet_parser.rb +1 -1
- data/lib/{monad → jekyll}/converters/textile.rb +1 -1
- data/lib/{monad → jekyll}/convertible.rb +39 -17
- data/lib/{monad → jekyll}/core_ext.rb +22 -4
- data/lib/jekyll/deprecator.rb +36 -0
- data/lib/{monad → jekyll}/draft.rb +1 -1
- data/lib/{monad → jekyll}/drivers/json_driver.rb +1 -1
- data/lib/{monad → jekyll}/drivers/yaml_driver.rb +1 -1
- data/lib/{monad → jekyll}/errors.rb +1 -1
- data/lib/jekyll/excerpt.rb +113 -0
- data/lib/{monad → jekyll}/filters.rb +16 -6
- data/lib/{monad → jekyll}/generator.rb +1 -1
- data/lib/jekyll/generators/pagination.rb +214 -0
- data/lib/{monad → jekyll}/layout.rb +4 -1
- data/lib/{monad → jekyll}/mime.types +0 -0
- data/lib/{monad → jekyll}/page.rb +36 -39
- data/lib/{monad → jekyll}/plugin.rb +1 -1
- data/lib/{monad → jekyll}/post.rb +58 -123
- data/lib/jekyll/related_posts.rb +59 -0
- data/lib/{monad → jekyll}/site.rb +120 -123
- data/lib/{monad → jekyll}/static_file.rb +1 -1
- data/lib/jekyll/stevenson.rb +89 -0
- data/lib/jekyll/tags/gist.rb +48 -0
- data/lib/{monad → jekyll}/tags/highlight.rb +3 -3
- data/lib/jekyll/tags/include.rb +135 -0
- data/lib/{monad → jekyll}/tags/post_url.rb +8 -6
- data/lib/jekyll/url.rb +67 -0
- data/lib/monad.rb +36 -27
- data/lib/site_template/_config.yml +2 -1
- data/lib/site_template/_layouts/default.html +21 -23
- data/lib/site_template/_layouts/post.html +1 -1
- data/lib/site_template/_posts/{0000-00-00-welcome-to-monad.markdown.erb → 0000-00-00-welcome-to-jekyll.markdown.erb} +6 -6
- data/lib/site_template/css/main.css +22 -27
- data/lib/site_template/index.html +2 -2
- data/monad.gemspec +153 -52
- data/site/.gitignore +4 -0
- data/site/CNAME +1 -0
- data/site/README +1 -0
- data/site/_config.yml +6 -0
- data/site/_includes/analytics.html +32 -0
- data/site/_includes/docs_contents.html +16 -0
- data/site/_includes/docs_contents_mobile.html +23 -0
- data/site/_includes/docs_option.html +11 -0
- data/site/_includes/docs_ul.html +20 -0
- data/site/_includes/footer.html +15 -0
- data/site/_includes/header.html +18 -0
- data/site/_includes/news_contents.html +23 -0
- data/site/_includes/news_contents_mobile.html +11 -0
- data/site/_includes/news_item.html +24 -0
- data/site/_includes/primary-nav-items.html +14 -0
- data/site/_includes/section_nav.html +22 -0
- data/site/_includes/top.html +17 -0
- data/site/_layouts/default.html +12 -0
- data/site/_layouts/docs.html +23 -0
- data/site/_layouts/news.html +19 -0
- data/site/_layouts/news_item.html +27 -0
- data/site/_posts/2013-05-06-jekyll-1-0-0-released.markdown +23 -0
- data/site/_posts/2013-05-08-jekyll-1-0-1-released.markdown +27 -0
- data/site/_posts/2013-05-12-jekyll-1-0-2-released.markdown +28 -0
- data/site/_posts/2013-06-07-jekyll-1-0-3-released.markdown +25 -0
- data/site/_posts/2013-07-14-jekyll-1-1-0-released.markdown +27 -0
- data/site/_posts/2013-07-24-jekyll-1-1-1-released.markdown +31 -0
- data/site/_posts/2013-07-25-jekyll-1-0-4-released.markdown +20 -0
- data/site/_posts/2013-07-25-jekyll-1-1-2-released.markdown +20 -0
- data/site/_posts/2013-09-06-jekyll-1-2-0-released.markdown +23 -0
- data/site/_posts/2013-09-14-jekyll-1-2-1-released.markdown +19 -0
- data/site/css/gridism.css +110 -0
- data/site/css/normalize.css +1 -0
- data/site/css/pygments.css +70 -0
- data/site/css/style.css +946 -0
- data/site/docs/configuration.md +373 -0
- data/site/docs/contributing.md +128 -0
- data/site/docs/datafiles.md +63 -0
- data/site/docs/deployment-methods.md +109 -0
- data/site/docs/drafts.md +20 -0
- data/site/docs/extras.md +56 -0
- data/site/docs/frontmatter.md +180 -0
- data/site/docs/github-pages.md +91 -0
- data/site/docs/heroku.md +9 -0
- data/site/docs/history.md +722 -0
- data/site/docs/index.md +52 -0
- data/site/docs/installation.md +76 -0
- data/site/docs/migrations.md +257 -0
- data/site/docs/pages.md +86 -0
- data/site/docs/pagination.md +211 -0
- data/site/docs/permalinks.md +180 -0
- data/site/docs/plugins.md +508 -0
- data/site/docs/posts.md +181 -0
- data/site/docs/quickstart.md +32 -0
- data/site/docs/resources.md +46 -0
- data/site/docs/sites.md +29 -0
- data/site/docs/structure.md +190 -0
- data/site/docs/templates.md +319 -0
- data/site/docs/troubleshooting.md +150 -0
- data/site/docs/upgrading.md +146 -0
- data/site/docs/usage.md +63 -0
- data/site/docs/variables.md +322 -0
- data/site/favicon.png +0 -0
- data/site/feed.xml +36 -0
- data/site/freenode.txt +1 -0
- data/site/img/article-footer.png +0 -0
- data/site/img/footer-arrow.png +0 -0
- data/site/img/footer-logo.png +0 -0
- data/site/img/logo-2x.png +0 -0
- data/site/img/octojekyll.png +0 -0
- data/site/img/tube.png +0 -0
- data/site/img/tube1x.png +0 -0
- data/site/index.html +90 -0
- data/site/js/modernizr-2.5.3.min.js +4 -0
- data/site/news/index.html +10 -0
- data/site/news/releases/index.html +10 -0
- data/test/helper.rb +6 -3
- data/test/source/+/foo.md +7 -0
- data/test/source/_data/languages.yml +2 -0
- data/test/source/_data/members.yaml +7 -0
- data/test/source/_data/products.yml +4 -0
- data/test/source/_includes/params.html +7 -0
- data/test/source/_layouts/default.html +1 -1
- data/test/source/_layouts/post/simple.html +1 -0
- data/test/source/_plugins/dummy.rb +1 -1
- data/test/source/_posts/2013-01-02-post-excerpt.markdown +1 -1
- data/test/source/_posts/2013-07-22-post-excerpt-with-layout.markdown +23 -0
- data/test/source/_posts/2013-08-01-mkdn-extension.mkdn +0 -0
- data/test/source/deal.with.dots.html +1 -1
- data/test/source/products.yml +4 -0
- data/test/test_configuration.rb +46 -11
- data/test/test_convertible.rb +2 -2
- data/test/test_excerpt.rb +78 -0
- data/test/test_filters.rb +4 -4
- data/test/test_generated_site.rb +13 -13
- data/test/test_json_driver.rb +9 -9
- data/test/test_kramdown.rb +32 -5
- data/test/test_new_command.rb +8 -8
- data/test/test_page.rb +12 -3
- data/test/test_pager.rb +34 -33
- data/test/test_post.rb +34 -26
- data/test/test_redcloth.rb +3 -3
- data/test/test_related_posts.rb +47 -0
- data/test/test_site.rb +102 -44
- data/test/test_tags.rb +168 -23
- data/test/test_url.rb +28 -0
- data/test/test_yaml_driver.rb +6 -6
- metadata +215 -137
- data/lib/monad/commands/doctor.rb +0 -29
- data/lib/monad/commands/new.rb +0 -50
- data/lib/monad/commands/serve.rb +0 -33
- data/lib/monad/converters/markdown/kramdown_parser.rb +0 -44
- data/lib/monad/deprecator.rb +0 -32
- data/lib/monad/generators/pagination.rb +0 -143
- data/lib/monad/logger.rb +0 -54
- data/lib/monad/tags/gist.rb +0 -30
- data/lib/monad/tags/include.rb +0 -37
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Gist Liquid Tag
|
|
2
|
+
#
|
|
3
|
+
# Example:
|
|
4
|
+
# {% gist 1234567 %}
|
|
5
|
+
# {% gist 1234567 file.rb %}
|
|
6
|
+
|
|
7
|
+
module Jekyll
|
|
8
|
+
class GistTag < Liquid::Tag
|
|
9
|
+
|
|
10
|
+
def render(context)
|
|
11
|
+
if tag_contents = determine_arguments(@markup.strip)
|
|
12
|
+
gist_id, filename = tag_contents[0], tag_contents[1]
|
|
13
|
+
gist_script_tag(gist_id, filename)
|
|
14
|
+
else
|
|
15
|
+
raise ArgumentError.new <<-eos
|
|
16
|
+
Syntax error in tag 'gist' while parsing the following markup:
|
|
17
|
+
|
|
18
|
+
#{@markup}
|
|
19
|
+
|
|
20
|
+
Valid syntax:
|
|
21
|
+
for public gists: {% gist 1234567 %}
|
|
22
|
+
for private gists: {% gist user/1234567 %}
|
|
23
|
+
eos
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
private
|
|
28
|
+
|
|
29
|
+
def determine_arguments(input)
|
|
30
|
+
matched = if input.include?("/")
|
|
31
|
+
input.match(/\A([a-zA-Z0-9\/\-_]+) ?(\S*)\Z/)
|
|
32
|
+
else
|
|
33
|
+
input.match(/\A(\d+) ?(\S*)\Z/)
|
|
34
|
+
end
|
|
35
|
+
[matched[1].strip, matched[2].strip] if matched && matched.length >= 3
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def gist_script_tag(gist_id, filename = nil)
|
|
39
|
+
if filename.empty?
|
|
40
|
+
"<script src=\"https://gist.github.com/#{gist_id}.js\"> </script>"
|
|
41
|
+
else
|
|
42
|
+
"<script src=\"https://gist.github.com/#{gist_id}.js?file=#{filename}\"> </script>"
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
Liquid::Template.register_tag('gist', Jekyll::GistTag)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Jekyll
|
|
2
2
|
module Tags
|
|
3
3
|
class HighlightBlock < Liquid::Block
|
|
4
4
|
include Liquid::StandardFilters
|
|
@@ -14,7 +14,7 @@ module Monad
|
|
|
14
14
|
def initialize(tag_name, markup, tokens)
|
|
15
15
|
super
|
|
16
16
|
if markup.strip =~ SYNTAX
|
|
17
|
-
@lang = $1
|
|
17
|
+
@lang = $1.downcase
|
|
18
18
|
@options = {}
|
|
19
19
|
if defined?($2) && $2 != ''
|
|
20
20
|
$2.split.each do |opt|
|
|
@@ -82,4 +82,4 @@ eos
|
|
|
82
82
|
end
|
|
83
83
|
end
|
|
84
84
|
|
|
85
|
-
Liquid::Template.register_tag('highlight',
|
|
85
|
+
Liquid::Template.register_tag('highlight', Jekyll::Tags::HighlightBlock)
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
module Jekyll
|
|
2
|
+
module Tags
|
|
3
|
+
class IncludeTagError < StandardError
|
|
4
|
+
attr_accessor :path
|
|
5
|
+
|
|
6
|
+
def initialize(msg, path)
|
|
7
|
+
super(msg)
|
|
8
|
+
@path = path
|
|
9
|
+
end
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
class IncludeTag < Liquid::Tag
|
|
13
|
+
|
|
14
|
+
SYNTAX_EXAMPLE = "{% include file.ext param='value' param2='value' %}"
|
|
15
|
+
|
|
16
|
+
VALID_SYNTAX = /([\w-]+)\s*=\s*(?:"([^"\\]*(?:\\.[^"\\]*)*)"|'([^'\\]*(?:\\.[^'\\]*)*)'|([\w\.-]+))/
|
|
17
|
+
|
|
18
|
+
INCLUDES_DIR = '_includes'
|
|
19
|
+
|
|
20
|
+
def initialize(tag_name, markup, tokens)
|
|
21
|
+
super
|
|
22
|
+
@file, @params = markup.strip.split(' ', 2);
|
|
23
|
+
validate_params if @params
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def parse_params(context)
|
|
27
|
+
params = {}
|
|
28
|
+
markup = @params
|
|
29
|
+
|
|
30
|
+
while match = VALID_SYNTAX.match(markup) do
|
|
31
|
+
markup = markup[match.end(0)..-1]
|
|
32
|
+
|
|
33
|
+
value = if match[2]
|
|
34
|
+
match[2].gsub(/\\"/, '"')
|
|
35
|
+
elsif match[3]
|
|
36
|
+
match[3].gsub(/\\'/, "'")
|
|
37
|
+
elsif match[4]
|
|
38
|
+
context[match[4]]
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
params[match[1]] = value
|
|
42
|
+
end
|
|
43
|
+
params
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def validate_file_name
|
|
47
|
+
if @file !~ /^[a-zA-Z0-9_\/\.-]+$/ || @file =~ /\.\// || @file =~ /\/\./
|
|
48
|
+
raise ArgumentError.new <<-eos
|
|
49
|
+
Invalid syntax for include tag. File contains invalid characters or sequences:
|
|
50
|
+
|
|
51
|
+
#{@file}
|
|
52
|
+
|
|
53
|
+
Valid syntax:
|
|
54
|
+
|
|
55
|
+
#{SYNTAX_EXAMPLE}
|
|
56
|
+
|
|
57
|
+
eos
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
def validate_params
|
|
62
|
+
full_valid_syntax = Regexp.compile('\A\s*(?:' + VALID_SYNTAX.to_s + '(?=\s|\z)\s*)*\z')
|
|
63
|
+
unless @params =~ full_valid_syntax
|
|
64
|
+
raise ArgumentError.new <<-eos
|
|
65
|
+
Invalid syntax for include tag:
|
|
66
|
+
|
|
67
|
+
#{@params}
|
|
68
|
+
|
|
69
|
+
Valid syntax:
|
|
70
|
+
|
|
71
|
+
#{SYNTAX_EXAMPLE}
|
|
72
|
+
|
|
73
|
+
eos
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
# Grab file read opts in the context
|
|
78
|
+
def file_read_opts(context)
|
|
79
|
+
context.registers[:site].file_read_opts
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
def retrieve_variable(context)
|
|
83
|
+
if /\{\{([\w\-\.]+)\}\}/ =~ @file
|
|
84
|
+
raise ArgumentError.new("No variable #{$1} was found in include tag") if context[$1].nil?
|
|
85
|
+
@file = context[$1]
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
def render(context)
|
|
90
|
+
dir = File.join(context.registers[:site].source, INCLUDES_DIR)
|
|
91
|
+
validate_dir(dir, context.registers[:site].safe)
|
|
92
|
+
|
|
93
|
+
retrieve_variable(context)
|
|
94
|
+
validate_file_name
|
|
95
|
+
|
|
96
|
+
file = File.join(dir, @file)
|
|
97
|
+
validate_file(file, context.registers[:site].safe)
|
|
98
|
+
|
|
99
|
+
partial = Liquid::Template.parse(source(file, context))
|
|
100
|
+
|
|
101
|
+
context.stack do
|
|
102
|
+
context['include'] = parse_params(context) if @params
|
|
103
|
+
partial.render!(context)
|
|
104
|
+
end
|
|
105
|
+
rescue => e
|
|
106
|
+
raise IncludeTagError.new e.message, File.join(INCLUDES_DIR, @file)
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
def validate_dir(dir, safe)
|
|
110
|
+
if File.symlink?(dir) && safe
|
|
111
|
+
raise IOError.new "Includes directory '#{dir}' cannot be a symlink"
|
|
112
|
+
end
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
def validate_file(file, safe)
|
|
116
|
+
if !File.exists?(file)
|
|
117
|
+
raise IOError.new "Included file '#{@file}' not found in '#{INCLUDES_DIR}' directory"
|
|
118
|
+
elsif File.symlink?(file) && safe
|
|
119
|
+
raise IOError.new "The included file '#{INCLUDES_DIR}/#{@file}' should not be a symlink"
|
|
120
|
+
end
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
def blank?
|
|
124
|
+
false
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
# This method allows to modify the file content by inheriting from the class.
|
|
128
|
+
def source(file, context)
|
|
129
|
+
File.read_with_options(file, file_read_opts(context))
|
|
130
|
+
end
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
Liquid::Template.register_tag('include', Jekyll::Tags::IncludeTag)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
module
|
|
1
|
+
module Jekyll
|
|
2
2
|
module Tags
|
|
3
3
|
class PostComparer
|
|
4
4
|
MATCHER = /^(.+\/)*(\d+-\d+-\d+)-(.*)$/
|
|
@@ -19,9 +19,9 @@ module Monad
|
|
|
19
19
|
end
|
|
20
20
|
|
|
21
21
|
private
|
|
22
|
-
# Construct the directory-aware post slug for a
|
|
22
|
+
# Construct the directory-aware post slug for a Jekyll::Post
|
|
23
23
|
#
|
|
24
|
-
# other - the
|
|
24
|
+
# other - the Jekyll::Post
|
|
25
25
|
#
|
|
26
26
|
# Returns the post slug with the subdirectory (relative to _posts)
|
|
27
27
|
def post_slug(other)
|
|
@@ -50,12 +50,14 @@ module Monad
|
|
|
50
50
|
end
|
|
51
51
|
end
|
|
52
52
|
|
|
53
|
-
|
|
53
|
+
raise ArgumentError.new <<-eos
|
|
54
|
+
Could not find post "#{@orig_post}" in tag 'post_url'.
|
|
54
55
|
|
|
55
|
-
|
|
56
|
+
Make sure the post exists and the name is correct.
|
|
57
|
+
eos
|
|
56
58
|
end
|
|
57
59
|
end
|
|
58
60
|
end
|
|
59
61
|
end
|
|
60
62
|
|
|
61
|
-
Liquid::Template.register_tag('post_url',
|
|
63
|
+
Liquid::Template.register_tag('post_url', Jekyll::Tags::PostUrl)
|
data/lib/jekyll/url.rb
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
# Public: Methods that generate a URL for a resource such as a Post or a Page.
|
|
2
|
+
#
|
|
3
|
+
# Examples
|
|
4
|
+
#
|
|
5
|
+
# URL.new({
|
|
6
|
+
# :template => /:categories/:title.html",
|
|
7
|
+
# :placeholders => {:categories => "ruby", :title => "something"}
|
|
8
|
+
# }).to_s
|
|
9
|
+
#
|
|
10
|
+
module Jekyll
|
|
11
|
+
class URL
|
|
12
|
+
|
|
13
|
+
# options - One of :permalink or :template must be supplied.
|
|
14
|
+
# :template - The String used as template for URL generation,
|
|
15
|
+
# for example "/:path/:basename:output_ext", where
|
|
16
|
+
# a placeholder is prefixed with a colon.
|
|
17
|
+
# :placeholders - A hash containing the placeholders which will be
|
|
18
|
+
# replaced when used inside the template. E.g.
|
|
19
|
+
# { "year" => Time.now.strftime("%Y") } would replace
|
|
20
|
+
# the placeholder ":year" with the current year.
|
|
21
|
+
# :permalink - If supplied, no URL will be generated from the
|
|
22
|
+
# template. Instead, the given permalink will be
|
|
23
|
+
# used as URL.
|
|
24
|
+
def initialize(options)
|
|
25
|
+
@template = options[:template]
|
|
26
|
+
@placeholders = options[:placeholders] || {}
|
|
27
|
+
@permalink = options[:permalink]
|
|
28
|
+
|
|
29
|
+
if (@template || @permalink).nil?
|
|
30
|
+
raise ArgumentError, "One of :template or :permalink must be supplied."
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
# The generated relative URL of the resource
|
|
35
|
+
#
|
|
36
|
+
# Returns the String URL
|
|
37
|
+
def to_s
|
|
38
|
+
sanitize_url(@permalink || generate_url)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
# Internal: Generate the URL by replacing all placeholders with their
|
|
42
|
+
# respective values
|
|
43
|
+
#
|
|
44
|
+
# Returns the _unsanitizied_ String URL
|
|
45
|
+
def generate_url
|
|
46
|
+
@placeholders.inject(@template) do |result, token|
|
|
47
|
+
result.gsub(/:#{token.first}/, token.last)
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
# Returns a sanitized String URL
|
|
52
|
+
def sanitize_url(in_url)
|
|
53
|
+
# Remove all double slashes
|
|
54
|
+
url = in_url.gsub(/\/\//, "/")
|
|
55
|
+
|
|
56
|
+
# Remove every URL segment that consists solely of dots
|
|
57
|
+
url = url.split('/').reject{ |part| part =~ /^\.+$/ }.join('/')
|
|
58
|
+
|
|
59
|
+
# Append a trailing slash to the URL if the unsanitized URL had one
|
|
60
|
+
url += "/" if in_url =~ /\/$/
|
|
61
|
+
|
|
62
|
+
# Always add a leading slash
|
|
63
|
+
url.gsub!(/\A([^\/])/, '/\1')
|
|
64
|
+
url
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
end
|
data/lib/monad.rb
CHANGED
|
@@ -20,6 +20,7 @@ require 'fileutils'
|
|
|
20
20
|
require 'time'
|
|
21
21
|
require 'safe_yaml'
|
|
22
22
|
require 'English'
|
|
23
|
+
require 'pathname'
|
|
23
24
|
|
|
24
25
|
# 3rd party
|
|
25
26
|
require 'liquid'
|
|
@@ -27,43 +28,47 @@ require 'maruku'
|
|
|
27
28
|
require 'colorator'
|
|
28
29
|
|
|
29
30
|
# internal requires
|
|
30
|
-
require '
|
|
31
|
-
require '
|
|
32
|
-
require '
|
|
33
|
-
require '
|
|
34
|
-
require '
|
|
35
|
-
require '
|
|
36
|
-
require '
|
|
37
|
-
require '
|
|
38
|
-
require '
|
|
39
|
-
require '
|
|
40
|
-
require '
|
|
41
|
-
require '
|
|
42
|
-
require '
|
|
31
|
+
require 'jekyll/core_ext'
|
|
32
|
+
require 'jekyll/stevenson'
|
|
33
|
+
require 'jekyll/deprecator'
|
|
34
|
+
require 'jekyll/configuration'
|
|
35
|
+
require 'jekyll/site'
|
|
36
|
+
require 'jekyll/convertible'
|
|
37
|
+
require 'jekyll/url'
|
|
38
|
+
require 'jekyll/layout'
|
|
39
|
+
require 'jekyll/page'
|
|
40
|
+
require 'jekyll/post'
|
|
41
|
+
require 'jekyll/excerpt'
|
|
42
|
+
require 'jekyll/draft'
|
|
43
|
+
require 'jekyll/filters'
|
|
44
|
+
require 'jekyll/static_file'
|
|
45
|
+
require 'jekyll/errors'
|
|
46
|
+
require 'jekyll/related_posts'
|
|
47
|
+
require 'jekyll/cleaner'
|
|
43
48
|
|
|
44
49
|
# extensions
|
|
45
|
-
require '
|
|
46
|
-
require '
|
|
47
|
-
require '
|
|
48
|
-
require '
|
|
50
|
+
require 'jekyll/plugin'
|
|
51
|
+
require 'jekyll/converter'
|
|
52
|
+
require 'jekyll/generator'
|
|
53
|
+
require 'jekyll/command'
|
|
49
54
|
|
|
50
|
-
require_all '
|
|
51
|
-
require_all '
|
|
52
|
-
require_all '
|
|
53
|
-
require_all '
|
|
54
|
-
require_all '
|
|
55
|
-
require_all '
|
|
55
|
+
require_all 'jekyll/commands'
|
|
56
|
+
require_all 'jekyll/converters'
|
|
57
|
+
require_all 'jekyll/converters/markdown'
|
|
58
|
+
require_all 'jekyll/generators'
|
|
59
|
+
require_all 'jekyll/tags'
|
|
60
|
+
require_all 'jekyll/drivers'
|
|
56
61
|
|
|
57
62
|
SafeYAML::OPTIONS[:suppress_warnings] = true
|
|
58
63
|
|
|
59
|
-
module
|
|
60
|
-
VERSION = '
|
|
64
|
+
module Jekyll
|
|
65
|
+
VERSION = '1.2.1'
|
|
61
66
|
|
|
62
|
-
# Public: Generate a
|
|
67
|
+
# Public: Generate a Jekyll configuration Hash by merging the default
|
|
63
68
|
# options with anything in _config.yml, and adding the given options on top.
|
|
64
69
|
#
|
|
65
70
|
# override - A Hash of config directives that override any options in both
|
|
66
|
-
# the defaults and the config file. See
|
|
71
|
+
# the defaults and the config file. See Jekyll::Configuration::DEFAULTS for a
|
|
67
72
|
# list of option names and their defaults.
|
|
68
73
|
#
|
|
69
74
|
# Returns the final configuration Hash.
|
|
@@ -87,4 +92,8 @@ module Monad
|
|
|
87
92
|
def self.set_timezone(timezone)
|
|
88
93
|
ENV['TZ'] = timezone
|
|
89
94
|
end
|
|
95
|
+
|
|
96
|
+
def self.logger
|
|
97
|
+
@logger ||= Stevenson.new
|
|
98
|
+
end
|
|
90
99
|
end
|
|
@@ -15,32 +15,30 @@
|
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
|
|
18
|
-
<div class="
|
|
19
|
-
<div class="
|
|
20
|
-
<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
</div>
|
|
24
|
-
|
|
25
|
-
{{ content }}
|
|
18
|
+
<div class="site">
|
|
19
|
+
<div class="header">
|
|
20
|
+
<h1 class="title"><a href="/">{{ site.name }}</a></h1>
|
|
21
|
+
<a class="extra" href="/">home</a>
|
|
22
|
+
</div>
|
|
26
23
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
</
|
|
40
|
-
|
|
24
|
+
{{ content }}
|
|
25
|
+
|
|
26
|
+
<div class="footer">
|
|
27
|
+
<div class="contact">
|
|
28
|
+
<p>
|
|
29
|
+
Your Name<br />
|
|
30
|
+
What You Are<br />
|
|
31
|
+
you@example.com
|
|
32
|
+
</p>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="contact">
|
|
35
|
+
<p>
|
|
36
|
+
<a href="https://github.com/yourusername">github.com/yourusername</a><br />
|
|
37
|
+
<a href="https://twitter.com/yourusername">twitter.com/yourusername</a><br />
|
|
38
|
+
</p>
|
|
41
39
|
</div>
|
|
42
40
|
</div>
|
|
43
|
-
</div>
|
|
41
|
+
</div>
|
|
44
42
|
|
|
45
43
|
</body>
|
|
46
44
|
</html>
|