instiki/app/views/wiki/search.rhtml
Jacques Distler c79fef9c01 Clean, rather than Complain
Previously, if the user tried to submit content which was
malformed utf-8, Instiki would complain loudly to him.

A slightly more user-friendly approach was suggested by
the latest Rails 2.3.4, and a conversation with Sam Ruby
(who suggested some improvements).

Now, instead of complaining, we remove the offending bytes,
leaving a well-formed utf-8 string, which we pretend is what
the user meant to submit.
2009-09-07 16:02:36 -05:00

42 lines
1.4 KiB
Plaintext

<%- @title = "Search results for \"#{h @query}\"" -%>
<%- unless @title_results.empty? -%>
<h2><%= @title_results.length %> page(s) containing search string in the page name:</h2>
<ul>
<%- for page in @title_results -%>
<li>
<%= link_to page.plain_name, :web => @web.address, :action => 'show', :id => page.name %>
</li>
<%- end -%>
</ul>
<%- end -%>
<%- unless @results.empty? -%>
<h2> <%= @results.length %> page(s) containing search string in the page text:</h2>
<ul>
<%- for page in @results -%>
<li>
<%= link_to page.plain_name, :web => @web.address, :action => 'show', :id => page.name %>
</li>
<%- end -%>
</ul>
<%- end -%>
<%- if (@results + @title_results).empty? -%>
<h2>No pages contain "<%= h @query %>" </h2>
<p>
Perhaps you should try expanding your query. Remember that Instiki searches for entire
phrases, so if you search for "all that jazz" it will not match pages that contain these
words in separation &#x2014; only as a sentence fragment.
</p>
<p>
If you're a high-tech computer wizard, you might even want try constructing a Ruby regular
expression. That's actually what Instiki uses, so go right ahead and flex your
"[a-z]*Leet?RegExpSkill(s|z)"
</p>
<p>
<b>Create a new page, named:</b> "<span class='newWikiWord'><%= link_to h(@query), :web => @web.address, :action => 'new', :id => @query %></span>"
</p>
<%- end -%>