djangosnippets.org: Latest snippets tagged with 'paragraph'https://djangosnippets.org/tags/paragraph/2011-06-10T13:24:21.983594-05:00filter for extracting a number of paragraphs from any HTML code
2011-06-10T13:24:21.983594-05:00rafadevhttps://djangosnippets.org/snippets/2462/<p>From: <a href="http://incredibletimes.org">incredible times</a></p>
<p>With inspiration from: <a href="http://unethicalblogger.com/2008/05/03/parsing-html-with-python.html">Unethical Blogger</a></p>
<p>This code parses any provided HTML content, and extracts a number of paragraphs specified, with all the content and tags inside them.</p>
<p>Example:
Template variable "content" contains:</p>
<pre><code><a href="#>some text</a>
<p><strong>Testing</strong>testing testing this is a tester's life</p>
<div>I wont see the world</div> …</code></pre>
Freely redistributableLine & paragraph chopping
2007-02-27T14:44:46.264262-06:00ludvig.ericsonhttps://djangosnippets.org/snippets/34/<p>I was faced with the fact that I wanted to post 2 paragraph-long summaries on one of my sites, and this is what I did (you could of course cut it down earlier, but I'd say this belongs to what is called "template logic")</p>
<p>Use like so:</p>
<pre><code>{% load myExtraModule …</code></pre>
Freely redistributable