Browse code

gist tag plugin now works with the latest changes GitHub gists and does not fail if you do not specify a filename.

Brandon Mathis authored on 18/12/2012 at 17:38:37
Showing 2 changed files
... ...
@@ -1,44 +1,52 @@
1 1
 .highlight, html .gist .gist-file .gist-syntax .gist-highlight {
2 2
   table td.code { width: 100%; }
3
-  .line-numbers {
4
-    text-align: right;
5
-    font-size: 13px;
6
-    line-height: 1.45em;
7
-    @if $solarized == light {
8
-      background: lighten($base03, 1) $noise-bg !important;
9
-      border-right: 1px solid darken($base02, 2) !important;
10
-      @include box-shadow(lighten($base03, 2) -1px 0 inset);
11
-      text-shadow: lighten($base02, 2) 0 -1px;
12
-    } @else {
13
-      background: $base02 $noise-bg !important;
14
-      border-right: 1px solid darken($base03, 2) !important;
15
-      @include box-shadow(lighten($base02, 2) -1px 0 inset);
16
-      text-shadow: darken($base02, 10) 0 -1px;
17
-    }
18
-    span { color: $base01 !important; }
19
-    padding: .8em !important;
20
-    @include border-radius(0);
21
-  }
22 3
   border: 1px solid $pre-border !important;
23 4
 }
5
+.highlight .line-numbers, html .gist .gist-file .gist-syntax .highlight .line_numbers {
6
+  text-align: right;
7
+  font-size: 13px;
8
+  line-height: 1.45em;
9
+  @if $solarized == light {
10
+    background: lighten($base03, 1) $noise-bg !important;
11
+    border-right: 1px solid darken($base02, 2) !important;
12
+    @include box-shadow(lighten($base03, 2) -1px 0 inset);
13
+    text-shadow: lighten($base02, 2) 0 -1px;
14
+  } @else {
15
+    background: $base02 $noise-bg !important;
16
+    border-right: 1px solid darken($base03, 2) !important;
17
+    @include box-shadow(lighten($base02, 2) -1px 0 inset);
18
+    text-shadow: darken($base02, 10) 0 -1px;
19
+  }
20
+  span { color: $base01 !important; }
21
+  padding: .8em !important;
22
+  @include border-radius(0);
23
+}
24
+
24 25
 figure.code, .gist-file, pre {
25 26
   @include box-shadow(rgba(#000, .06) 0 0 10px);
26 27
   .highlight pre { @include box-shadow(none); }
27 28
 }
28 29
 
30
+.gist .highlight, figure.code .highlight {
31
+  @include selection(adjust-color($base03, $lightness: 23%, $saturation: -65%), $text-shadow: $base03 0 1px);
32
+}
29 33
 html .gist .gist-file {
30 34
   margin-bottom: 1.8em;
31 35
   position: relative;
32 36
   border: none;
33 37
   padding-top: image-height("code_bg.png") !important;
38
+  .highlight {
39
+    margin-bottom: 0;
40
+  }
34 41
   .gist-syntax {
35 42
     border-bottom: 0 !important;
36 43
     background: none !important;
37
-    .gist-highlight{
44
+    .gist-highlight {
38 45
       background: $base03 !important;
39
-      pre {
40
-        @extend .pre-code;
41
-      }
46
+    }
47
+    .highlight pre {
48
+      @extend .pre-code;
49
+      padding: 0;
42 50
     }
43 51
   }
44 52
   .gist-meta {
... ...
@@ -107,12 +115,11 @@ p, li {
107 107
 }
108 108
 
109 109
 .pre-code {
110
-  @include selection(adjust-color($base03, $lightness: 23%, $saturation: -65%), $text-shadow: $base03 0 1px);
111 110
   font-family: $mono !important;
112 111
   overflow: scroll;
113 112
   overflow-y: hidden;
114 113
   display: block;
115
-  padding: .8em !important;
114
+  padding: .8em;
116 115
   overflow-x: auto;
117 116
   line-height: 1.45em;
118 117
   background: $base03 $noise-bg !important;
... ...
@@ -187,7 +194,7 @@ p, li {
187 187
 }
188 188
 
189 189
 .highlight, .gist-highlight {
190
-  pre { background: none; @include border-radius(none); border: none; padding: 0; margin-bottom: 0; }
190
+  pre { background: none; @include border-radius(0px); border: none; padding: 0; margin-bottom: 0; }
191 191
   margin-bottom: 1.8em;
192 192
   background: $base03;
193 193
   overflow-y: hidden;
... ...
@@ -206,7 +213,9 @@ pre, .highlight, .gist-highlight {
206 206
   &::-webkit-scrollbar-thumb:horizontal { background: $solar-scroll-thumb;  -webkit-border-radius: 4px; border-radius: 4px }
207 207
 }
208 208
 
209
-.highlight code { @extend .pre-code; background: #000;}
209
+.highlight code { 
210
+  @extend .pre-code; background: #000;
211
+}
210 212
 figure.code {
211 213
   background: none;
212 214
   padding: 0;
... ...
@@ -250,4 +259,3 @@ figure.code {
250 250
   text-shadow: #cbcccc 0 1px 0;
251 251
   padding-left: 3em;
252 252
 }
253
-
... ...
@@ -40,7 +40,9 @@ module Jekyll
40 40
     end
41 41
 
42 42
     def script_url_for(gist_id, filename)
43
-      "https://gist.github.com/#{gist_id}.js?file=#{filename}"
43
+      url = "https://gist.github.com/#{gist_id}.js"
44
+      url = "#{url}?file=#{filename}" unless filename.nil? or filename.empty?
45
+      url
44 46
     end
45 47
 
46 48
     def get_gist_url_for(gist, file)