(baseDir, specDir, pi, file)
Extract a single reference page into baseDir.

    - baseDir - base directory to emit page into
    - specDir - directory extracted page source came from
    - pi - pageInfo for this page relative to file
    - file - list of strings making up the file, indexed by pi
Extract a single reference page into baseDir.
Extract a single reference page into baseDir .
def emitPage(baseDir, specDir, pi, file):
    """Extract a single reference page into baseDir.

    - baseDir - base directory to emit page into
    - specDir - directory extracted page source came from
    - pi - pageInfo for this page relative to file
    - file - list of strings making up the file, indexed by pi"""
    pageName = baseDir + '/' + pi.name + '.txt'

    # Add a dictionary entry for this page
    global genDict
    genDict[pi.name] = None
    logDiag('emitPage:', pageName)

    # Short description
    if pi.desc is None:
        pi.desc = '(no short description available)'

    # Member/parameter section label and text, if there is one
    field = None
    fieldText = None

    if pi.type != 'freeform' and pi.type != 'spirv':
        if pi.include is None:
            # Not sure how this happens yet
            logWarn('emitPage:', pageName, 'INCLUDE is None, no page generated')
            return

        # Specification text
        lines = remapIncludes(file[pi.begin:pi.include + 1], baseDir, specDir)
        specText = ''.join(lines)

        if pi.param is not None:
            if pi.type == 'structs':
                field = 'Members'
            elif pi.type in ['protos', 'funcpointers']:
                field = 'Parameters'
            else:
                logWarn('emitPage: unknown field type:', pi.type,
                        'for', pi.name)
            lines = remapIncludes(file[pi.param:pi.body], baseDir, specDir)
            fieldText = ''.join(lines)

        # Description text
        if pi.body != pi.include:
            lines = remapIncludes(file[pi.body:pi.end + 1], baseDir, specDir)
            descText = ''.join(lines)
        else:
            descText = None
            logWarn('emitPage: INCLUDE == BODY, so description will be empty for', pi.name)
            if pi.begin != pi.include:
                logWarn('emitPage: Note: BEGIN != INCLUDE, so the description might be incorrectly located before the API include!')
    else:
        specText = None
        descText = ''.join(file[pi.begin:pi.end + 1])

    # Rewrite asciidoctor xrefs to resolve properly in refpages
    specURL = conventions.specURL(pi.spec)

    specText = xrefRewrite(specText, specURL)
    fieldText = xrefRewrite(fieldText, specURL)
    descText = xrefRewrite(descText, specURL)

    fp = open(pageName, 'w', encoding='utf-8')
    refPageHead(pi.name,
                pi.desc,
                specText,
                field, fieldText,
                descText,
                fp)
    refPageTail(pageName=pi.name,
                specType=pi.spec,
                specAnchor=pi.anchor,
                seeAlso=seeAlsoList(pi.name, pi.refs, pi.alias.split()),
                fp=fp,
                auto=False)
    fp.close()
def emitPage ( baseDir , specDir , pi , file ) : pageName = baseDir + '/' + pi . name + '.txt' # Add a dictionary entry for this page global genDict genDict [ pi . name ] = None logDiag ( 'emitPage:' , pageName ) # Short description if pi . desc is None : pi . desc = '(no short description available)' # Member/parameter section label and text, if there is one field = None fieldText = None if pi . type != 'freeform' and pi . type != 'spirv' : if pi . include is None : # Not sure how this happens yet logWarn ( 'emitPage:' , pageName , 'INCLUDE is None, no page generated' ) return # Specification text lines = remapIncludes ( file [ pi . begin : pi . include + 1 ] , baseDir , specDir ) specText = '' . join ( lines ) if pi . param is not None : if pi . type == 'structs' : field = 'Members' elif pi . type in [ 'protos' , 'funcpointers' ] : field = 'Parameters' else : logWarn ( 'emitPage: unknown field type:' , pi . type , 'for' , pi . name ) lines = remapIncludes ( file [ pi . param : pi . body ] , baseDir , specDir ) fieldText = '' . join ( lines ) # Description text if pi . body != pi . include : lines = remapIncludes ( file [ pi . body : pi . end + 1 ] , baseDir , specDir ) descText = '' . join ( lines ) else : descText = None logWarn ( 'emitPage: INCLUDE == BODY, so description will be empty for' , pi . name ) if pi . begin != pi . include : logWarn ( 'emitPage: Note: BEGIN != INCLUDE, so the description might be incorrectly located before the API include!' ) else : specText = None descText = '' . join ( file [ pi . begin : pi . end + 1 ] ) # Rewrite asciidoctor xrefs to resolve properly in refpages specURL = conventions . specURL ( pi . spec ) specText = xrefRewrite ( specText , specURL ) fieldText = xrefRewrite ( fieldText , specURL ) descText = xrefRewrite ( descText , specURL ) fp = open ( pageName , 'w' , encoding = 'utf-8' ) refPageHead ( pi . name , pi . desc , specText , field , fieldText , descText , fp ) refPageTail ( pageName = pi . name , specType = pi . spec , specAnchor = pi . anchor , seeAlso = seeAlsoList ( pi . name , pi . refs , pi . alias . split ( ) ) , fp = fp , auto = False ) fp . close ( )