def htmlDoc(start, end, docNo):
    'Returns an HTML document containing fragments[start:end].  docNo is used to generate previous/next page links as appropriate.  Caches its return value in case called again with same start,end (in which case docNo is ignored on second call).'
    global __lastStartEnd, __lastDoc
    if (not ((start, end) == __lastStartEnd)):
        __lastStartEnd = (start, end)
        __lastDoc = (header + js_hashjump((x for (x, y) in fragments[start:end] if x)))
        if start:
            assert docNo, 'Document 0 should start at 0'
            __lastDoc += ('<p><a name="_h" href="%d.html#_f">Previous page</a></p>' % ((docNo - 1),))
        __lastDoc += ''.join(((tag(x) + y) for (x, y) in fragments[start:end]))
        if (end < len(fragments)):
            __lastDoc += ('<p><a name="_f" href="%d.html#_h">Next page</a></p>' % ((docNo + 1),))
        __lastDoc += footer
    return linkSub(__lastDoc)
Returns an HTML document containing fragments[start:end].  docNo is used to generate previous/next page links as appropriate.  Caches its return value in case called again with same start,end (in which case docNo is ignored on second call).
def htmlDoc(start, end, docNo):
    
    global __lastStartEnd, __lastDoc
    if (not ((start, end) == __lastStartEnd)):
        __lastStartEnd = (start, end)
        __lastDoc = (header + js_hashjump((x for (x, y) in fragments[start:end] if x)))
        if start:
            assert docNo, 'Document 0 should start at 0'
            __lastDoc += ('<p><a name="_h" href="%d.html#_f">Previous page</a></p>' % ((docNo - 1),))
        __lastDoc += .join(((tag(x) + y) for (x, y) in fragments[start:end]))
        if (end < len(fragments)):
            __lastDoc += ('<p><a name="_f" href="%d.html#_h">Next page</a></p>' % ((docNo + 1),))
        __lastDoc += footer
    return linkSub(__lastDoc)