Преглед изворни кода

Sidebar thumbnail order: post.thumbnail, post.banner or post image.

Dominique Da Silva пре 10 година
родитељ
комит
d00f5f1ee1

+ 13 - 6
layout/_partial/post/thumbnail.ejs

@@ -1,12 +1,19 @@
 <a href="<%- url_for((post.link?post.link:post.path)) %>" class="thumbnail">
   <%
-    var img=/\<img\s.*?\s?src\s*=\s*['|"]?([^\s'"]+).*?\>/ig;
-    var result = post.content.match(img);
     var s = "";
-    result = img.exec(post.content);
-    if(result != null) {
-      for(var i = result.length -1; i; --i){
-          s += result[i]+"\n";
+    
+    if (post.thumbnail){
+      s = post.thumbnail;
+    }else if (post.banner){
+      s = post.banner;
+    }else{
+      var img=/\<img\s.*?\s?src\s*=\s*['|"]?([^\s'"]+).*?\>/ig;
+      var result = post.content.match(img);  
+      result = img.exec(post.content);
+      if(result != null) {
+        for(var i = result.length -1; i; --i){
+            s += result[i]+"\n";
+        }
       }
     }
     if(s.length > 0){

+ 6 - 2
source/css/_partial/article.styl

@@ -5,15 +5,19 @@
   @extend $block
   overflow: hidden
 
+.article-banner
+  width:100%
+  height:auto
+
 .article-meta
   clearfix()
   & > div
     margin-bottom: 5px
   .article-date, .article-category
     margin-right: 10px
-    color: color-default
+    color: color-default + #444
   a
-    color: color-default
+    color: color-default + #444
     &:hover
       color: color-link
 

+ 6 - 0
source/css/_partial/highlight.styl

@@ -80,11 +80,17 @@ $line-numbers
       .gist-data
         background: none
         border: none
+        table
+          background: none
+        .pl-vo
+          color:#FFF
         .line-numbers
           @extend $line-numbers
           background: none
           border: none
           padding: 0 20px 0 0
+          height: font-size * line-height
+          vertical-align: top
         .line-data
           padding: 0 !important
       .highlight