Created
July 31, 2008 01:39
-
-
Save pieter/3377 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1127f6fc32dede25d74e4d959d3dc6ab18c8adc3 Mon Sep 17 00:00:00 2001 | |
From: Pieter de Bie <[email protected]> | |
Date: Thu, 31 Jul 2008 03:38:30 +0200 | |
Subject: [PATCH] Simplify more code in the HTML parsing | |
--- | |
script/html.rb | 14 +++----------- | |
1 files changed, 3 insertions(+), 11 deletions(-) | |
diff --git a/script/html.rb b/script/html.rb | |
index 8b2b327..db90313 100644 | |
--- a/script/html.rb | |
+++ b/script/html.rb | |
@@ -15,20 +15,12 @@ def do_replacements(html, type = :html) | |
# replace gitlinks | |
- html = html.gsub /linkgit:.*?\[\d\]/ do |code| | |
- if match = /linkgit:(.*?)\[/.match(code) | |
- code = "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/#{match[1]}.html\">#{match[1].gsub('git-', 'git ')}</a>" | |
- end | |
- code | |
+ html.gsub! /linkgit:(.*?)\[\d\]/ do |code, waa| | |
+ "<a href=\"http://www.kernel.org/pub/software/scm/git/docs/#{$1}.html\">#{$1.gsub('git-', 'git ')}</a>" | |
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