mirror of
https://github.com/moparisthebest/android.moparisthebest.org
synced 2024-12-24 08:28:50 -05:00
Merge branch 'master' into site
This commit is contained in:
commit
8cb7bfd9aa
@ -1,4 +1 @@
|
||||
{% include asides/recent_posts.html %}
|
||||
{% include asides/twitter.html %}
|
||||
{% include asides/delicious.html %}
|
||||
{% include asides/pinboard.html %}
|
||||
{% include_array asides %}
|
||||
|
@ -6,9 +6,6 @@
|
||||
<div id="main">
|
||||
<div id="content">
|
||||
{{ content | expand_urls: root_url | backtick_codeblock | smart_quotes }}
|
||||
{% unless page.sidebar == false %}
|
||||
<aside role=sidebar>{% include sidebar.html %}</aside>
|
||||
{% endunless %}
|
||||
</div>
|
||||
</div>
|
||||
<footer>{% include footer.html %}</footer>
|
||||
|
@ -29,3 +29,12 @@ layout: default
|
||||
</section>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% unless page.sidebar == false %}
|
||||
<aside role=sidebar>
|
||||
{% if site.page_asides.size %}
|
||||
{% include_array page_asides %}
|
||||
{% else %}
|
||||
{% include_array default_asides %}
|
||||
{% endif %}
|
||||
</aside>
|
||||
{% endunless %}
|
||||
|
@ -24,3 +24,12 @@ single: true
|
||||
</section>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% unless page.sidebar == false %}
|
||||
<aside role=sidebar>
|
||||
{% if site.post_asides.size %}
|
||||
{% include_array post_asides %}
|
||||
{% else %}
|
||||
{% include_array default_asides %}
|
||||
{% endif %}
|
||||
</aside>
|
||||
{% endunless %}
|
||||
|
@ -1,6 +1,5 @@
|
||||
---
|
||||
layout: default
|
||||
meta: false
|
||||
footer: false
|
||||
---
|
||||
<div class="blog-index">
|
||||
@ -36,3 +35,10 @@ footer: false
|
||||
</script>
|
||||
{% endif %}
|
||||
</div>
|
||||
<aside role=sidebar>
|
||||
{% if site.blog_index_asides.size %}
|
||||
{% include_array blog_index_asides %}
|
||||
{% else %}
|
||||
{% include_array default_asides %}
|
||||
{% endif %}
|
||||
</aside>
|
||||
|
10
_config.yml
10
_config.yml
@ -34,6 +34,16 @@ pygments: false
|
||||
paginate: 10 # Posts per page on the blog index
|
||||
recent_posts: 5 # Posts in the sidebar Recent Posts section
|
||||
|
||||
# list each of the sidebar modules you want to include, in the order you want them to appear.
|
||||
# To add custom asides, create files in /source/_includes/asides/custom/ and add them to the list like 'asides/custom/custom_aside_name.html'
|
||||
default_asides: [asides/recent_posts.html, asides/twitter.html, asides/delicious.html, asides/pinboard.html]
|
||||
|
||||
# Each layout uses the default asides, but they can have their own asides instead. Simply uncomment the lines below
|
||||
# and add an array with the asides you want to use.
|
||||
# blog_index_asides:
|
||||
# post_asides:
|
||||
# page_asides:
|
||||
|
||||
# ----------------------- #
|
||||
# 3rd Party Settings #
|
||||
# ----------------------- #
|
||||
|
58
plugins/include_array.rb
Normal file
58
plugins/include_array.rb
Normal file
@ -0,0 +1,58 @@
|
||||
# Title: Include Array Tag for Jekyll
|
||||
# Author: Jason Woodward http://www.woodwardjd.com
|
||||
# Description: Import files on your filesystem as specified in a configuration variable in _config.yml. Mostly cribbed from Jekyll's include tag.
|
||||
# Syntax: {% include_array variable_name_from_config.yml %}
|
||||
#
|
||||
# Example 1:
|
||||
# {% include_array asides %}
|
||||
#
|
||||
# _config.yml snippet:
|
||||
# asides: [asides/twitter.html, asides/custom/my_picture.html]
|
||||
#
|
||||
module Jekyll
|
||||
|
||||
class IncludeArrayTag < Liquid::Tag
|
||||
Syntax = /(#{Liquid::QuotedFragment}+)/
|
||||
def initialize(tag_name, markup, tokens)
|
||||
if markup =~ Syntax
|
||||
@array_name = $1
|
||||
else
|
||||
raise SyntaxError.new("Error in tag 'include_array' - Valid syntax: include_array [array from _config.yml]")
|
||||
end
|
||||
|
||||
super
|
||||
end
|
||||
|
||||
def render(context)
|
||||
includes_dir = File.join(context.registers[:site].source, '_includes')
|
||||
|
||||
if File.symlink?(includes_dir)
|
||||
return "Includes directory '#{includes_dir}' cannot be a symlink"
|
||||
end
|
||||
|
||||
rtn = ''
|
||||
(context.environments.first['site'][@array_name] || []).each do |file|
|
||||
if file !~ /^[a-zA-Z0-9_\/\.-]+$/ || file =~ /\.\// || file =~ /\/\./
|
||||
rtn = rtn + "Include file '#{file}' contains invalid characters or sequences"
|
||||
end
|
||||
|
||||
Dir.chdir(includes_dir) do
|
||||
choices = Dir['**/*'].reject { |x| File.symlink?(x) }
|
||||
if choices.include?(file)
|
||||
source = File.read(file)
|
||||
partial = Liquid::Template.parse(source)
|
||||
context.stack do
|
||||
rtn = rtn + partial.render(context)
|
||||
end
|
||||
else
|
||||
rtn = rtn + "Included file '#{file}' not found in _includes directory"
|
||||
end
|
||||
end
|
||||
end
|
||||
rtn
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('include_array', Jekyll::IncludeArrayTag)
|
Loading…
Reference in New Issue
Block a user