diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2008-09-24 18:16:41 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2008-09-24 18:16:41 +0200 |
commit | 787f63cd42025ca3143acaa9fdbd0cb3333e7c35 (patch) | |
tree | 27911c6364d6ba10cfe01abf19344a5215871e0c | |
parent | 12eabab2d9eea30fb07c84523a861be50d1830ca (diff) | |
download | trivium-787f63cd42025ca3143acaa9fdbd0cb3333e7c35.tar.gz trivium-787f63cd42025ca3143acaa9fdbd0cb3333e7c35.tar.xz trivium-787f63cd42025ca3143acaa9fdbd0cb3333e7c35.zip |
Support for thumbnails
-rw-r--r-- | data/style.css | 16 | ||||
-rw-r--r-- | trivium.rb | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/data/style.css b/data/style.css index e2cfc5e..476d69b 100644 --- a/data/style.css +++ b/data/style.css @@ -136,6 +136,22 @@ img.inline-math { } +.thumbs a { + background-color: #ffffff; + outline: none; +} + +.thumb img { + width: 220px; + margin: 8px 8px 0 0; +} + +.thumb img.full { + width: 454px; + margin: 8px 0 0 0; +} + + .nav { font-size: 12px; display: block; diff --git a/trivium.rb b/trivium.rb index 933f853..a73c553 100644 --- a/trivium.rb +++ b/trivium.rb @@ -77,6 +77,11 @@ class Dots < String body << "\\eqno{#{args.strip}}" unless args.strip.empty? %{<div class="math"><img alt="#{CGI.escapeHTML body}" src="#{ MATH_TEX}#{CGI.escape(body).gsub('+', '%20')}"></div>} + when "thumb" + '<div class="thumbs">' + body.split(/\n{2,}/).map { |para| + alt, thumb, img = para.strip.split("\n", 3) + %{<a class="thumb" href="#{img}"><img src="#{thumb}" alt="#{alt}"></a>} + }.join("\n") + '</div>' else %{<div class="#{name}">#{ BlueCloth.new(Dots.new(body).to_html).to_html}</div>} |