| ... | ... |
@@ -33,6 +33,7 @@ google_analytics: true |
| 33 | 33 |
var tweet_count = #{page.tweet_count};
|
| 34 | 34 |
%script(src="/javascripts/mootools-yui-compressed.js" type="text/javascript") |
| 35 | 35 |
%script(src="/javascripts/mootools-1.2.4.2-more.js" type="text/javascript") |
| 36 |
+ %script(src="/javascripts/octopress.js" type="text/javascript") |
|
| 36 | 37 |
%script(src="/javascripts/twitter.js" type="text/javascript") |
| 37 | 38 |
- if page.respond_to? :google_analytics |
| 38 | 39 |
%script(src="http://www.google-analytics.com/ga.js" type="text/javascript") |
| 39 | 40 |
new file mode 100644 |
| ... | ... |
@@ -0,0 +1,34 @@ |
| 0 |
+window.addEvent('domready', function() {
|
|
| 1 |
+ addPreExpanders(); |
|
| 2 |
+}); |
|
| 3 |
+ |
|
| 4 |
+function addPreExpanders(){
|
|
| 5 |
+ $$('div.highlight').each(function(div){
|
|
| 6 |
+ addExpander(div); |
|
| 7 |
+ }); |
|
| 8 |
+} |
|
| 9 |
+function addExpander(div){
|
|
| 10 |
+ new Element('span',{
|
|
| 11 |
+ html: 'expand »', |
|
| 12 |
+ 'class': 'pre_expander', |
|
| 13 |
+ 'styles': {
|
|
| 14 |
+ 'display': 'block' |
|
| 15 |
+ }, |
|
| 16 |
+ 'events': {
|
|
| 17 |
+ 'click': function(){
|
|
| 18 |
+ toggleExpander(); |
|
| 19 |
+ } |
|
| 20 |
+ } |
|
| 21 |
+ }).inject(div, 'top'); |
|
| 22 |
+} |
|
| 23 |
+function toggleExpander(){
|
|
| 24 |
+ var html = ''; |
|
| 25 |
+ if($('main').toggleClass('expanded').hasClass('expanded')){
|
|
| 26 |
+ html = '« contract'; |
|
| 27 |
+ } else {
|
|
| 28 |
+ html = 'expand »'; |
|
| 29 |
+ } |
|
| 30 |
+ $$('div.highlight span.pre_expander').each(function(span){
|
|
| 31 |
+ span.set('html',html);
|
|
| 32 |
+ }); |
|
| 33 |
+} |
|
| 0 | 34 |
\ No newline at end of file |
| ... | ... |
@@ -2,18 +2,19 @@ |
| 2 | 2 |
layout: default |
| 3 | 3 |
title: Syntax Highlighting Debug |
| 4 | 4 |
--- |
| 5 |
-{% highlight ruby linenos %}
|
|
| 6 |
- def rebuild_site(relative) |
|
| 7 |
- puts ">>> Change Detected to: #{relative} <<<"
|
|
| 8 |
- IO.popen('rake generate') do |io|
|
|
| 9 |
- print(io.readpartial(512)) until io.eof? |
|
| 10 |
- end |
|
| 11 |
- puts '>>> Update Complete <<<' |
|
| 5 |
+{% highlight ruby %}
|
|
| 6 |
+def rebuild_site(relative) |
|
| 7 |
+ puts ">>> Change Detected to: #{relative} <<<"
|
|
| 8 |
+ IO.popen('rake generate') do |io|
|
|
| 9 |
+ print(io.readpartial(512)) until io.eof? |
|
| 12 | 10 |
end |
| 13 |
- |
|
| 11 |
+ puts '>>> Update Complete <<<' |
|
| 12 |
+end |
|
| 14 | 13 |
{% endhighlight %}
|
| 15 | 14 |
|
| 16 |
-{% highlight ruby linenos %}
|
|
| 15 |
+So that's a small example. What about a big one? |
|
| 16 |
+ |
|
| 17 |
+{% highlight ruby %}
|
|
| 17 | 18 |
require 'active_support/core_ext/array' |
| 18 | 19 |
require 'active_support/core_ext/hash/except' |
| 19 | 20 |
require 'active_support/core_ext/object/metaclass' |
| ... | ... |
@@ -17,6 +17,8 @@ |
| 17 | 17 |
font-family: Georgia, Times, "Times New Roman", serif |
| 18 | 18 |
=fixed-font |
| 19 | 19 |
font-family: "Menlo", "Bitstream Vera Sans", Monaco, "Andale Mono", "Lucida Console", monospace |
| 20 |
+=mono-font |
|
| 21 |
+ +fixed-font |
|
| 20 | 22 |
|
| 21 | 23 |
=general-typography(!font_size = !base_font_size) |
| 22 | 24 |
+set-heading-sizes(!font_size) |
| ... | ... |
@@ -2,21 +2,38 @@ pre |
| 2 | 2 |
color: #ccc |
| 3 | 3 |
font-size: 13px |
| 4 | 4 |
background: #222 |
| 5 |
- padding: 0 15px 0 0 |
|
| 6 |
- line-height: 1.625em |
|
| 5 |
+ line-height: 1.5em |
|
| 7 | 6 |
border: #aaa 1px solid |
| 8 | 7 |
overflow-x: auto |
| 8 |
+ padding: 25px 20px |
|
| 9 | 9 |
.lineno |
| 10 | 10 |
color: #888 |
| 11 | 11 |
background: #e3e3e3 |
| 12 |
- position: relative |
|
| 13 |
- line-height: 180% |
|
| 14 | 12 |
display: inline-block |
| 15 |
- padding: 0 10px |
|
| 13 |
+ padding: 0 0 0 10px |
|
| 16 | 14 |
&:first-child |
| 17 |
- padding-top: 12px |
|
| 18 |
- &:last-child |
|
| 19 |
- padding-bottom: 12px |
|
| 15 |
+ padding-top: 15px |
|
| 16 |
+ display: inline-block |
|
| 17 |
+ |
|
| 18 |
+.highlight |
|
| 19 |
+ position: relative |
|
| 20 |
+ .pre_expander |
|
| 21 |
+ +mono-font |
|
| 22 |
+ font-size: 10px |
|
| 23 |
+ text-align: right |
|
| 24 |
+ padding: 4px 8px |
|
| 25 |
+ line-height: 150% |
|
| 26 |
+ position: absolute |
|
| 27 |
+ cursor: pointer |
|
| 28 |
+ top: 2px |
|
| 29 |
+ right: 2px |
|
| 30 |
+ +border-bottom-left-radius |
|
| 31 |
+ display: block |
|
| 32 |
+ color: #777 |
|
| 33 |
+ background: #333 |
|
| 34 |
+ &:hover |
|
| 35 |
+ background: #444 |
|
| 36 |
+ color: #ccc |
|
| 20 | 37 |
|
| 21 | 38 |
// based on: http://github.com/mojombo/tpw/raw/master/css/syntax.css |
| 22 | 39 |
.editor |
| ... | ... |
@@ -41,7 +58,7 @@ pre.console |
| 41 | 41 |
color= lighten(#008000, 75) |
| 42 | 42 |
|
| 43 | 43 |
.highlight |
| 44 |
- padding: 0.5em |
|
| 44 |
+ padding: 0 0 0.1em |
|
| 45 | 45 |
color: white |
| 46 | 46 |
// Comment |
| 47 | 47 |
.c |