Esempio n. 1
0
def _writeMacroDependenciesTable(theS, theEnv, theAdjList, theItu):
    """Writes all the macro dependencies to a rowspan/colspan HTML
    that references something.
    table with links to the position in the HTML representation of the file
    This uses a particular design pattern that uses a DictTree to sort out the
    rows and columns. In this case the DictTree values are lists of pairs
    (href, nav_text) where nav_text is the line_col of the referencing file."""
    myDt = DictTree.DictTreeHtmlTable('list')
    for branch in theAdjList.branches():
        # I might depend on a macro (that is referenced) but I am not referenced.
        if theEnv.macro(branch[-1]).refCount > 0:
            href = '%s#%s' % (
                _macroHistoryRefName(theItu),
                _retMacroId(theEnv.macro(branch[-1]), 0),
            )
        else:
            href = '%s#%s' % (
                _macroHistoryNorefName(theItu),
                _retMacroId(theEnv.macro(branch[-1]), 0),
            )
        # TODO: theIntOccurence is set 0 here
        myDt.add(branch, (
            href,
            branch[-1],
        ))
    # Now iterate with rowspan/colspan
    if len(myDt) > 0:
        HtmlUtils.writeDictTreeAsTable(theS,
                                       myDt,
                                       tableAttrs={'class': "filetable"},
                                       includeKeyTail=False)
Esempio n. 2
0
def _writeMacroDependenciesTable(theS, theEnv, theAdjList, theItu):
    """Writes all the macro dependencies to a rowspan/colspan HTML
    that references something.

    table with links to the position in the HTML representation of the file

    This uses a particular design pattern that uses a DictTree to sort out the
    rows and columns. In this case the DictTree values are lists of pairs
    ``(href, nav_text)`` where ``nav_text`` is the line_col of the referencing file.

    :param theS: HTML stream.
    :type theS: :py:class:`cpip.util.XmlWrite.XhtmlStream`

    :param theEnv: The macro environment.
    :type theEnv: :py:class:`cpip.core.MacroEnv.MacroEnv`

    :param theAdjList: Dependency adjacency list.
    :type theAdjList: :py:class:`cpip.util.Tree.Tree`

    :param theItu: The Initial Translation Unit (ITU).
    :type theItu: ``str``

    :returns: ``NoneType``
    """
    myDt = DictTree.DictTreeHtmlTable('list')
    for branch in theAdjList.branches():
        # I might depend on a macro (that is referenced) but I am not referenced.
        if theEnv.macro(branch[-1]).refCount > 0:
            href = '%s#%s' % (
                _macroHistoryRefName(theItu),
                _retMacroId(theEnv.macro(branch[-1]), 0),
            )
        else:
            href = '%s#%s' % (
                _macroHistoryNorefName(theItu),
                _retMacroId(theEnv.macro(branch[-1]), 0),
            )
        # TODO: theIntOccurence is set 0 here
        myDt.add(branch, (
            href,
            branch[-1],
        ))
    # Now iterate with rowspan/colspan
    if len(myDt) > 0:
        HtmlUtils.writeDictTreeAsTable(theS,
                                       myDt,
                                       tableAttrs={'class': "filetable"},
                                       includeKeyTail=False)