aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.rvmrc2
-rw-r--r--.themes/classic/sass/base/_layout.scss16
-rw-r--r--.themes/classic/sass/base/_typography.scss8
-rw-r--r--.themes/classic/sass/custom/_layout.scss4
-rw-r--r--Rakefile11
-rw-r--r--plugins/preview_unpublished.rb48
-rw-r--r--plugins/titlecase.rb4
7 files changed, 78 insertions, 15 deletions
diff --git a/.rvmrc b/.rvmrc
index f73d5d7b..35845a23 100644
--- a/.rvmrc
+++ b/.rvmrc
@@ -1 +1 @@
-rvm 1.9.2
+rvm use 1.9.2
diff --git a/.themes/classic/sass/base/_layout.scss b/.themes/classic/sass/base/_layout.scss
index 3774a3ce..f9f3a41a 100644
--- a/.themes/classic/sass/base/_layout.scss
+++ b/.themes/classic/sass/base/_layout.scss
@@ -14,6 +14,10 @@ $sidebar-width-wide: 300px !default;
$indented-lists: false !default;
+$header-font-size: 1em !default;
+$header-padding-top: 1.5em !default;
+$header-padding-bottom: 1.5em !default;
+
.group { @include pie-clearfix; }
@mixin collapse-sidebar {
@@ -79,9 +83,9 @@ body {
}
}
> header {
- font-size: 1em;
- padding-top: 1.5em;
- padding-bottom: 1.5em;
+ font-size: $header-font-size;
+ padding-top: $header-padding-top;
+ padding-bottom: $header-padding-bottom;
}
}
@@ -115,14 +119,14 @@ body.sidebar-footer {
}
@media only screen and (min-width: 550px) {
- body > header { font-size: 1em; }
+ body > header { font-size: $header-font-size; }
}
@media only screen and (min-width: 750px) {
aside.sidebar { @include collapse-sidebar; }
}
@media only screen and (min-width: 768px) {
body { -webkit-text-size-adjust: auto; }
- body > header { font-size: 1.2em; }
+ body > header { font-size: $header-font-size * 1.2; }
#main {
@extend .group;
padding: 0;
@@ -159,7 +163,7 @@ body.sidebar-footer {
}
@media only screen and (min-width: 992px) {
- body > header { font-size: 1.3em; }
+ body > header { font-size: $header-font-size * 1.3; }
#content { margin-right: $sidebar-width-wide; }
#content {
> div, > article {
diff --git a/.themes/classic/sass/base/_typography.scss b/.themes/classic/sass/base/_typography.scss
index 8ef39587..d6cf852b 100644
--- a/.themes/classic/sass/base/_typography.scss
+++ b/.themes/classic/sass/base/_typography.scss
@@ -61,12 +61,12 @@ h6, section h5, section section h4, section section section h3 {
p, blockquote, ul, ol { margin-bottom: 1.5em; }
ul { list-style-type: disc;
- ul { list-style-type: circle;
- ul { list-style-type: square; }}}
+ ul { list-style-type: circle; margin-bottom: 0px;
+ ul { list-style-type: square; margin-bottom: 0px; }}}
ol { list-style-type: decimal;
- ol { list-style-type: lower-alpha;
- ol { list-style-type: lower-roman; }}}
+ ol { list-style-type: lower-alpha; margin-bottom: 0px;
+ ol { list-style-type: lower-roman; margin-bottom: 0px; }}}
ul, ol { &, ul, ol { margin-left: 1.3em; }}
diff --git a/.themes/classic/sass/custom/_layout.scss b/.themes/classic/sass/custom/_layout.scss
index 53173115..74c7de9d 100644
--- a/.themes/classic/sass/custom/_layout.scss
+++ b/.themes/classic/sass/custom/_layout.scss
@@ -1,6 +1,10 @@
// Here you can easily change your sites's layout.
// To give it a try, uncomment some of the lines below, make changes, rebuild your blog, and see how it works.
+//$header-font-size: 1em;
+//$header-padding-top: 1.5em;
+//$header-padding-bottom: 1.5em;
+
//$max-width: 1350px;
//$indented-lists: true;
diff --git a/Rakefile b/Rakefile
index 7d7f6d8f..ebc386e6 100644
--- a/Rakefile
+++ b/Rakefile
@@ -59,7 +59,7 @@ task :watch do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass."
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
- jekyllPid = Process.spawn("jekyll --auto")
+ jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
compassPid = Process.spawn("compass watch")
trap("INT") {
@@ -75,7 +75,7 @@ task :preview do
raise "### You haven't set anything up yet. First run `rake install` to set up an Octopress theme." unless File.directory?(source_dir)
puts "Starting to watch source with Jekyll and Compass. Starting Rack on port #{server_port}"
system "compass compile --css-dir #{source_dir}/stylesheets" unless File.exist?("#{source_dir}/stylesheets/screen.css")
- jekyllPid = Process.spawn("jekyll --auto")
+ jekyllPid = Process.spawn({"OCTOPRESS_ENV"=>"preview"}, "jekyll --auto")
compassPid = Process.spawn("compass watch")
rackupPid = Process.spawn("rackup --port #{server_port}")
@@ -200,6 +200,13 @@ end
desc "Default deploy task"
task :deploy do
+ # Check if preview posts exist, which should not be published
+ if File.exists?(".preview-mode")
+ puts "## Found posts in preview mode, regenerating files ..."
+ File.delete(".preview-mode")
+ Rake::Task[:generate].execute
+ end
+
Rake::Task[:copydot].invoke(source_dir, public_dir)
Rake::Task["#{deploy_default}"].execute
end
diff --git a/plugins/preview_unpublished.rb b/plugins/preview_unpublished.rb
new file mode 100644
index 00000000..321ffd6f
--- /dev/null
+++ b/plugins/preview_unpublished.rb
@@ -0,0 +1,48 @@
+# Monkeypatch for Jekyll
+# Introduce distinction between preview/productive site generation
+# so posts with YAML attribute `published: false` can be previewed
+# on localhost without being published to the productive environment.
+
+module Jekyll
+
+ class Site
+ # Read all the files in <source>/<dir>/_posts and create a new Post
+ # object with each one.
+ #
+ # dir - The String relative path of the directory to read.
+ #
+ # Returns nothing.
+ def read_posts(dir)
+ base = File.join(self.source, dir, '_posts')
+ return unless File.exists?(base)
+ entries = Dir.chdir(base) { filter_entries(Dir['**/*']) }
+
+ # first pass processes, but does not yet render post content
+ entries.each do |f|
+ if Post.valid?(f)
+ post = Post.new(self, self.source, dir, f)
+
+ # Monkeypatch:
+ # On preview environment (localhost), publish all posts
+ if ENV.has_key?('OCTOPRESS_ENV') && ENV['OCTOPRESS_ENV'] == 'preview' && post.data.has_key?('published') && post.data['published'] == false
+ post.published = true
+ # Set preview mode flag (if necessary), `rake generate` will check for it
+ # to prevent pushing preview posts to productive environment
+ File.open(".preview-mode", "w") {}
+ end
+
+ if post.published && (self.future || post.date <= self.time)
+ self.posts << post
+ post.categories.each { |c| self.categories[c] << post }
+ post.tags.each { |c| self.tags[c] << post }
+ end
+ end
+ end
+
+ self.posts.sort!
+
+ # limit the posts if :limit_posts option is set
+ self.posts = self.posts[-limit_posts, limit_posts] if limit_posts
+ end
+ end
+end \ No newline at end of file
diff --git a/plugins/titlecase.rb b/plugins/titlecase.rb
index 3ad39b1f..7648932c 100644
--- a/plugins/titlecase.rb
+++ b/plugins/titlecase.rb
@@ -11,8 +11,8 @@ class String
# capitalize first and last words
x.first.to_s.smart_capitalize!
x.last.to_s.smart_capitalize!
- # small words after colons or periods are capitalized
- x.join(" ").gsub(/(:|\.)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
+ # small words are capitalized after colon, period, exclamation mark, question mark
+ x.join(" ").gsub(/(:|\.|!|\?)\s?(\W*#{small_words.join("|")}\W*)\s/) { "#{$1} #{$2.smart_capitalize} " }
end
def titlecase!