docs: def generate_lorem_ipsum(n=5, html=True, min=20, max=100):
      """Generate some lorem impsum for the template."""
      from jinja2.constants import LOREM_IPSUM_WORDS
      from random import choice, randrange
      words = LOREM_IPSUM_WORDS.split()
      result = []
  
      for _ in xrange(n):
          next_capitalized = True
          last_comma = last_fullstop = 0
          word = None
          last = None
          p = []
  
          # each paragraph contains out of 20 to 100 words.
          for idx, _ in enumerate(xrange(randrange(min, max))):
              while True:
                  word = choice(words)
                  if word != last:
                      last = word
                      break
              if next_capitalized:
                  word = word.capitalize()
                  next_capitalized = False
              # add commas
              if idx - randrange(3, 8) > last_comma:
                  last_comma = idx
                  last_fullstop += 2
                  word += ','
              # add end of sentences
              if idx - randrange(10, 20) > last_fullstop:
                  last_comma = last_fullstop = idx
                  word += '.'
                  next_capitalized = True
              p.append(word)
  
          # ensure that the paragraph ends with a dot.
          p = u' '.join(p)
          if p.endswith(','):
              p = p[:-1] + '.'
          elif not p.endswith('.'):
              p += '.'
          result.append(p)
  
      if not html:
          return u'\n\n'.join(result)
      return Markup(u'\n'.join(u'<p>%s</p>' % escape(x) for x in result))