diff --git a/Gemfile b/Gemfile index 2a59abc7c9de..3df9bee3127e 100644 --- a/Gemfile +++ b/Gemfile @@ -4,8 +4,6 @@ group :development do gem 'rake', '~> 10.0' gem 'jekyll', '~> 3.0' gem 'pygments.rb', '~> 0.6.3' - # gem 'octopress-hooks', '~> 2.2' - # gem 'octopress-date-format', '~> 2.0' gem 'rdiscount', '~> 2.0' gem 'RedCloth', '~> 4.2.9' gem 'haml', '~> 4.0' @@ -19,10 +17,14 @@ group :development do end group :jekyll_plugins do - gem 'jekyll-sitemap' gem 'jekyll-paginate' - gem 'octopress', '~> 3.0' + gem 'jekyll-sitemap' gem 'jekyll-time-to-read' + gem 'octopress', '~> 3.0' + gem 'octopress-codefence' + gem 'octopress-filters' + gem 'octopress-include-tag' + # gem 'octopress-solarized' end gem 'sinatra', '~> 1.4.2' diff --git a/_config.yml b/_config.yml index c69bbfffacb6..85495db40cc6 100644 --- a/_config.yml +++ b/_config.yml @@ -26,8 +26,6 @@ email: # Jekyll & Plugins # # ----------------------- # -# If publishing to a subdirectory as in http://site.com/project set 'root: /project' -root: / permalink: /blog/:year/:month/:day/:title/ source: source destination: public/ @@ -44,6 +42,10 @@ highlighter: pygments # default python pygments have been replaced by pygments.r gems: - jekyll-time-to-read + - octopress-filters + # - octopress-solarized + - octopress-codefence + - octopress-include-tag paginate: 10 # Posts per page on the blog index paginate_path: "blog/posts/:num" # Directory base for pagination URLs eg. /posts/2/ diff --git a/config.ru b/config.ru index 8e3dc08a771c..4c56b416a9f7 100644 --- a/config.ru +++ b/config.ru @@ -16,7 +16,7 @@ class SinatraStaticServer < Sinatra::Base def send_sinatra_file(path, &missing_file_block) file_path = File.join(File.dirname(__FILE__), 'public', path) - file_path = File.join(file_path, 'index.html') unless file_path =~ /\.[a-z]+$/i + file_path = File.join(file_path, 'index.html') if File.directory?(file_path) File.exist?(file_path) ? send_file(file_path) : missing_file_block.call end diff --git a/plugins/octopress_filters.rb b/plugins/octopress_filters.rb deleted file mode 100644 index cfc0b4a1424b..000000000000 --- a/plugins/octopress_filters.rb +++ /dev/null @@ -1,142 +0,0 @@ -#custom filters for Octopress -require './plugins/backtick_code_block' -# require 'octopress-hooks' -require 'jekyll-sitemap' -# require 'octopress-date-format' -require './plugins/raw' -require 'rubypants' - -module OctopressFilters - def self.pre_filter(page) - if page.ext.match('html|textile|markdown|md|haml|slim|xml') - input = BacktickCodeBlock::render_code_block(page.content) - page.content = input.gsub /(.+?<\/figure>)/m do - TemplateWrapper::safe_wrap($1) - end - end - end - def self.post_filter(page) - if page.ext.match('html|textile|markdown|md|haml|slim|xml') - page.output = TemplateWrapper::unwrap(page.output) - end - - page.output = RubyPants.new(page.output).to_html - end - - # class PageFilters < Octopress::Hooks::Page - # def pre_render(page) - # OctopressFilters::pre_filter(page) - # end - - # def post_render(page) - # OctopressFilters::post_filter(page) - # end - # end - - # class PostFilters < Octopress::Hooks::Post - # def pre_render(post) - # OctopressFilters::pre_filter(post) - # end - - # def post_render(post) - # OctopressFilters::post_filter(post) - # end - # end -end - - -module OctopressLiquidFilters - - # Used on the blog index to split posts on the marker - def excerpt(input) - if input.index(//i) - input.split(//i)[0] - else - input - end - end - - # Checks for excerpts (helpful for template conditionals) - def has_excerpt(input) - input =~ //i ? true : false - end - - # Summary is used on the Archive pages to return the first block of content from a post. - def summary(input) - if input.index(/\n\n/) - input.split(/\n\n/)[0] - else - input - end - end - - # Extracts raw content DIV from template, used for page description as {{ content }} - # contains complete sub-template code on main page level - def raw_content(input) - /
(?[\s\S]*?)<\/div>\s*<(footer|\/article)>/ =~ input - return (content.nil?) ? input : content - end - - # Escapes CDATA sections in post content - def cdata_escape(input) - input.gsub(//, ']]>') - end - - # Replaces relative urls with full urls - def expand_urls(input, url='') - url ||= '/' - input.gsub /(\s+(href|src)\s*=\s*["|']{1})(\/[^\/>]{1}[^\"'>]*)/ do - $1+url+$3 - end - end - - # Improved version of Liquid's truncate: - # - Doesn't cut in the middle of a word. - # - Uses typographically correct ellipsis (…) insted of '...' - def truncate(input, length) - if input.length > length && input[0..(length-1)] =~ /(.+)\b.+$/im - $1.strip + ' …' - else - input - end - end - - # Improved version of Liquid's truncatewords: - # - Uses typographically correct ellipsis (…) insted of '...' - def truncatewords(input, length) - truncate = input.split(' ') - if truncate.length > length - truncate[0..length-1].join(' ').strip + ' …' - else - input - end - end - - # Condenses multiple spaces and tabs into a single space - def condense_spaces(input) - input.gsub(/\s{2,}/, ' ') - end - - # Removes trailing forward slash from a string for easily appending url segments - def strip_slash(input) - if input =~ /(.+)\/$|^\/$/ - input = $1 - end - input - end - - # Returns a url without the protocol (http://) - def shorthand_url(input) - input.gsub /(https?:\/\/)(\S+)/ do - $2 - end - end - - # Returns a title cased string based on John Gruber's title case http://daringfireball.net/2008/08/title_case_update - def titlecase(input) - input.titlecase - end - -end -Liquid::Template.register_filter OctopressLiquidFilters - diff --git a/plugins/render_partial.rb b/plugins/render_partial.rb deleted file mode 100644 index b6ebfe8b5494..000000000000 --- a/plugins/render_partial.rb +++ /dev/null @@ -1,69 +0,0 @@ -# Title: Render Partial Tag for Jekyll -# Author: Brandon Mathis http://brandonmathis.com -# Description: Import files on your filesystem into any blog post and render them inline. -# Note: Paths are relative to the source directory, if you import a file with yaml front matter, the yaml will be stripped out. -# -# Syntax {% render_partial path/to/file %} -# -# Example 1: -# {% render_partial about/_bio.markdown %} -# -# This will import source/about/_bio.markdown and render it inline. -# In this example I used an underscore at the beginning of the filename to prevent Jekyll -# from generating an about/bio.html (Jekyll doesn't convert files beginning with underscores) -# -# Example 2: -# {% render_partial ../README.markdown %} -# -# You can use relative pathnames, to include files outside of the source directory. -# This might be useful if you want to have a page for a project's README without having -# to duplicated the contents -# -# - -require 'pathname' -require './plugins/octopress_filters' - -module Jekyll - - class RenderPartialTag < Liquid::Tag - include OctopressFilters - def initialize(tag_name, markup, tokens) - @file = nil - @raw = false - if markup =~ /^(\S+)\s?(\w+)?/ - @file = $1.strip - @raw = $2 == 'raw' - end - super - end - - def render(context) - file_dir = (context.registers[:site].source || 'source') - file_path = Pathname.new(file_dir).expand_path - file = file_path + @file - - unless file.file? - return "File #{file} could not be found" - end - - Dir.chdir(file_path) do - contents = file.read - if contents =~ /\A-{3}.+[^\A]-{3}\n(.+)/m - contents = $1.lstrip - end - contents = pre_filter(contents) - if @raw - contents - else - partial = Liquid::Template.parse(contents) - context.stack do - partial.render(context) - end - end - end - end - end -end - -Liquid::Template.register_tag('render_partial', Jekyll::RenderPartialTag) diff --git a/source/_includes/article.html b/source/_includes/article.html index 842799773e83..b7a6e0e2edb4 100644 --- a/source/_includes/article.html +++ b/source/_includes/article.html @@ -17,9 +17,15 @@

