Permalink
Browse files

* fix links.

  • Loading branch information...
kou committed Mar 16, 2009
1 parent 73ca05a commit 730a926dc951aa403646dbe1f1b121d9d9e53fbe
Showing with 10 additions and 12 deletions.
  1. +1 −1 app/views/layouts/static_documents.html.erb
  2. +9 −11 lib/static_document_generator.rb
@@ -12,7 +12,7 @@
<h1><%= title %></h1>
<div id="menu">
<ul>
- <li><a href="./">トップページ</a></li>
+ <li><a href="index.html">ドキュメント一覧</a></li>
<li><a href="usage.html">基本的な使い方</a></li>
<li><a href="ruby.html">ふりがなのふりかた</a></li>
<li><a href="image.html">画像のアップロード</a></li>
@@ -84,19 +84,11 @@ def title
h("ドキュメント - #{page_title || '一覧'}")
end
- def content_path(content)
- content.html_path
- end
-
- def static_content_path(content)
- content.html_path
- end
-
- def root_path
- "./"
+ def normalize_body(body)
+ remove_root_link(fix_link(body))
end
- def normalize_body(body)
+ def fix_link(body)
body.gsub(/(<(img|a)\s.*?(?:src|href))="(.+?)"/) do |matched_text|
prefix = $1
tag = $2
@@ -112,6 +104,12 @@ def normalize_body(body)
end
end
+ def remove_root_link(body)
+ body.gsub(/<a\s.*?href="\/">(.+?)<\/a>/) do |matched_text|
+ $1
+ end
+ end
+
def normalize_image_src(prefix, value)
nil
end

0 comments on commit 730a926

Please sign in to comment.