octopress 3.0.0.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.editorconfig +22 -0
- data/.gitattributes +1 -0
- data/.gitignore +20 -0
- data/.powrc +4 -0
- data/.rspec +5 -0
- data/.rubocop.yml +119 -0
- data/.slugignore +3 -0
- data/.themes/classic/.editorconfig +44 -0
- data/.themes/classic/_config/adn-timeline.yml +10 -0
- data/.themes/classic/_config/delicious-feed.yml +4 -0
- data/.themes/classic/_config/deploy/gh_pages.yml +9 -0
- data/.themes/classic/_config/deploy/rsync.yml +14 -0
- data/.themes/classic/_config/disqus.yml +11 -0
- data/.themes/classic/_config/facebook-like.yml +2 -0
- data/.themes/classic/_config/gauges-analytics.yml +6 -0
- data/.themes/classic/_config/github-repos.yml +24 -0
- data/.themes/classic/_config/google-analytics.yml +6 -0
- data/.themes/classic/_config/google-plus.yml +13 -0
- data/.themes/classic/_config/jekyll.yml +37 -0
- data/.themes/classic/_config/pinboard-feed.yml +4 -0
- data/.themes/classic/_config/require-js.yml +19 -0
- data/.themes/classic/_config/theme.yml +54 -0
- data/.themes/classic/_config/twitter-timeline.yml +9 -0
- data/.themes/classic/assets/javascripts/lib/ios-rotate-scaling-fix.js +18 -0
- data/.themes/classic/assets/javascripts/lib/jquery.cookie.js +92 -0
- data/.themes/classic/assets/javascripts/lib/modernizr.js +447 -0
- data/.themes/classic/assets/javascripts/lib/octopress.js +83 -0
- data/.themes/classic/assets/javascripts/modules/adn-timeline.coffee +68 -0
- data/.themes/classic/assets/javascripts/modules/delicious-feed.coffee +38 -0
- data/.themes/classic/assets/javascripts/modules/github-repos.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/github.coffee +60 -0
- data/.themes/classic/assets/javascripts/modules/helpers.coffee +96 -0
- data/.themes/classic/assets/javascripts/modules/pinboard-feed.coffee +42 -0
- data/.themes/classic/assets/javascripts/modules/site.coffee +11 -0
- data/.themes/classic/assets/stylesheets/_base.scss +5 -0
- data/.themes/classic/assets/stylesheets/_partials.scss +8 -0
- data/.themes/classic/assets/stylesheets/base/_layout.scss +191 -0
- data/.themes/classic/assets/stylesheets/base/_solarized.scss +75 -0
- data/.themes/classic/assets/stylesheets/base/_theme.scss +92 -0
- data/.themes/classic/assets/stylesheets/base/_typography.scss +168 -0
- data/.themes/classic/assets/stylesheets/base/_utilities.scss +27 -0
- data/.themes/classic/assets/stylesheets/custom/_colors.scss +49 -0
- data/.themes/classic/assets/stylesheets/custom/_fonts.scss +10 -0
- data/.themes/classic/assets/stylesheets/custom/_layout.scss +17 -0
- data/.themes/classic/assets/stylesheets/custom/_styles.scss +2 -0
- data/.themes/classic/assets/stylesheets/partials/_archive.scss +77 -0
- data/.themes/classic/assets/stylesheets/partials/_blog.scss +165 -0
- data/.themes/classic/assets/stylesheets/partials/_footer.scss +19 -0
- data/.themes/classic/assets/stylesheets/partials/_header.scss +18 -0
- data/.themes/classic/assets/stylesheets/partials/_navigation.scss +136 -0
- data/.themes/classic/assets/stylesheets/partials/_sharing.scss +73 -0
- data/.themes/classic/assets/stylesheets/partials/_sidebar.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/_syntax.scss +234 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_base.scss +106 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_delicious.scss +4 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_googleplus.scss +26 -0
- data/.themes/classic/assets/stylesheets/partials/sidebar/_pinboard.scss +12 -0
- data/.themes/classic/assets/stylesheets/plugins/_plugins.scss +5 -0
- data/.themes/classic/assets/stylesheets/screen.scss +11 -0
- data/.themes/classic/source/404.markdown +9 -0
- data/.themes/classic/source/_includes/after_footer.html +7 -0
- data/.themes/classic/source/_includes/archive_post.html +12 -0
- data/.themes/classic/source/_includes/article.html +23 -0
- data/.themes/classic/source/_includes/comments.html +9 -0
- data/.themes/classic/source/_includes/custom/after_footer.html +3 -0
- data/.themes/classic/source/_includes/custom/after_page.html +1 -0
- data/.themes/classic/source/_includes/custom/after_post.html +0 -0
- data/.themes/classic/source/_includes/custom/comments.html +5 -0
- data/.themes/classic/source/_includes/custom/footer.html +4 -0
- data/.themes/classic/source/_includes/custom/head.html +7 -0
- data/.themes/classic/source/_includes/custom/header.html +6 -0
- data/.themes/classic/source/_includes/custom/navigation.html +4 -0
- data/.themes/classic/source/_includes/custom/page_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/post_meta.html +1 -0
- data/.themes/classic/source/_includes/custom/sharing.html +3 -0
- data/.themes/classic/source/_includes/disqus.html +22 -0
- data/.themes/classic/source/_includes/facebook_like.html +10 -0
- data/.themes/classic/source/_includes/feed_entry.xml +10 -0
- data/.themes/classic/source/_includes/footer.html +1 -0
- data/.themes/classic/source/_includes/gauges_analytics.html +15 -0
- data/.themes/classic/source/_includes/google_analytics.html +13 -0
- data/.themes/classic/source/_includes/google_plus_one.html +9 -0
- data/.themes/classic/source/_includes/head.html +33 -0
- data/.themes/classic/source/_includes/header.html +1 -0
- data/.themes/classic/source/_includes/navigation.html +15 -0
- data/.themes/classic/source/_includes/post/author.html +8 -0
- data/.themes/classic/source/_includes/post/categories.html +10 -0
- data/.themes/classic/source/_includes/post/date.html +15 -0
- data/.themes/classic/source/_includes/post/disqus_thread.html +1 -0
- data/.themes/classic/source/_includes/post/meta.html +3 -0
- data/.themes/classic/source/_includes/post/sharing.html +36 -0
- data/.themes/classic/source/_includes/post/title.html +5 -0
- data/.themes/classic/source/_includes/post/variables.html +14 -0
- data/.themes/classic/source/_includes/sidebars/blog_index_default.html +3 -0
- data/.themes/classic/source/_includes/sidebars/page_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/post_default.html +4 -0
- data/.themes/classic/source/_includes/sidebars/sections/delicious.html +8 -0
- data/.themes/classic/source/_includes/sidebars/sections/github.html +9 -0
- data/.themes/classic/source/_includes/sidebars/sections/google_plus.html +5 -0
- data/.themes/classic/source/_includes/sidebars/sections/pinboard.html +17 -0
- data/.themes/classic/source/_includes/sidebars/sections/recent_posts.html +10 -0
- data/.themes/classic/source/_includes/twitter_sharing.html +11 -0
- data/.themes/classic/source/_layouts/category_feed.xml +24 -0
- data/.themes/classic/source/_layouts/category_index.html +19 -0
- data/.themes/classic/source/_layouts/default.html +14 -0
- data/.themes/classic/source/_layouts/page.html +34 -0
- data/.themes/classic/source/_layouts/post.html +39 -0
- data/.themes/classic/source/archives/index.html +20 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/blankButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/divider.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/fullscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/muteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/normalscreenButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/pauseButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/playButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderBuffer.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapLeft.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderCapRight.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderProgress.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/timeSliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButton.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/controlbar/unmuteButtonOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/background.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/bufferIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/muteIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/display/playIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/dock/button.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/glow.xml +115 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/item.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/itemOver.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapBottom.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderCapTop.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderRail.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/playlist/sliderThumb.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/embedScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareIcon.png +0 -0
- data/.themes/classic/source/assets/jwplayer/glow/sharing/shareScreen.png +0 -0
- data/.themes/classic/source/assets/jwplayer/player.swf +0 -0
- data/.themes/classic/source/atom.xml +23 -0
- data/.themes/classic/source/images/bird_32_gray.png +0 -0
- data/.themes/classic/source/images/bird_32_gray_fail.png +0 -0
- data/.themes/classic/source/images/code_bg.png +0 -0
- data/.themes/classic/source/images/dotted-border.png +0 -0
- data/.themes/classic/source/images/email.png +0 -0
- data/.themes/classic/source/images/icon/facebook.png +0 -0
- data/.themes/classic/source/images/icon/github.png +0 -0
- data/.themes/classic/source/images/icon/googleplus.png +0 -0
- data/.themes/classic/source/images/icon/twitter-bird.png +0 -0
- data/.themes/classic/source/images/icon/twitter.png +0 -0
- data/.themes/classic/source/images/line-tile.png +0 -0
- data/.themes/classic/source/images/noise.png +0 -0
- data/.themes/classic/source/images/rss.png +0 -0
- data/.themes/classic/source/images/search.png +0 -0
- data/.themes/classic/source/index.html +30 -0
- data/.themes/classic/source/javascripts/jquery.min.js +5 -0
- data/.themes/classic/source/octopress-favicon.png +0 -0
- data/.themes/classic/source/robots.txt +7 -0
- data/.travis.yml +6 -0
- data/CHANGELOG.markdown +46 -0
- data/CONTRIBUTING.markdown +17 -0
- data/Gemfile +2 -0
- data/README.markdown +37 -0
- data/Rakefile +76 -0
- data/bin/octopress +66 -0
- data/lib/console +17 -0
- data/lib/guard/jekyll.rb +33 -0
- data/lib/octopress.rb +89 -0
- data/lib/octopress/command.rb +9 -0
- data/lib/octopress/commands.rb +14 -0
- data/lib/octopress/commands/build.rb +17 -0
- data/lib/octopress/commands/build_javascripts.rb +11 -0
- data/lib/octopress/commands/build_jekyll.rb +25 -0
- data/lib/octopress/commands/build_stylesheets.rb +13 -0
- data/lib/octopress/commands/install.rb +45 -0
- data/lib/octopress/commands/new.rb +21 -0
- data/lib/octopress/commands/scaffold.rb +101 -0
- data/lib/octopress/commands/serve.rb +25 -0
- data/lib/octopress/configuration.rb +231 -0
- data/lib/octopress/core_ext.rb +44 -0
- data/lib/octopress/dependency_installer.rb +287 -0
- data/lib/octopress/errors.rb +3 -0
- data/lib/octopress/filters/content.rb +66 -0
- data/lib/octopress/filters/date.rb +46 -0
- data/lib/octopress/filters/post.rb +175 -0
- data/lib/octopress/filters/url.rb +34 -0
- data/lib/octopress/formatters.rb +9 -0
- data/lib/octopress/formatters/base_formatter.rb +17 -0
- data/lib/octopress/formatters/simple_formatter.rb +9 -0
- data/lib/octopress/formatters/verbose_formatter.rb +9 -0
- data/lib/octopress/generators/category_generator.rb +196 -0
- data/lib/octopress/generators/sitemap_generator.rb +308 -0
- data/lib/octopress/guardfile +43 -0
- data/lib/octopress/helpers/titlecase.rb +37 -0
- data/lib/octopress/ink.rb +12 -0
- data/lib/octopress/inquirable_string.rb +12 -0
- data/lib/octopress/installer.rb +92 -0
- data/lib/octopress/js_asset_manager.rb +98 -0
- data/lib/octopress/liquid_helpers/conditional.rb +36 -0
- data/lib/octopress/liquid_helpers/config.rb +58 -0
- data/lib/octopress/liquid_helpers/include.rb +33 -0
- data/lib/octopress/liquid_helpers/url.rb +29 -0
- data/lib/octopress/liquid_helpers/vars.rb +30 -0
- data/lib/octopress/plugin.rb +33 -0
- data/lib/octopress/rake.rb +16 -0
- data/lib/octopress/scaffold/.gitignore +18 -0
- data/lib/octopress/scaffold/site/Gemfile +3 -0
- data/lib/octopress/scaffold/site/config/compass.rb +27 -0
- data/lib/octopress/scaffold/site/config/rack.rb +25 -0
- data/lib/octopress/scaffold/site/config/site.yml +0 -0
- data/lib/octopress/scaffold/site/javascripts/lib/ios-rotate-scaling-fix.js +19 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery-1.9.1.js +9598 -0
- data/lib/octopress/scaffold/site/javascripts/lib/jquery.cookie.js +93 -0
- data/lib/octopress/scaffold/site/stylesheets/_config.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/_style.scss +1 -0
- data/lib/octopress/scaffold/site/stylesheets/site.scss +16 -0
- data/lib/octopress/tags/assign.rb +34 -0
- data/lib/octopress/tags/capture.rb +31 -0
- data/lib/octopress/tags/config-tag.rb +23 -0
- data/lib/octopress/tags/include.rb +63 -0
- data/lib/octopress/tags/js-assets.rb +23 -0
- data/lib/octopress/tags/puts.rb +39 -0
- data/lib/octopress/tags/render-partial.rb +89 -0
- data/lib/octopress/tags/return.rb +21 -0
- data/lib/octopress/version.rb +3 -0
- data/lib/rake/clean.rake +8 -0
- data/lib/rake/clobber.rake +5 -0
- data/lib/rake/console.rake +5 -0
- data/lib/rake/deploy.rake +4 -0
- data/lib/rake/gen_deploy.rake +2 -0
- data/lib/rake/generate.rake +4 -0
- data/lib/rake/generate_only.rake +14 -0
- data/lib/rake/hygiene.rake +29 -0
- data/lib/rake/install.rake +8 -0
- data/lib/rake/integrate.rake +4 -0
- data/lib/rake/isolate.rake +13 -0
- data/lib/rake/list_drafts.rake +7 -0
- data/lib/rake/new.rake +7 -0
- data/lib/rake/new_page.rake +49 -0
- data/lib/rake/new_post.rake +32 -0
- data/lib/rake/nuke.rake +4 -0
- data/lib/rake/preview.rake +4 -0
- data/lib/rake/push.rake +37 -0
- data/lib/rake/rsync.rake +20 -0
- data/lib/rake/set_root_dir.rake +35 -0
- data/lib/rake/setup_github_pages.rake +115 -0
- data/lib/rake/watch.rake +11 -0
- data/lib/scaffold/Rakefile +142 -0
- data/lib/scaffold/plugin-name.gemspec +43 -0
- data/lib/spec/fixtures/env/defaults/classic.yml +2 -0
- data/lib/spec/fixtures/no_override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/defaults/classic.yml +11 -0
- data/lib/spec/fixtures/override/site.yml +11 -0
- data/lib/spec/octopress/configuration_spec.rb +67 -0
- data/lib/spec/octopress/dependency_installer_spec.rb +66 -0
- data/lib/spec/octopress/ink_spec.rb +10 -0
- data/lib/spec/octopress/octopress_spec.rb +97 -0
- data/lib/spec/spec_helper.rb +22 -0
- data/lib/spec/support/env.rb +36 -0
- data/lib/spec/support/simplecov.rb +52 -0
- data/octopress.gemspec +52 -0
- metadata +697 -0
@@ -0,0 +1,93 @@
|
|
1
|
+
/*!
|
2
|
+
* jQuery Cookie Plugin v1.3.1
|
3
|
+
* https://github.com/carhartl/jquery-cookie
|
4
|
+
*
|
5
|
+
* Copyright 2013 Klaus Hartl
|
6
|
+
* Released under the MIT license
|
7
|
+
*/
|
8
|
+
(function (factory) {
|
9
|
+
if (typeof define === 'function' && define.amd && define.amd.jQuery) {
|
10
|
+
// AMD. Register as anonymous module.
|
11
|
+
define(['jquery'], factory);
|
12
|
+
} else {
|
13
|
+
// Browser globals.
|
14
|
+
factory(jQuery);
|
15
|
+
}
|
16
|
+
}(function ($) {
|
17
|
+
|
18
|
+
var pluses = /\+/g;
|
19
|
+
|
20
|
+
function raw(s) {
|
21
|
+
return s;
|
22
|
+
}
|
23
|
+
|
24
|
+
function decoded(s) {
|
25
|
+
return decodeURIComponent(s.replace(pluses, ' '));
|
26
|
+
}
|
27
|
+
|
28
|
+
function converted(s) {
|
29
|
+
if (s.indexOf('"') === 0) {
|
30
|
+
// This is a quoted cookie as according to RFC2068, unescape
|
31
|
+
s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\');
|
32
|
+
}
|
33
|
+
try {
|
34
|
+
return config.json ? JSON.parse(s) : s;
|
35
|
+
} catch(er) {}
|
36
|
+
}
|
37
|
+
|
38
|
+
var config = $.cookie = function (key, value, options) {
|
39
|
+
|
40
|
+
// write
|
41
|
+
if (value !== undefined) {
|
42
|
+
options = $.extend({}, config.defaults, options);
|
43
|
+
|
44
|
+
if (typeof options.expires === 'number') {
|
45
|
+
var days = options.expires, t = options.expires = new Date();
|
46
|
+
t.setDate(t.getDate() + days);
|
47
|
+
}
|
48
|
+
|
49
|
+
value = config.json ? JSON.stringify(value) : String(value);
|
50
|
+
|
51
|
+
return (document.cookie = [
|
52
|
+
encodeURIComponent(key), '=', config.raw ? value : encodeURIComponent(value),
|
53
|
+
options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
|
54
|
+
options.path ? '; path=' + options.path : '',
|
55
|
+
options.domain ? '; domain=' + options.domain : '',
|
56
|
+
options.secure ? '; secure' : ''
|
57
|
+
].join(''));
|
58
|
+
}
|
59
|
+
|
60
|
+
// read
|
61
|
+
var decode = config.raw ? raw : decoded;
|
62
|
+
var cookies = document.cookie.split('; ');
|
63
|
+
var result = key ? undefined : {};
|
64
|
+
for (var i = 0, l = cookies.length; i < l; i++) {
|
65
|
+
var parts = cookies[i].split('=');
|
66
|
+
var name = decode(parts.shift());
|
67
|
+
var cookie = decode(parts.join('='));
|
68
|
+
|
69
|
+
if (key && key === name) {
|
70
|
+
result = converted(cookie);
|
71
|
+
break;
|
72
|
+
}
|
73
|
+
|
74
|
+
if (!key) {
|
75
|
+
result[name] = converted(cookie);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
|
79
|
+
return result;
|
80
|
+
};
|
81
|
+
|
82
|
+
config.defaults = {};
|
83
|
+
|
84
|
+
$.removeCookie = function (key, options) {
|
85
|
+
if ($.cookie(key) !== undefined) {
|
86
|
+
$.cookie(key, '', $.extend(options, { expires: -1 }));
|
87
|
+
return true;
|
88
|
+
}
|
89
|
+
return false;
|
90
|
+
};
|
91
|
+
|
92
|
+
}));
|
93
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Add variable configurations for themes and plugins */
|
@@ -0,0 +1 @@
|
|
1
|
+
/* Add your custom styles, or import other stylesheets here */
|
@@ -0,0 +1,16 @@
|
|
1
|
+
/*----------------------------------------------\
|
2
|
+
| Note: Please do not edit this file |
|
3
|
+
|-----------------------------------------------|
|
4
|
+
| Add your own styles to _style.scss |
|
5
|
+
| Configure plugins and themes in _config.scss |
|
6
|
+
\----------------------------------------------*/
|
7
|
+
|
8
|
+
/* Import user configs */
|
9
|
+
@import "_config.*";
|
10
|
+
|
11
|
+
/* Import theme and plugin stylesheets */
|
12
|
+
@import "theme/_index.*";
|
13
|
+
@import "plugins/*/_style.*";
|
14
|
+
|
15
|
+
/* Import user stylesheets */
|
16
|
+
@import "_style.*";
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module Octopress
|
2
|
+
class Assign < Liquid::Tag
|
3
|
+
include VarHelpers
|
4
|
+
include Conditional
|
5
|
+
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
@markup = markup
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context)
|
12
|
+
if strip_expression(@markup, context).strip =~ VAR_SYNTAX
|
13
|
+
@to = $1
|
14
|
+
@operator = $2
|
15
|
+
@from = $3
|
16
|
+
else
|
17
|
+
raise SyntaxError.new("Syntax Error in 'assign' - Valid syntax: assign [var] = [source]")
|
18
|
+
end
|
19
|
+
if evaluate_expression @markup, context
|
20
|
+
value = get_value(@from, context)
|
21
|
+
|
22
|
+
if @operator == '+=' && !context.scopes.last[@to].nil?
|
23
|
+
context.scopes.last[@to] += value
|
24
|
+
else
|
25
|
+
context.scopes.last[@to] = value
|
26
|
+
end
|
27
|
+
end
|
28
|
+
''
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
Liquid::Template.register_tag('assign', Octopress::Assign)
|
34
|
+
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Octopress
|
2
|
+
class Capture < Liquid::Block
|
3
|
+
include Conditional
|
4
|
+
WORD_REGEX = '[[:word:]]'
|
5
|
+
SYNTAX = /(#{WORD_REGEX}+)\s*(\+=)?/o
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
@markup = markup
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context)
|
12
|
+
if evaluate_expression @markup, context
|
13
|
+
if strip_expression(@markup, context).strip =~ SYNTAX
|
14
|
+
@to = $1
|
15
|
+
@operator = $2
|
16
|
+
else
|
17
|
+
raise SyntaxError.new("Syntax Error in 'capture' - Valid syntax: capture [var]")
|
18
|
+
end
|
19
|
+
output = super
|
20
|
+
if @operator == '+=' && !context.scopes.last[@to].nil?
|
21
|
+
context.scopes.last[@to] += output
|
22
|
+
else
|
23
|
+
context.scopes.last[@to] = output
|
24
|
+
end
|
25
|
+
end
|
26
|
+
''
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
Liquid::Template.register_tag('capture', Octopress::Capture)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'json'
|
2
|
+
|
3
|
+
module Octopress
|
4
|
+
class ConfigTag < Liquid::Tag
|
5
|
+
def initialize(tag_name, options, tokens)
|
6
|
+
super
|
7
|
+
options = options.split(' ').map {|i| i.strip }
|
8
|
+
@key = options.slice!(0)
|
9
|
+
@tag = nil
|
10
|
+
@classname = nil
|
11
|
+
options.each do |option|
|
12
|
+
@tag = $1 if option =~ /tag:(\S+)/
|
13
|
+
@classname = $1 if option =~ /classname:(\S+)/
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
def render(context)
|
18
|
+
config_tag(context, @key, @tag, @classname)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Liquid::Template.register_tag('config_tag', Octopress::ConfigTag)
|
@@ -0,0 +1,63 @@
|
|
1
|
+
module Octopress
|
2
|
+
class IncludeTag < Liquid::Tag
|
3
|
+
include IncludeHelper
|
4
|
+
include Conditional
|
5
|
+
def initialize(tag_name, markup, tokens)
|
6
|
+
@markup = markup.strip
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
if evaluate_expression @markup, context
|
12
|
+
file = get_include(strip_expression(@markup, context), context)
|
13
|
+
render_include(file, context) if file
|
14
|
+
else
|
15
|
+
''
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
class ExistsTag < Liquid::Tag
|
21
|
+
include IncludeHelper
|
22
|
+
def initialize(tag_name, markup, tokens)
|
23
|
+
@file = markup.strip
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
def render(context)
|
28
|
+
exists(@file, context)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
class WrapTag < Liquid::Block
|
33
|
+
include VarHelpers
|
34
|
+
include IncludeHelper
|
35
|
+
HAS_CONTENT = /(.*?)({=\s*yield\s*})(.*)/im
|
36
|
+
|
37
|
+
def initialize(tag_name, markup, tokens)
|
38
|
+
@markup = markup.strip
|
39
|
+
super
|
40
|
+
end
|
41
|
+
|
42
|
+
def wrap_include(file, content, context)
|
43
|
+
if content =~ HAS_CONTENT
|
44
|
+
$1 + render_include(file, context) + $3
|
45
|
+
else
|
46
|
+
raise SyntaxError.new("Syntax Error in 'wrap_include' - Valid syntax: {% wrap_include template/file.html %}\n[<div>]{= yield }[</div>]\n{% endwrap_include %}")
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def render(context)
|
51
|
+
if evaluate_expression @markup, context
|
52
|
+
file = get_include(strip_expression(@markup, context), context)
|
53
|
+
wrap_include(file, super.strip, context) if file
|
54
|
+
else
|
55
|
+
''
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
Liquid::Template.register_tag('exists', Octopress::ExistsTag)
|
62
|
+
Liquid::Template.register_tag('include', Octopress::IncludeTag)
|
63
|
+
Liquid::Template.register_tag('wrap', Octopress::WrapTag)
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$:.unshift File.expand_path("../../../lib", File.dirname(__FILE__)) # For use/testing when no gem is installed
|
2
|
+
require 'octopress'
|
3
|
+
|
4
|
+
module Octopress
|
5
|
+
class JavascriptAssetsTag < Liquid::Tag
|
6
|
+
def initialize(tag_name, options, tokens)
|
7
|
+
super
|
8
|
+
end
|
9
|
+
|
10
|
+
def render(context)
|
11
|
+
js_assets = Octopress::JSAssetsManager.new
|
12
|
+
url = js_assets.url
|
13
|
+
if url
|
14
|
+
url = context['site.root'].sub(/\/\s*$/, '') + url
|
15
|
+
"<script src='#{url}' type='text/javascript'></script>"
|
16
|
+
else
|
17
|
+
''
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
Liquid::Template.register_tag('javascript_tag', Octopress::JavascriptAssetsTag)
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# Title: Puts Tag for Jekyll
|
2
|
+
# Author: Brandon Mathis http://brandonmathis.com
|
3
|
+
# Description: Puts is a liquid tag block which outputs its contents to the terminal
|
4
|
+
#
|
5
|
+
# Example Usage:
|
6
|
+
# Lets say you've assigned some variable you need to test.
|
7
|
+
# {% assign noun = "toaster" %}
|
8
|
+
#
|
9
|
+
# Drop it in a puts block along with a way to identify it in the output.
|
10
|
+
# {% puts %}
|
11
|
+
# Look out he's got a {{ noun }}.
|
12
|
+
# {% endputs %}
|
13
|
+
#
|
14
|
+
# Outputs:
|
15
|
+
# >>> {% puts %} <<<
|
16
|
+
# Look out he's got a toaster.
|
17
|
+
#
|
18
|
+
|
19
|
+
module Octopress
|
20
|
+
class Puts < Liquid::Block
|
21
|
+
def initialize(tag_name, markup, tokens)
|
22
|
+
super
|
23
|
+
end
|
24
|
+
|
25
|
+
def render(context)
|
26
|
+
# Use a block if label + output is wider than 80 characters
|
27
|
+
if super.length > 69
|
28
|
+
puts "{% puts %}"
|
29
|
+
puts super
|
30
|
+
puts "{% endputs %}"
|
31
|
+
else
|
32
|
+
puts "{% puts %} #{super}"
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
Liquid::Template.register_tag('puts', Octopress::Puts)
|
39
|
+
|
@@ -0,0 +1,89 @@
|
|
1
|
+
# Title: Render Partial Tag for Jekyll
|
2
|
+
# Author: Brandon Mathis
|
3
|
+
# Description: Import files on your filesystem into any blog post and render them inline.
|
4
|
+
# Note: Paths are relative to the source directory, if you import a file with yaml front matter, the yaml will be stripped out.
|
5
|
+
#
|
6
|
+
# Syntax {% render_partial path/to/file %}
|
7
|
+
#
|
8
|
+
# Example 1:
|
9
|
+
# {% render_partial about/_bio.markdown %}
|
10
|
+
#
|
11
|
+
# This will import source/about/_bio.markdown and render it inline.
|
12
|
+
# In this example I used an underscore at the beginning of the filename to prevent Jekyll
|
13
|
+
# from generating an about/bio.html (Jekyll doesn't convert files beginning with underscores)
|
14
|
+
#
|
15
|
+
# Example 2:
|
16
|
+
# {% render_partial ../README.markdown %}
|
17
|
+
#
|
18
|
+
# You can use relative pathnames, to include files outside of the source directory.
|
19
|
+
# This might be useful if you want to have a page for a project's README without having
|
20
|
+
# to duplicated the contents
|
21
|
+
#
|
22
|
+
#
|
23
|
+
|
24
|
+
require 'pathname'
|
25
|
+
|
26
|
+
module Jekyll
|
27
|
+
|
28
|
+
# Create a new page class to allow partials to trigger post_filters
|
29
|
+
class ConvertiblePage
|
30
|
+
include Convertible
|
31
|
+
|
32
|
+
attr_accessor :name, :content, :site, :ext, :output, :data
|
33
|
+
|
34
|
+
def initialize(site, name, content)
|
35
|
+
@site = site
|
36
|
+
@name = name
|
37
|
+
@ext = File.extname(name)
|
38
|
+
@content = content
|
39
|
+
@data = { layout: "no_layout" } # hack
|
40
|
+
end
|
41
|
+
|
42
|
+
def render(payload, info)
|
43
|
+
do_layout(payload, { no_layout: nil })
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
class RenderPartialTag < Liquid::Tag
|
48
|
+
def initialize(tag_name, markup, tokens)
|
49
|
+
@file = nil
|
50
|
+
@raw = false
|
51
|
+
if markup =~ /^(\S+)\s?(\w+)?/
|
52
|
+
@file = $1.strip
|
53
|
+
@raw = $2 == 'raw'
|
54
|
+
end
|
55
|
+
super
|
56
|
+
end
|
57
|
+
|
58
|
+
def render(context)
|
59
|
+
file_dir = (context.registers[:site].source || 'source')
|
60
|
+
file_path = Pathname.new(file_dir).expand_path
|
61
|
+
file = file_path + @file
|
62
|
+
ext = File.extname(@file)
|
63
|
+
|
64
|
+
unless file.file?
|
65
|
+
return "File #{file} could not be found"
|
66
|
+
end
|
67
|
+
|
68
|
+
Dir.chdir(file_path) do
|
69
|
+
content = file.read
|
70
|
+
|
71
|
+
# Strip out yaml header from partials
|
72
|
+
if content =~ /\A-{3}.+[^\A]-{3}\n(.+)/m
|
73
|
+
content = $1.lstrip
|
74
|
+
end
|
75
|
+
|
76
|
+
if @raw
|
77
|
+
content
|
78
|
+
else
|
79
|
+
p = ConvertiblePage.new(context.registers[:site], @file, content)
|
80
|
+
payload = { 'page' => context.registers[:page], 'site' => context.registers[:site] }
|
81
|
+
p.render(payload, { registers: context.registers })
|
82
|
+
p.output
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
Liquid::Template.register_tag('render_partial', Jekyll::RenderPartialTag)
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Octopress
|
2
|
+
class Return < Liquid::Tag
|
3
|
+
include VarHelpers
|
4
|
+
include Conditional
|
5
|
+
|
6
|
+
def initialize(tag_name, markup, tokens)
|
7
|
+
@markup = markup.strip
|
8
|
+
super
|
9
|
+
end
|
10
|
+
|
11
|
+
def render(context)
|
12
|
+
if evaluate_expression @markup, context
|
13
|
+
get_value(strip_expression(@markup, context), context)
|
14
|
+
else
|
15
|
+
''
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
Liquid::Template.register_tag('return', Octopress::Return)
|