Browse code

1. Updated typography for blockquotes 2. Improved blockquote Liquid tag 3. Added custom layout Sass for making layout changes simple

Brandon Mathis authored on 22/06/2011 at 22:53:17
Showing 8 changed files
... ...
@@ -11,7 +11,7 @@
11 11
 #   <blockquote>
12 12
 #     <p>Wheeee!</p>
13 13
 #     <footer>
14
-#     <strong>John Paul Jones</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a>
14
+#     <strong>Bobby Willis</strong><cite><a href="http://google.com/blah">The Search For Bobby's Mom</a>
15 15
 #   </blockquote>
16 16
 #
17 17
 require './_plugins/titlecase.rb'
... ...
@@ -40,18 +40,33 @@ module Jekyll
40 40
     end
41 41
 
42 42
     def render(context)
43
-      output = super
44
-      author = "<strong>#{@by}</strong>"
45
-      cite = "<cite><a class='source' href='#{@source}'>#{(@title || 'source')}</a></cite>"
43
+      output = paragraphize(super.map(&:strip).join)
44
+      author = "<strong>#{@by.strip}</strong>"
45
+      if @source
46
+        url = @source.match(/https?:\/\/(.+)/)[1].split('/')
47
+        parts = []
48
+        url.each do |part|
49
+          if (parts + [part]).join('/').length < 32
50
+            parts << part
51
+          end
52
+        end
53
+        source = parts.join('/')
54
+        source << '/&hellip;' unless source == @source
55
+      end
56
+      cite = "<cite><a href='#{@source}'>#{(@title || source)}</a></cite>"
46 57
       reply = if @by.nil?
47
-        "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p>"
58
+        output
48 59
       elsif !@source.nil?
49
-        "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p><footer>#{author + cite}</footer>"
60
+        "#{output}<footer>#{author + cite}</footer>"
50 61
       else
51
-        "<p>#{output.join.gsub(/\n\n/, '</p><p>')}</p><footer>#{author}</footer>"
62
+        "#{output}<footer>#{author}</footer>"
52 63
       end
53 64
       "<blockquote>#{reply}</blockquote>"
54 65
     end
66
+
67
+    def paragraphize(input)
68
+      "<p>#{input.gsub(/\n\n/, '</p><p>').gsub(/\n/, '<br/>')}</p>"
69
+    end
55 70
   end
56 71
 end
57 72
 
... ...
@@ -1,19 +1,18 @@
1
-$default-border-radius: 4px;
2
-
3
-$pad-min: 18px;
4
-$pad-narrow: 20px;
5
-$pad-medium: 35px;
6
-$pad-wide: 55px;
7
-$sidebar-width-medium: 240px;
8
-$sidebar-pad-medium: 15px;
9
-$sidebar-pad-wide: 20px;
10
-$sidebar-width-wide: 300px;
1
+$max-width: 1200px !default;
2
+$pad-min: 18px !default;
3
+$pad-narrow: 25px !default;
4
+$pad-medium: 35px !default;
5
+$pad-wide: 55px !default;
6
+$sidebar-width-medium: 240px !default;
7
+$sidebar-pad-medium: 15px !default;
8
+$sidebar-pad-wide: 20px !default;
9
+$sidebar-width-wide: 300px !default;
11 10
 
12 11
 .group { @include pie-clearfix; }
13 12
 
