Skip to content
This repository was archived by the owner on Aug 27, 2021. It is now read-only.

Commit 0f61e97

Browse files
committed
1. Added image tag plugin
2. Removed figure tag plugin 3. Renamed custom_filters to octopress_filters 4. Added styles to support new image tag plugin
1 parent 7f98073 commit 0f61e97

File tree

4 files changed

+65
-75
lines changed

4 files changed

+65
-75
lines changed

.themes/classic/sass/partials/_blog.scss

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,32 @@ article {
4242
font-size: 2.0em; font-style: italic;
4343
line-height: 1.3em;
4444
}
45-
.entry-content {
46-
img, video { max-width: 100%; height: auto; }
47-
video {
48-
width: 100%; display: block; margin-bottom: 1.5em;
49-
padding: .8em; background: #fff; border: 1px solid #eee;
50-
@include box-sizing(border-box);
45+
img {
46+
max-width: 100%;
47+
border: .5em solid #fff;
48+
@include border-radius(.3em);
49+
@include box-shadow(rgba(#000, .15) 0 1px 4px);
50+
@include box-sizing(border-box);
51+
display: block;
52+
margin: 0 auto 1.5em;
53+
&.left {
54+
float: left;
55+
margin-right: 1.5em;
56+
}
57+
&.right {
58+
float: right;
59+
margin-left: 1.5em;
60+
}
61+
&.left, &.right {
62+
margin-bottom: .8em;
5163
}
5264
}
65+
img, video { max-width: 100%; height: auto; }
66+
video {
67+
width: 100%; display: block; margin-bottom: 1.5em;
68+
padding: .8em; background: #fff; border: 1px solid #eee;
69+
@include box-sizing(border-box);
70+
}
5371
.flash-video {
5472
max-width: 100%;
5573
margin-bottom: 1.5em;

plugins/figure_tag.rb

Lines changed: 0 additions & 69 deletions
This file was deleted.

plugins/image_tag.rb

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Title: Simple Image tag for Jekyll
2+
# Author: Brandon Mathis http://brandonmathis.com
3+
# Description: Easily output images with optional class names and title/alt attributes
4+
#
5+
# Syntax {% image [class name(s)] url [title text] %}
6+
#
7+
# Example:
8+
# {% imaeg left half http://site.com/images/ninja.png Ninja Attack! %}
9+
#
10+
# Output:
11+
# <image class='left' src="http://site.com/images/ninja.png" title="Ninja Attack!" alt="Ninja Attack!">
12+
#
13+
14+
module Jekyll
15+
16+
class ImageTag < Liquid::Tag
17+
@img = nil
18+
@title = nil
19+
@class = ''
20+
21+
def initialize(tag_name, markup, tokens)
22+
if markup =~ /(\S.*\s+)?(https?:\/\/|\/)(\S+)(\s+.+)?/i
23+
@class = $1
24+
@img = $2 + $3
25+
@title = $4
26+
end
27+
super
28+
end
29+
30+
def render(context)
31+
output = super
32+
if @img
33+
figure = "<img class='#{@class}' src='#{@img}' alt='#{@title}' title='#{@title}'>"
34+
else
35+
"Error processing input, expected syntax: {% img [class name(s)] /url/to/image [title text] %}"
36+
end
37+
end
38+
end
39+
end
40+
41+
Liquid::Template.register_tag('img', Jekyll::ImageTag)
File renamed without changes.

0 commit comments

Comments
 (0)