def transcribe_docs(infp, outfp, source_filename):
    """Transcribe documentation lines from *infp* to *outfp*.

    Only lines between matched pairs of triple-star comments ('***') are
    copied.

    Returns True if any lines were encountered; otherwise False.

    """
    # State: None = no blocks encountered; True = in a block; False = outside
    on = None

    note = ('.. note:: This page is generated from inline documentation in '
            '``{}``.\n\n').format(source_filename)

    for line in infp:
        if line.lstrip().startswith('***'):
            # Located a block divider
            if on:
                # Just finished a block, add a new line to the output
                outfp.write('\n')
            # Toggle between inside/outside of doc block
            on = not on
            # Write the header notice
            if note:
                outfp.write(note)
                note = None
        elif on:
            # Strip leftmost '* ' from the line
            base = "*".join(line.split('*')[1:])[1:]
            # Get rid of windows carriage return
            base = base.rstrip()
            outfp.write('{}\n'.format(base))

    return on is not None