14 13
 body {
15 14
   -webkit-text-size-adjust: none;
16
-  max-width: 1350px;
15
+  max-width: $max-width;
17 16
   position: relative;
18 17
   margin: 0 auto;
19 18
   > header, > nav, > footer, #articles > article {
... ...
@@ -10,7 +10,7 @@ $mono: Menlo, Monaco, "Andale Mono", "lucida console", "Courier New", monospace;
10 10
 .mono { font-family: $mono; }
11 11
 
12 12
 body > header h1 {
13
-  font-size: 3em;
13
+  font-size: 2.6em;
14 14
   @extend .heading;
15 15
   font-weight: normal;
16 16
   line-height: 1.2em;
... ...
@@ -93,30 +93,18 @@ blockquote {
93 93
   $bq-margin: 1.2em;
94 94
   font-style: italic;
95 95
   position: relative;
96
-  margin-left: $bq-margin;
97
-  > p {
98
-    &:first-child:before {
99
-      content: "\201C";
100
-      position: absolute;
101
-      top: 0.1em;
102
-      left: -.5em;
103
-      font-size: 3em;
104
-      color: $blockquote;
105
-    }
106
-    &:last-child:after {
107
-      content: "\201D";
108
-      position: relative;
109
-      top: 0.3em;
110
-      line-height: 0;
111
-      font-size: 2em;
112
-      color: $blockquote;
113
-    }
96
+  font-size: 1.2em;
97
+  line-height: 1.5em;
98
+  padding-left: 1em;
99
+  border-left: 4px solid rgba($text-color-light, .5);
100
+  cite {
101
+    font-style: italic;
102
+    a { color: $text-color-light !important; word-wrap: break-word; }
103
+    &:before { content: '–'; padding:{right: .3em; left: .3em;} color: $text-color-light; }
114 104
   }
115
-  + p > cite {
116
-    margin-left: $bq-margin;
117
-    text-align: right;
118
-    &:before { content: '– '; color: $text-color-light; }
119
-    a { font-style: italic; }
105
+  @media only screen and (min-width: 992px) {
106
+    padding-left: 1.5em;
107
+    border-left-width: 4px;
120 108
   }
121 109
 }
122 110
 
... ...
@@ -10,13 +10,11 @@
10 10
 
11 11
 
12 12
 //To use the light Solarized highlighting theme uncomment this block
13
-/*
14
-$base03: $base3;
15
-$base02: $base2;
16
-$base01: $base1;
17
-$base00: $base0;
18
-$base0: $base00;
19
-$base1: $base01;
20
-$base2: $base02;
21
-$base3: $base03;
22
-*/
13
+//$base03: $base3;
14
+//$base02: $base2;
15
+//$base01: $base1;
16
+//$base00: $base0;
17
+//$base0: $base00;
18
+//$base1: $base01;
19
+//$base2: $base02;
20
+//$base3: $base03;
23 21
new file mode 100644
... ...
@@ -0,0 +1,16 @@
0
+// Here you can easily change your sites's layout.
1
+// To give it a try, uncomment some of the lines below, make changes, rebuild your blog, and see how it works.
2
+
3
+//$max-width: 1350px;
4
+
5
+// Padding used for layout margins
6
+//$pad-min: 18px;
7
+//$pad-narrow: 25px;
8
+//$pad-medium: 35px;
9
+//$pad-wide: 55px;
10
+
11
+// Sidebar widths used in media queries
12
+//$sidebar-width-medium: 240px;
13
+//$sidebar-pad-medium: 15px;
14
+//$sidebar-pad-wide: 20px;
15
+//$sidebar-width-wide: 300px;
... ...
@@ -1,5 +1,6 @@
1 1
 $border: inline-image('dotted-border.png');
2 2
 #articles {
3
+  overflow: hidden;
3 4
   @media only screen and (max-width: 768px) {
4 5
     ul, ol { margin-left: 1.4em; }
5 6
   }
... ...
@@ -91,7 +92,7 @@ $border: inline-image('dotted-border.png');
91 91
       top: .3em;
92 92
       padding-left: .5em;
93 93
     }
94
-    footer {
94
+    > footer {
95 95
       margin-top: 2em;
96 96
       padding-top: 1em;
97 97
       margin-bottom: 1.5em;
... ...
@@ -58,7 +58,7 @@ pre {
58 58
   line-height: 1.45em;
59 59
   font-size: .8em;
60 60
   margin-bottom: 1.5em;
61
-  padding: .4em .8em;
61
+  padding: .8em 1em;
62 62
   color: #555;
63 63
   overflow: auto;
64 64
 }
... ...
@@ -6,6 +6,7 @@
6 6
 @import "partials/solarized";
7 7
 @import "custom/colors";
8 8
 @import "core/theme";
9
+@import "custom/layout";
9 10
 @import "core/layout";
10 11
 @import "core/typography";
11 12