Better readability for URL generation methods in web.rb

This commit is contained in:
Alexey Verkhovsky 2005-02-13 15:57:58 +00:00
parent 112a21da5c
commit fd1d0ccc1e

View file

@ -87,16 +87,16 @@ class Web
link = CGI.escape(name) link = CGI.escape(name)
case mode case mode
when :export when :export
if has_page?(name) then "<a class=\"existingWikiWord\" href=\"#{link}.html\">#{text}</a>" if has_page?(name) then %{<a class="existingWikiWord" href="#{link}.html">#{text}</a>}
else "<span class=\"newWikiWord\">#{text}</span>" end else %{<span class="newWikiWord">#{text}</span>} end
when :publish when :publish
if has_page?(name) then "<a class=\"existingWikiWord\" href=\"../published/#{link}\">#{text}</a>" if has_page?(name) then %{<a class="existingWikiWord" href="../published/#{link}">#{text}</a>}
else "<span class=\"newWikiWord\">#{text}</span>" end else %{<span class="newWikiWord">#{text}</span>} end
else else
if has_page?(name) if has_page?(name)
"<a class=\"existingWikiWord\" href=\"../show/#{link}\">#{text}</a>" %{<a class="existingWikiWord" href="../show/#{link}">#{text}</a>}
else else
"<span class=\"newWikiWord\">#{text}<a href=\"../show/#{link}\">?</a></span>" %{<span class="newWikiWord">#{text}<a href="../show/#{link}">?</a></span>}
end end
end end
end end
@ -105,14 +105,14 @@ class Web
link = CGI.escape(name) link = CGI.escape(name)
case mode case mode
when :export when :export
if has_file?(name) then "<img alt=\"#{text}\" src=\"#{link}\" />" if has_file?(name) then %{<img alt="#{text}" src="#{link}" />}
else "<img alt=\"#{text}\" src=\"no image\" />" end else %{<img alt="#{text}" src="no image" />} end
when :publish when :publish
if has_file?(name) then "<img alt=\"#{text}\" src=\"#{link}\" />" if has_file?(name) then %{<img alt="#{text}" src="#{link}" />}
else "<span class=\"newWikiWord\">#{text}</span>" end else %{<span class="newWikiWord">#{text}</span>} end
else else
if has_file?(name) then "<img alt=\"#{text}\" src=\"../pic/#{link}\" />" if has_file?(name) then %{<img alt="#{text}" src="../pic/#{link}" />}
else "<span class=\"newWikiWord\">#{text}<a href=\"../pic/#{link}\">?</a></span>" end else %{<span class="newWikiWord">#{text}<a href="../pic/#{link}">?</a></span>} end
end end
end end