diff options
author | Matthew Landauer <matthew@openaustralia.org> | 2013-02-01 08:31:12 +1100 |
---|---|---|
committer | Matthew Landauer <matthew@openaustralia.org> | 2013-02-01 08:31:12 +1100 |
commit | 9c9a297d1fb5bec7ddbd4ef5709cb58cd2406c80 (patch) | |
tree | 742e6a98c5efe89ebfbe7fc57bf41dd8af43d72b /app/helpers/application_helper.rb | |
parent | 39f74e92f0785eb3da2001d93682b8d1aadd35d5 (diff) |
Small refactor to make method more concise
Diffstat (limited to 'app/helpers/application_helper.rb')
-rw-r--r-- | app/helpers/application_helper.rb | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index b9ba712a4..59d5e5114 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -54,15 +54,12 @@ module ApplicationHelper # Highlight words, also escapes HTML (other than spans that we add) def highlight_words(t, words, html = true) if html - t = h(t) - end - if html - t = highlight(t, words, '<span class="highlight">\1</span>') + highlight(h(t), words, '<span class="highlight">\1</span>') else - t = highlight(t, words, '*\1*') + highlight(t, words, '*\1*') end - return t end + def highlight_and_excerpt(t, words, excount, html = true) newt = excerpt(t, words[0], excount) if not newt |