Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

* fix links.

  • Loading branch information...
commit 730a926dc951aa403646dbe1f1b121d9d9e53fbe 1 parent 73ca05a
@kou authored
View
2  app/views/layouts/static_documents.html.erb
@@ -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>
View
20 lib/static_document_generator.rb
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.