{% if site.titlecase %}{{ page.title | titlecase }}{% el {% endunless %} {% if index %} -
{{ content | excerpt }}
- {% capture excerpted %}{{ content | has_excerpt }}{% endcapture %} - {% if excerpted == 'true' %} +
+ {% if post.excerpted %} + {{ post.excerpt }} + + {% else %} + {{ post.content }} + {% endif %} +
+ {% if post.excerpted %} diff --git a/source/_includes/blog/post/article.html b/source/_includes/blog/post/article.html index 0423ce6bfa3d..9c1b2ebc201e 100644 --- a/source/_includes/blog/post/article.html +++ b/source/_includes/blog/post/article.html @@ -22,13 +22,11 @@

{{ page.title }}

{% endunless %} -{% capture excerpted %}{{ content | has_excerpt }}{% endcapture %} - -{% if excerpted == 'true' and index %} +{% if post.excerpted and index %}
- {{ content | excerpt }} + {{ post.excerpt }} {{ site.excerpt_link }}
{% else %} - {{ content | replace: site.excerpt_separator, '' }} -{% endif %} \ No newline at end of file + {{ post.content | replace: site.excerpt_separator, '' }} +{% endif %} diff --git a/source/_includes/post/time_to_read.html b/source/_includes/post/time_to_read.html index 4c72aa0700a2..bdd98c5981f6 100644 --- a/source/_includes/post/time_to_read.html +++ b/source/_includes/post/time_to_read.html @@ -1 +1 @@ - {{ content | reading_time_as_s }} reading time \ No newline at end of file + {{ post.content | reading_time_as_s }} reading time \ No newline at end of file diff --git a/source/_includes/site/head.html b/source/_includes/site/head.html index 63ab4f5f8c8e..7819354750cd 100644 --- a/source/_includes/site/head.html +++ b/source/_includes/site/head.html @@ -4,7 +4,7 @@ - {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' | strip_slash }}{% endif %}{% endcapture %} + {% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %} {% if page.description %} {% capture fb_description %}{{ page.description }}{% endcapture %} {% else %} {% capture fb_description %}{{ content | raw_content }}{% endcapture %} {% endif %} diff --git a/source/_layouts/post.html b/source/_layouts/post.html index a34d4bde268c..9d5c8e41ad56 100644 --- a/source/_layouts/post.html +++ b/source/_layouts/post.html @@ -4,10 +4,11 @@ ---
+ {% assign post = page %} {% include blog/post/article.html %}
-{% if site.disqus_short_name and page.comments == true %} +{% if site.disqus_short_name and page.comments == true %}

Comments

{% include blog/post/disqus_thread.html %}
diff --git a/source/blog/index.html b/source/blog/index.html index f79819923c13..54135face8f8 100644 --- a/source/blog/index.html +++ b/source/blog/index.html @@ -1,10 +1,10 @@ --- layout: default sidebar: false +regenerate: true --- {% assign index = true %} {% for post in paginator.posts %} - {% assign content = post.content %}
{% include blog/post/article.html %}
diff --git a/source/getting-started/automation.markdown b/source/getting-started/automation.markdown index 887217834409..47ab59b90e55 100644 --- a/source/getting-started/automation.markdown +++ b/source/getting-started/automation.markdown @@ -169,7 +169,7 @@ go automate! - Learn about the available [automation conditions](/components/automation/#conditions) - Learn about [scripts](/components/script/) to help you trigger multiple actions and delays - Learn about [scenes](/components/scene/) to help you set many entities at once to your liking - - Setup the [notification component](/components/#notify-service) to sent yourself messages + - Setup a [notification platform](/components/#notifications) to sent yourself messages

Whenever you write the value on or off, surround it with quotes to avoid