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

pull/14/head
Dominique Da Silva 2015-05-27 13:37:17 +02:00
parent 760fbf8125
commit d00f5f1ee1
3 changed files with 25 additions and 8 deletions

View File

@ -1,14 +1,21 @@
<a href="<%- url_for((post.link?post.link:post.path)) %>" class="thumbnail"> <a href="<%- url_for((post.link?post.link:post.path)) %>" class="thumbnail">
<% <%
var s = "";
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 img=/\<img\s.*?\s?src\s*=\s*['|"]?([^\s'"]+).*?\>/ig;
var result = post.content.match(img); var result = post.content.match(img);
var s = "";
result = img.exec(post.content); result = img.exec(post.content);
if(result != null) { if(result != null) {
for(var i = result.length -1; i; --i){ for(var i = result.length -1; i; --i){
s += result[i]+"\n"; s += result[i]+"\n";
} }
} }
}
if(s.length > 0){ if(s.length > 0){
if(config.post_asset_folder){ if(config.post_asset_folder){
var pattern = /^[\\{0,1}\/{0,1}]([^\/^\\]+)/, var pattern = /^[\\{0,1}\/{0,1}]([^\/^\\]+)/,

View File

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

View File

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