Merge branch 'master' of github.com:imathis/octopress
Conflicts: plugins/category_generator.rb
This commit is contained in:
commit
2fe9da91f5
|
@ -1 +1 @@
|
|||
1.9.2-p290
|
||||
1.9.3-p194
|
||||
|
|
|
@ -1,44 +1,52 @@
|
|||
.highlight, html .gist .gist-file .gist-syntax .gist-highlight {
|
||||
table td.code { width: 100%; }
|
||||
.line-numbers {
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
line-height: 1.45em;
|
||||
@if $solarized == light {
|
||||
background: lighten($base03, 1) $noise-bg !important;
|
||||
border-right: 1px solid darken($base02, 2) !important;
|
||||
@include box-shadow(lighten($base03, 2) -1px 0 inset);
|
||||
text-shadow: lighten($base02, 2) 0 -1px;
|
||||
} @else {
|
||||
background: $base02 $noise-bg !important;
|
||||
border-right: 1px solid darken($base03, 2) !important;
|
||||
@include box-shadow(lighten($base02, 2) -1px 0 inset);
|
||||
text-shadow: darken($base02, 10) 0 -1px;
|
||||
}
|
||||
span { color: $base01 !important; }
|
||||
padding: .8em !important;
|
||||
@include border-radius(0);
|
||||
}
|
||||
border: 1px solid $pre-border !important;
|
||||
}
|
||||
.highlight .line-numbers, html .gist .gist-file .gist-syntax .highlight .line_numbers {
|
||||
text-align: right;
|
||||
font-size: 13px;
|
||||
line-height: 1.45em;
|
||||
@if $solarized == light {
|
||||
background: lighten($base03, 1) $noise-bg !important;
|
||||
border-right: 1px solid darken($base02, 2) !important;
|
||||
@include box-shadow(lighten($base03, 2) -1px 0 inset);
|
||||
text-shadow: lighten($base02, 2) 0 -1px;
|
||||
} @else {
|
||||
background: $base02 $noise-bg !important;
|
||||
border-right: 1px solid darken($base03, 2) !important;
|
||||
@include box-shadow(lighten($base02, 2) -1px 0 inset);
|
||||
text-shadow: darken($base02, 10) 0 -1px;
|
||||
}
|
||||
span { color: $base01 !important; }
|
||||
padding: .8em !important;
|
||||
@include border-radius(0);
|
||||
}
|
||||
|
||||
figure.code, .gist-file, pre {
|
||||
@include box-shadow(rgba(#000, .06) 0 0 10px);
|
||||
.highlight pre { @include box-shadow(none); }
|
||||
}
|
||||
|
||||
.gist .highlight, figure.code .highlight {
|
||||
@include selection(adjust-color($base03, $lightness: 23%, $saturation: -65%), $text-shadow: $base03 0 1px);
|
||||
}
|
||||
html .gist .gist-file {
|
||||
margin-bottom: 1.8em;
|
||||
position: relative;
|
||||
border: none;
|
||||
padding-top: image-height("code_bg.png") !important;
|
||||
.highlight {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
.gist-syntax {
|
||||
border-bottom: 0 !important;
|
||||
background: none !important;
|
||||
.gist-highlight{
|
||||
.gist-highlight {
|
||||
background: $base03 !important;
|
||||
pre {
|
||||
@extend .pre-code;
|
||||
}
|
||||
}
|
||||
.highlight pre {
|
||||
@extend .pre-code;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
.gist-meta {
|
||||
|
@ -107,12 +115,11 @@ p, li {
|
|||
}
|
||||
|
||||
.pre-code {
|
||||
@include selection(adjust-color($base03, $lightness: 23%, $saturation: -65%), $text-shadow: $base03 0 1px);
|
||||
font-family: $mono !important;
|
||||
overflow: scroll;
|
||||
overflow-y: hidden;
|
||||
display: block;
|
||||
padding: .8em !important;
|
||||
padding: .8em;
|
||||
overflow-x: auto;
|
||||
line-height: 1.45em;
|
||||
background: $base03 $noise-bg !important;
|
||||
|
@ -187,7 +194,7 @@ p, li {
|
|||
}
|
||||
|
||||
.highlight, .gist-highlight {
|
||||
pre { background: none; @include border-radius(none); border: none; padding: 0; margin-bottom: 0; }
|
||||
pre { background: none; @include border-radius(0px); border: none; padding: 0; margin-bottom: 0; }
|
||||
margin-bottom: 1.8em;
|
||||
background: $base03;
|
||||
overflow-y: hidden;
|
||||
|
@ -206,7 +213,9 @@ pre, .highlight, .gist-highlight {
|
|||
&::-webkit-scrollbar-thumb:horizontal { background: $solar-scroll-thumb; -webkit-border-radius: 4px; border-radius: 4px }
|
||||
}
|
||||
|
||||
.highlight code { @extend .pre-code; background: #000;}
|
||||
.highlight code {
|
||||
@extend .pre-code; background: #000;
|
||||
}
|
||||
figure.code {
|
||||
background: none;
|
||||
padding: 0;
|
||||
|
@ -250,4 +259,3 @@ figure.code {
|
|||
text-shadow: #cbcccc 0 1px 0;
|
||||
padding-left: 3em;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
<meta name="MobileOptimized" content="320">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
|
||||
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
|
||||
{% capture canonical %}{{ site.url }}{% if site.permalink contains '.html' %}{{ page.url }}{% else %}{% if page.url contains site.category_dir %}/{% endif %}{{ page.url | remove:'index.html' }}{% endif %}{% endcapture %}
|
||||
<link rel="canonical" href="{{ canonical }}">
|
||||
<link href="{{ root_url }}/favicon.png" rel="icon">
|
||||
<link href="{{ root_url }}/stylesheets/screen.css" media="screen, projection" rel="stylesheet" type="text/css">
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -1,33 +1,28 @@
|
|||
var github = (function(){
|
||||
function escapeHtml(str) {
|
||||
return $('<div/>').text(str).html();
|
||||
}
|
||||
function render(target, repos){
|
||||
var i = 0, fragment = '', t = $(target)[0];
|
||||
|
||||
for(i = 0; i < repos.length; i++) {
|
||||
fragment += '<li><a href="'+repos[i].url+'">'+repos[i].name+'</a><p>'+repos[i].description+'</p></li>';
|
||||
fragment += '<li><a href="'+repos[i].html_url+'">'+repos[i].name+'</a><p>'+escapeHtml(repos[i].description||'')+'</p></li>';
|
||||
}
|
||||
t.innerHTML = fragment;
|
||||
}
|
||||
return {
|
||||
showRepos: function(options){
|
||||
$.ajax({
|
||||
url: "http://github.com/api/v2/json/repos/show/"+options.user+"?callback=?"
|
||||
url: "https://api.github.com/users/"+options.user+"/repos?sort=pushed&callback=?"
|
||||
, type: 'jsonp'
|
||||
, error: function (err) { $(options.target + ' li.loading').addClass('error').text("Error loading feed"); }
|
||||
, success: function(data) {
|
||||
var repos = [];
|
||||
if (!data || !data.repositories) { return; }
|
||||
for (var i = 0; i < data.repositories.length; i++) {
|
||||
if (options.skip_forks && data.repositories[i].fork) { continue; }
|
||||
repos.push(data.repositories[i]);
|
||||
if (!data || !data.data) { return; }
|
||||
for (var i = 0; i < data.data.length; i++) {
|
||||
if (options.skip_forks && data.data[i].fork) { continue; }
|
||||
repos.push(data.data[i]);
|
||||
}
|
||||
repos.sort(function(a, b) {
|
||||
var aDate = new Date(a.pushed_at).valueOf(),
|
||||
bDate = new Date(b.pushed_at).valueOf();
|
||||
|
||||
if (aDate === bDate) { return 0; }
|
||||
return aDate > bDate ? -1 : 1;
|
||||
});
|
||||
|
||||
if (options.count) { repos.splice(options.count); }
|
||||
render(options.target, repos);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -11,6 +11,7 @@ function getNav() {
|
|||
mobileNav.children('select').bind('change', function(event) {
|
||||
if (event.target.value) { window.location.href = event.target.value; }
|
||||
});
|
||||
mobileNav.children('select').val('');
|
||||
}
|
||||
|
||||
function addSidebarToggler() {
|
||||
|
|
|
@ -44,7 +44,7 @@ function Pinboard_Linkroll() {
|
|||
if (it.t.length > 0) {
|
||||
for (var i = 0; i < it.t.length; i++) {
|
||||
var tag = it.t[i];
|
||||
str += " <a class=\"pin-tag\" href=\"http://pinboard.in/u:"+ this.cook(it.a) + "/t:" + this.cook(tag) + "\">" + this.cook(tag).replace(/^\s+|\s+$/g, '') + "</a> ";
|
||||
str += " <a class=\"pin-tag\" href=\"https://pinboard.in/u:"+ this.cook(it.a) + "/t:" + this.cook(tag) + "\">" + this.cook(tag).replace(/^\s+|\s+$/g, '') + "</a> ";
|
||||
}
|
||||
}
|
||||
str += "</p></li>\n";
|
||||
|
@ -52,5 +52,5 @@ function Pinboard_Linkroll() {
|
|||
}
|
||||
}
|
||||
Pinboard_Linkroll.prototype = new Pinboard_Linkroll();
|
||||
pinboardNS_fetch_script("http://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count);
|
||||
pinboardNS_fetch_script("https://feeds.pinboard.in/json/v1/u:"+pinboard_user+"/?cb=pinboardNS_show_bmarks\&count="+pinboard_count);
|
||||
|
||||
|
|
|
@ -42,8 +42,8 @@ function prettyDate(time) {
|
|||
function linkifyTweet(text, url) {
|
||||
// Linkify urls, usernames, hashtags
|
||||
text = text.replace(/(https?:\/\/)([\w\-:;?&=+.%#\/]+)/gi, '<a href="$1$2">$2</a>')
|
||||
.replace(/(^|\W)@(\w+)/g, '$1<a href="http://twitter.com/$2">@$2</a>')
|
||||
.replace(/(^|\W)#(\w+)/g, '$1<a href="http://search.twitter.com/search?q=%23$2">#$2</a>');
|
||||
.replace(/(^|\W)@(\w+)/g, '$1<a href="https://twitter.com/$2">@$2</a>')
|
||||
.replace(/(^|\W)#(\w+)/g, '$1<a href="https://search.twitter.com/search?q=%23$2">#$2</a>');
|
||||
|
||||
// Use twitter's api to replace t.co shortened urls with expanded ones.
|
||||
for (var u in url) {
|
||||
|
@ -62,7 +62,7 @@ function showTwitterFeed(tweets, twitter_user) {
|
|||
content = '';
|
||||
|
||||
for (var t in tweets) {
|
||||
content += '<li>'+'<p>'+'<a href="http://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
|
||||
content += '<li>'+'<p>'+'<a href="https://twitter.com/'+twitter_user+'/status/'+tweets[t].id_str+'">'+prettyDate(tweets[t].created_at)+'</a>'+linkifyTweet(tweets[t].text.replace(/\n/g, '<br>'), tweets[t].entities.urls)+'</p>'+'</li>';
|
||||
}
|
||||
timeline.innerHTML = content;
|
||||
}
|
||||
|
@ -70,7 +70,7 @@ function showTwitterFeed(tweets, twitter_user) {
|
|||
function getTwitterFeed(user, count, replies) {
|
||||
count = parseInt(count, 10);
|
||||
$.ajax({
|
||||
url: "http://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
|
||||
url: "https://api.twitter.com/1/statuses/user_timeline/" + user + ".json?trim_user=true&count=" + (count + 20) + "&include_entities=1&exclude_replies=" + (replies ? "0" : "1") + "&callback=?"
|
||||
, type: 'jsonp'
|
||||
, error: function (err) { $('#tweets li.loading').addClass('error').text("Twitter's busted"); }
|
||||
, success: function(data) { showTwitterFeed(data.slice(0, count), user); }
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
---
|
||||
layout: nil
|
||||
---
|
||||
User-agent: *
|
||||
Disallow:
|
||||
|
||||
Sitemap: {{ site.url }}/sitemap.xml
|
|
@ -0,0 +1,5 @@
|
|||
language: ruby
|
||||
rvm:
|
||||
- 1.9.3
|
||||
- 1.9.2
|
||||
script: bundle exec rake install; bundle exec rake generate
|
12
Gemfile
12
Gemfile
|
@ -1,18 +1,18 @@
|
|||
source "http://rubygems.org"
|
||||
|
||||
group :development do
|
||||
gem 'rake', '~> 0.9.2'
|
||||
gem 'rake', '~> 0.9'
|
||||
gem 'rack', '~> 1.4.1'
|
||||
gem 'jekyll', '~> 0.11.2'
|
||||
gem 'jekyll', '~> 0.12'
|
||||
gem 'rdiscount', '~> 1.6.8'
|
||||
gem 'pygments.rb', '~> 0.2.12'
|
||||
gem 'pygments.rb', '~> 0.3.4'
|
||||
gem 'RedCloth', '~> 4.2.9'
|
||||
gem 'haml', '~> 3.1.6'
|
||||
gem 'compass', '~> 0.12.1'
|
||||
gem 'haml', '~> 3.1.7'
|
||||
gem 'compass', '~> 0.12.2'
|
||||
gem 'rubypants', '~> 0.2.0'
|
||||
gem 'rb-fsevent', '~> 0.9'
|
||||
gem 'stringex', '~> 1.4.0'
|
||||
gem 'liquid', '~> 2.3.0'
|
||||
end
|
||||
|
||||
gem 'sinatra', '~> 1.3.2'
|
||||
gem 'sinatra', '~> 1.3.3'
|
||||
|
|
45
Gemfile.lock
45
Gemfile.lock
|
@ -2,68 +2,63 @@ GEM
|
|||
remote: http://rubygems.org/
|
||||
specs:
|
||||
RedCloth (4.2.9)
|
||||
albino (1.3.3)
|
||||
posix-spawn (>= 0.3.6)
|
||||
blankslate (2.1.2.4)
|
||||
chunky_png (1.2.5)
|
||||
classifier (1.3.3)
|
||||
fast-stemmer (>= 1.0.0)
|
||||
compass (0.12.1)
|
||||
compass (0.12.2)
|
||||
chunky_png (~> 1.2)
|
||||
fssm (>= 0.2.7)
|
||||
sass (~> 3.1)
|
||||
directory_watcher (1.4.1)
|
||||
fast-stemmer (1.0.1)
|
||||
ffi (1.0.11)
|
||||
fssm (0.2.9)
|
||||
haml (3.1.6)
|
||||
jekyll (0.11.2)
|
||||
albino (~> 1.3)
|
||||
haml (3.1.7)
|
||||
jekyll (0.12.0)
|
||||
classifier (~> 1.3)
|
||||
directory_watcher (~> 1.1)
|
||||
kramdown (~> 0.13)
|
||||
kramdown (~> 0.13.4)
|
||||
liquid (~> 2.3)
|
||||
maruku (~> 0.5)
|
||||
kramdown (0.13.6)
|
||||
pygments.rb (~> 0.3.2)
|
||||
kramdown (0.13.8)
|
||||
liquid (2.3.0)
|
||||
maruku (0.6.0)
|
||||
maruku (0.6.1)
|
||||
syntax (>= 1.0.0)
|
||||
posix-spawn (0.3.6)
|
||||
pygments.rb (0.2.12)
|
||||
rubypython (~> 0.5.3)
|
||||
pygments.rb (0.3.4)
|
||||
posix-spawn (~> 0.3.6)
|
||||
yajl-ruby (~> 1.1.0)
|
||||
rack (1.4.1)
|
||||
rack-protection (1.2.0)
|
||||
rack-protection (1.3.2)
|
||||
rack
|
||||
rake (0.9.2.2)
|
||||
rb-fsevent (0.9.1)
|
||||
rdiscount (1.6.8)
|
||||
rubypants (0.2.0)
|
||||
rubypython (0.5.3)
|
||||
blankslate (>= 2.1.2.3)
|
||||
ffi (~> 1.0.7)
|
||||
sass (3.1.18)
|
||||
sinatra (1.3.2)
|
||||
sass (3.1.20)
|
||||
sinatra (1.3.3)
|
||||
rack (~> 1.3, >= 1.3.6)
|
||||
rack-protection (~> 1.2)
|
||||
tilt (~> 1.3, >= 1.3.3)
|
||||
stringex (1.4.0)
|
||||
syntax (1.0.0)
|
||||
tilt (1.3.3)
|
||||
yajl-ruby (1.1.0)
|
||||
|
||||
PLATFORMS
|
||||
ruby
|
||||
|
||||
DEPENDENCIES
|
||||
RedCloth (~> 4.2.9)
|
||||
compass (~> 0.12.1)
|
||||
haml (~> 3.1.6)
|
||||
jekyll (~> 0.11.2)
|
||||
compass (~> 0.12.2)
|
||||
haml (~> 3.1.7)
|
||||
jekyll (~> 0.12)
|
||||
liquid (~> 2.3.0)
|
||||
pygments.rb (~> 0.2.12)
|
||||
pygments.rb (~> 0.3.4)
|
||||
rack (~> 1.4.1)
|
||||
rake (~> 0.9.2)
|
||||
rake (~> 0.9)
|
||||
rb-fsevent (~> 0.9)
|
||||
rdiscount (~> 1.6.8)
|
||||
rubypants (~> 0.2.0)
|
||||
sinatra (~> 1.3.2)
|
||||
sinatra (~> 1.3.3)
|
||||
stringex (~> 1.4.0)
|
||||
|
|
|
@ -16,13 +16,15 @@ Check out [Octopress.org](http://octopress.org/docs) for guides and documentatio
|
|||
|
||||
## Contributing
|
||||
|
||||
[![Build Status](https://travis-ci.org/imathis/octopress.png?branch=master)](https://travis-ci.org/imathis/octopress)
|
||||
|
||||
We love to see people contributing to Octopress, whether it's a bug report, feature suggestion or a pull request. At the moment, we try to keep the core slick and lean, focusing on basic blogging needs, so some of your suggestions might not find their way into Octopress. For those ideas, we started a [list of 3rd party plug-ins](https://github.com/imathis/octopress/wiki/3rd-party-plugins), where you can link your own Octopress plug-in repositories. For the future, we're thinking about ways to easier add them them into our main releases.
|
||||
|
||||
|
||||
## License
|
||||
(The MIT License)
|
||||
|
||||
Copyright © 2009-2011 Brandon Mathis
|
||||
Copyright © 2009-2013 Brandon Mathis
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ‘Software’), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
|
|
22
Rakefile
22
Rakefile
|
@ -7,7 +7,8 @@ require "stringex"
|
|||
ssh_user = "user@domain.com"
|
||||
ssh_port = "22"
|
||||
document_root = "~/website.com/"
|
||||
rsync_delete = true
|
||||
rsync_delete = false
|
||||
rsync_args = "" # Any extra arguments to pass to rsync
|
||||
deploy_default = "rsync"
|
||||
|
||||
# This will be configured for you when you run config_deploy
|
||||
|
@ -91,10 +92,13 @@ end
|
|||
# usage rake new_post[my-new-post] or rake new_post['my new post'] or rake new_post (defaults to "new-post")
|
||||
desc "Begin a new post in #{source_dir}/#{posts_dir}"
|
||||
task :new_post, :title do |t, args|
|
||||
if args.title
|
||||
title = args.title
|
||||
else
|
||||
title = get_stdin("Enter a title for your post: ")
|
||||
end
|
||||
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
|
||||
mkdir_p "#{source_dir}/#{posts_dir}"
|
||||
args.with_defaults(:title => 'new-post')
|
||||
title = args.title
|
||||
filename = "#{source_dir}/#{posts_dir}/#{Time.now.strftime('%Y-%m-%d')}-#{title.to_url}.#{new_post_ext}"
|
||||
if File.exist?(filename)
|
||||
abort("rake aborted!") if ask("#{filename} already exists. Do you want to overwrite?", ['y', 'n']) == 'n'
|
||||
|
@ -151,7 +155,7 @@ task :new_page, :filename do |t, args|
|
|||
end
|
||||
|
||||
# usage rake isolate[my-post]
|
||||
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much quicker."
|
||||
desc "Move all other posts than the one currently being worked on to a temporary stash location (stash) so regenerating the site happens much more quickly."
|
||||
task :isolate, :filename do |t, args|
|
||||
stash_dir = "#{source_dir}/#{stash_dir}"
|
||||
FileUtils.mkdir(stash_dir) unless File.exist?(stash_dir)
|
||||
|
@ -237,7 +241,7 @@ task :rsync do
|
|||
exclude = "--exclude-from '#{File.expand_path('./rsync-exclude')}'"
|
||||
end
|
||||
puts "## Deploying website via Rsync"
|
||||
ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
|
||||
ok_failed system("rsync -avze 'ssh -p #{ssh_port}' #{exclude} #{rsync_args} #{"--delete" unless rsync_delete == false} #{public_dir}/ #{ssh_user}:#{document_root}")
|
||||
end
|
||||
|
||||
desc "deploy public directory to github pages"
|
||||
|
@ -299,12 +303,14 @@ task :setup_github_pages, :repo do |t, args|
|
|||
if args.repo
|
||||
repo_url = args.repo
|
||||
else
|
||||
repo_url = get_stdin("Enter the read/write url for your repository: ")
|
||||
puts "Enter the read/write url for your repository"
|
||||
puts "(For example, 'git@github.com:your_username/your_username.github.com)"
|
||||
repo_url = get_stdin("Repository url: ")
|
||||
end
|
||||
user = repo_url.match(/:([^\/]+)/)[1]
|
||||
branch = (repo_url.match(/\/[\w-]+.github.com/).nil?) ? 'gh-pages' : 'master'
|
||||
branch = (repo_url.match(/\/[\w-]+\.github\.com/).nil?) ? 'gh-pages' : 'master'
|
||||
project = (branch == 'gh-pages') ? repo_url.match(/\/([^\.]+)/)[1] : ''
|
||||
unless `git remote -v`.match(/origin.+?octopress.git/).nil?
|
||||
unless (`git remote -v` =~ /origin.+?octopress(?:\.git)?/).nil?
|
||||
# If octopress is still the origin remote (from cloning) rename it to octopress
|
||||
system "git remote rename origin octopress"
|
||||
if branch == 'master'
|
||||
|
|
|
@ -4,7 +4,7 @@ require 'sinatra/base'
|
|||
# The project root directory
|
||||
$root = ::File.dirname(__FILE__)
|
||||
|
||||
class SinatraStaticServer < Sinatra::Base
|
||||
class SinatraStaticServer < Sinatra::Base
|
||||
|
||||
get(/.+/) do
|
||||
send_sinatra_file(request.path) {404}
|
||||
|
@ -16,10 +16,10 @@ 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') unless file_path =~ /\.[a-z]+$/i
|
||||
File.exist?(file_path) ? send_file(file_path) : missing_file_block.call
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
run SinatraStaticServer
|
||||
run SinatraStaticServer
|
||||
|
|
|
@ -2,7 +2,7 @@ require './plugins/pygments_code'
|
|||
|
||||
module BacktickCodeBlock
|
||||
include HighlightCode
|
||||
AllOptions = /([^\s]+)\s+(.+?)(https?:\/\/\S+)\s*(.+)?/i
|
||||
AllOptions = /([^\s]+)\s+(.+?)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
|
||||
LangCaption = /([^\s]+)\s*(.+)?/i
|
||||
def render_code_block(input)
|
||||
@options = nil
|
||||
|
|
|
@ -21,6 +21,7 @@ module Jekyll
|
|||
class Blockquote < Liquid::Block
|
||||
FullCiteWithTitle = /(\S.*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
||||
FullCite = /(\S.*)\s+(https?:\/\/)(\S+)/i
|
||||
AuthorTitle = /([^,]+),([^,]+)/
|
||||
Author = /(.+)/
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
|
@ -30,17 +31,15 @@ module Jekyll
|
|||
if markup =~ FullCiteWithTitle
|
||||
@by = $1
|
||||
@source = $2 + $3
|
||||
@title = $4.titlecase
|
||||
@title = $4.titlecase.strip
|
||||
elsif markup =~ FullCite
|
||||
@by = $1
|
||||
@source = $2 + $3
|
||||
elsif markup =~ AuthorTitle
|
||||
@by = $1
|
||||
@title = $2.titlecase.strip
|
||||
elsif markup =~ Author
|
||||
if $1 =~ /([^,]+),([^,]+)/
|
||||
@by = $1
|
||||
@title = $2.titlecase
|
||||
else
|
||||
@by = $1
|
||||
end
|
||||
@by = $1
|
||||
end
|
||||
super
|
||||
end
|
||||
|
|
|
@ -113,7 +113,17 @@ module Jekyll
|
|||
|
||||
# Throw an exception if the layout couldn't be found.
|
||||
else
|
||||
throw "No 'category_index' layout found."
|
||||
raise <<-ERR
|
||||
|
||||
|
||||
===============================================
|
||||
Error for category_generator.rb plugin
|
||||
-----------------------------------------------
|
||||
No 'category_index.hmtl' in source/_layouts/
|
||||
Perhaps you haven't installed a theme yet.
|
||||
===============================================
|
||||
|
||||
ERR
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -143,10 +153,7 @@ module Jekyll
|
|||
# Returns string
|
||||
#
|
||||
def category_links(categories)
|
||||
dir = @context.registers[:site].config['category_dir']
|
||||
categories = categories.sort!.map do |item|
|
||||
"<a class='category' href='/#{dir}/#{item.to_url}/'>#{item}</a>"
|
||||
end
|
||||
categories = categories.sort!.map { |c| category_link c }
|
||||
|
||||
case categories.length
|
||||
when 0
|
||||
|
@ -158,6 +165,17 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
# Outputs a single category as an <a> link.
|
||||
#
|
||||
# +category+ is a category string to format as an <a> link
|
||||
#
|
||||
# Returns string
|
||||
#
|
||||
def category_link(category)
|
||||
dir = @context.registers[:site].config['category_dir']
|
||||
"<a class='category' href='/#{dir}/#{category.to_url}/'>#{category}</a>"
|
||||
end
|
||||
|
||||
# Outputs the post.date as formatted html, with hooks for CSS styling.
|
||||
#
|
||||
# +date+ is the date object to format as HTML.
|
||||
|
|
|
@ -49,8 +49,7 @@ module Jekyll
|
|||
class CodeBlock < Liquid::Block
|
||||
include HighlightCode
|
||||
include TemplateWrapper
|
||||
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)\s+(.+)/i
|
||||
CaptionUrl = /(\S[\S\s]*)\s+(https?:\/\/)(\S+)/i
|
||||
CaptionUrlTitle = /(\S[\S\s]*)\s+(https?:\/\/\S+|\/\S+)\s*(.+)?/i
|
||||
Caption = /(\S[\S\s]*)/
|
||||
def initialize(tag_name, markup, tokens)
|
||||
@title = nil
|
||||
|
@ -63,10 +62,7 @@ module Jekyll
|
|||
end
|
||||
if markup =~ CaptionUrlTitle
|
||||
@file = $1
|
||||
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>#{$4}</a></figcaption>"
|
||||
elsif markup =~ CaptionUrl
|
||||
@file = $1
|
||||
@caption = "<figcaption><span>#{$1}</span><a href='#{$2 + $3}'>link</a></figcaption>"
|
||||
@caption = "<figcaption><span>#{$1}</span><a href='#{$2}'>#{$3 || 'link'}</a></figcaption>"
|
||||
elsif markup =~ Caption
|
||||
@file = $1
|
||||
@caption = "<figcaption><span>#{$1}</span></figcaption>\n"
|
||||
|
|
|
@ -95,4 +95,4 @@ module Jekyll
|
|||
self.data['updated_formatted'] = format_date(self.data['updated'], date_format) if self.data.has_key?('updated')
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -40,7 +40,9 @@ module Jekyll
|
|||
end
|
||||
|
||||
def script_url_for(gist_id, filename)
|
||||
"https://gist.github.com/#{gist_id}.js?file=#{filename}"
|
||||
url = "https://gist.github.com/#{gist_id}.js"
|
||||
url = "#{url}?file=#{filename}" unless filename.nil? or filename.empty?
|
||||
url
|
||||
end
|
||||
|
||||
def get_gist_url_for(gist, file)
|
||||
|
|
|
@ -37,4 +37,4 @@ module Jekyll
|
|||
end
|
||||
end
|
||||
|
||||
Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)
|
||||
Liquid::Template.register_tag('jsfiddle', Jekyll::JsFiddle)
|
||||
|
|
|
@ -24,12 +24,12 @@ module Jekyll
|
|||
class ContentFilters < PostFilter
|
||||
include OctopressFilters
|
||||
def pre_render(post)
|
||||
if post.ext.match('html|textile|markdown|haml|slim|xml')
|
||||
if post.ext.match('html|textile|markdown|md|haml|slim|xml')
|
||||
post.content = pre_filter(post.content)
|
||||
end
|
||||
end
|
||||
def post_render(post)
|
||||
if post.ext.match('html|textile|markdown|haml|slim|xml')
|
||||
if post.ext.match('html|textile|markdown|md|haml|slim|xml')
|
||||
post.content = post_filter(post.content)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -45,4 +45,4 @@ module Jekyll
|
|||
self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
# Sitemap.xml Generator is a Jekyll plugin that generates a sitemap.xml file by
|
||||
# traversing all of the available posts and pages.
|
||||
#
|
||||
#
|
||||
# How To Use:
|
||||
# 1) Copy source file into your _plugins folder within your Jekyll project.
|
||||
# 2) Change modify the url variable in _config.yml to reflect your domain name.
|
||||
|
@ -28,12 +28,12 @@
|
|||
# system modified date of the page or post, system modified date of
|
||||
# included layout, system modified date of included layout within that
|
||||
# layout, ...
|
||||
#
|
||||
#
|
||||
# Author: Michael Levin
|
||||
# Site: http://www.kinnetica.com
|
||||
# Distributed Under A Creative Commons License
|
||||
# - http://creativecommons.org/licenses/by/3.0/
|
||||
#
|
||||
#
|
||||
# Modified for Octopress by John W. Long
|
||||
#
|
||||
require 'rexml/document'
|
||||
|
|
|
@ -22,22 +22,31 @@ module Jekyll
|
|||
@width = ''
|
||||
|
||||
def initialize(tag_name, markup, tokens)
|
||||
if markup =~ /((https?:\/\/|\/)(\S+))(\s+(\d+)\s(\d+))?(\s+(https?:\/\/|\/)(\S+))?/i
|
||||
@video = $1
|
||||
@width = $5
|
||||
@height = $6
|
||||
@poster = $7
|
||||
if markup =~ /(https?:\S+)(\s+(https?:\S+))?(\s+(https?:\S+))?(\s+(\d+)\s(\d+))?(\s+(https?:\S+))?/i
|
||||
@video = [$1, $3, $5].compact
|
||||
@width = $7
|
||||
@height = $8
|
||||
@poster = $10
|
||||
end
|
||||
super
|
||||
end
|
||||
|
||||
def render(context)
|
||||
output = super
|
||||
if @video
|
||||
type = {
|
||||
'mp4' => "type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'",
|
||||
'ogv' => "type='video/ogg; codecs=theora, vorbis'",
|
||||
'webm' => "type='video/webm; codecs=vp8, vorbis'"
|
||||
}
|
||||
if @video.size > 0
|
||||
video = "<video width='#{@width}' height='#{@height}' preload='none' controls poster='#{@poster}'>"
|
||||
video += "<source src='#{@video}' type='video/mp4; codecs=\"avc1.42E01E, mp4a.40.2\"'/></video>"
|
||||
@video.each do |v|
|
||||
t = v.match(/([^\.]+)$/)[1]
|
||||
video += "<source src='#{v}' #{type[t]}>"
|
||||
end
|
||||
video += "</video>"
|
||||
else
|
||||
"Error processing input, expected syntax: {% video url/to/video [width height] [url/to/poster] %}"
|
||||
"Error processing input, expected syntax: {% video url/to/video [url/to/video] [url/to/video] [width height] [url/to/poster] %}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue