djangosnippets.org: Latest snippets tagged with 'highlight'https://djangosnippets.org/tags/highlight/2014-08-19T09:17:26.665808-05:00highlight text
2014-08-19T09:17:26.665808-05:00nathantnhttps://djangosnippets.org/snippets/3087/<p>How to use:</p>
<p>{% load highlight %}</p>
<p>{{ text|highlight:'word' }}</p>
Freely redistributablehighlight pattern
2009-04-19T13:21:10.107543-05:00nicolaslarahttps://djangosnippets.org/snippets/1450/<p>Encloses all matches of a pattern between the opentag and closetag string.
<code>{% with "this is a large test" as a %}
{{ a|highlightpattern:"a" }}
{% endwith %}</code>
yields </p>
<p>this is <b>a</b> l<b>a</b>rge test</p>
Freely redistributableText Highlighting Filter
2008-12-10T15:32:20.857191-06:00girasquidhttps://djangosnippets.org/snippets/1242/<p>This filter can be used to wrap <span class='highlight'> around anything you want to highlight in a block of text. For example, if you had 'foo bar foo baz' inside the context variable MYTEXT, you could do {{ MYTEXT|highlight:'foo' }}, and "<span class='highlight'>foo</span> bar <span class='highlight'>foo</span> baz" would be returned. …</p>
Freely redistributableTags & filters for rendering search results
2008-03-23T22:42:20.823044-05:00exogenhttps://djangosnippets.org/snippets/661/<p>Use these tags and filter when you're rolling your own search results. This is intended to be a whole templatetags module. I keep it in my apps as <code>templatetags/search.py</code>. These should not be used to perform search queries, but rather render the results.</p>
<h3>Basics</h3>
<p>There are three functions, each …</p>
Freely redistributable