Skip to content

Instantly share code, notes, and snippets.

@pieter
Created July 31, 2008 01:38
Show Gist options
  • Save pieter/3376 to your computer and use it in GitHub Desktop.
Save pieter/3376 to your computer and use it in GitHub Desktop.
From 7ce7b74b6eb4fb79821a38b01daac21c75da673f Mon Sep 17 00:00:00 2001
From: Pieter de Bie <pdebie@ai.rug.nl>
Date: Thu, 31 Jul 2008 03:38:30 +0200
Subject: [PATCH] Simplify more code in the HTML parsing
---
script/html.rb | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/script/html.rb b/script/html.rb
index 8b2b327..2577966 100644
--- a/script/html.rb
+++ b/script/html.rb
@@ -23,12 +23,7 @@ def do_replacements(html, type = :html)
end
# replace figures
- html = html.gsub /\[fig:.*?\]/ do |code|
- if match = /\[fig:(.*?)\]/.match(code)
- code = "<div class=\"center\"><img src=\"images/figure/#{match[1]}.png\"></div>"
- end
- code
- end
+ html.gsub! /\[fig:(.*?)\]/, '<div class="center"><img src="images/figure/\1.png"></div>'
# fix images in pdf
html.gsub!('src="images', 'src="assets/images') if type == :pdf
--
1.6.0.rc1.163.gc85c5.dirty
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment