parameters: (specFile, baseDir)
return_statement: return pages
docstring: Extract reference pages from a spec asciidoc source file.
  
      - specFile - filename to extract from
      - baseDir - output directory to generate page in
docstring_summary: Extract reference pages from a spec asciidoc source file.
docstring_tokens: Extract reference pages from a spec asciidoc source file .
function: def genRef(specFile, baseDir):
      """Extract reference pages from a spec asciidoc source file.
  
      - specFile - filename to extract from
      - baseDir - output directory to generate page in"""
      file = loadFile(specFile)
      if file is None:
          return
  
      # Save the path to this file for later use in rewriting relative includes
      specDir = os.path.dirname(os.path.abspath(specFile))
  
      pageMap = findRefs(file, specFile)
      logDiag(specFile + ': found', len(pageMap.keys()), 'potential pages')
  
      sys.stderr.flush()
  
      # Fix up references in pageMap
      fixupRefs(pageMap, specFile, file)
  
      # Create each page, if possible
      pages = {}
  
      for name in sorted(pageMap):
          pi = pageMap[name]
  
          # Only generate the page if it is in the requested build
          # 'freeform' pages are always generated
          # 'feature' pages (core versions & extensions) are generated if they are in
          # the requested feature list
          # All other pages (APIs) are generated if they are in the API map for
          # the build.
          if pi.type in refpage_api_types:
              if name not in api.typeCategory:
                  # Also check aliases of name - api.nonexistent is the same
                  # mapping used to rewrite *link: macros in this build.
                  if name not in api.nonexistent:
                      logWarn(f'genRef: NOT generating feature page {name} - API not in this build')
                      continue
                  else:
                      logWarn(f'genRef: generating feature page {name} because its alias {api.nonexistent[name]} exists')
          elif pi.type in refpage_other_types:
              # The only non-API type which can be checked is a feature refpage
              if pi.type == 'feature':
                  if name not in api.features:
                      logWarn(f'genRef: NOT generating feature page {name} - feature not in this build')
                      continue
  
          printPageInfo(pi, file)
  
          if pi.Warning:
              logDiag('genRef:', pi.name + ':', pi.Warning)
  
          if pi.extractPage:
              emitPage(baseDir, specDir, pi, file)
          elif pi.type == 'enums':
              autoGenEnumsPage(baseDir, pi, file)
          elif pi.type == 'flags':
              autoGenFlagsPage(baseDir, pi.name)
          else:
              # Do not extract this page
              logWarn('genRef: Cannot extract or autogenerate:', pi.name)
  
          pages[pi.name] = pi
          for alias in pi.alias.split():
              pages[alias] = pi
  
      return pages
function_tokens: def genRef ( specFile , baseDir ) : file = loadFile ( specFile ) if file is None : return # Save the path to this file for later use in rewriting relative includes specDir = os . path . dirname ( os . path . abspath ( specFile ) ) pageMap = findRefs ( file , specFile ) logDiag ( specFile + ': found' , len ( pageMap . keys ( ) ) , 'potential pages' ) sys . stderr . flush ( ) # Fix up references in pageMap fixupRefs ( pageMap , specFile , file ) # Create each page, if possible pages = { } for name in sorted ( pageMap ) : pi = pageMap [ name ] # Only generate the page if it is in the requested build # 'freeform' pages are always generated # 'feature' pages (core versions & extensions) are generated if they are in # the requested feature list # All other pages (APIs) are generated if they are in the API map for # the build. if pi . type in refpage_api_types : if name not in api . typeCategory : # Also check aliases of name - api.nonexistent is the same # mapping used to rewrite *link: macros in this build. if name not in api . nonexistent : logWarn ( f'genRef: NOT generating feature page {name} - API not in this build' ) continue else : logWarn ( f'genRef: generating feature page {name} because its alias {api.nonexistent[name]} exists' ) elif pi . type in refpage_other_types : # The only non-API type which can be checked is a feature refpage if pi . type == 'feature' : if name not in api . features : logWarn ( f'genRef: NOT generating feature page {name} - feature not in this build' ) continue printPageInfo ( pi , file ) if pi . Warning : logDiag ( 'genRef:' , pi . name + ':' , pi . Warning ) if pi . extractPage : emitPage ( baseDir , specDir , pi , file ) elif pi . type == 'enums' : autoGenEnumsPage ( baseDir , pi , file ) elif pi . type == 'flags' : autoGenFlagsPage ( baseDir , pi . name ) else : # Do not extract this page logWarn ( 'genRef: Cannot extract or autogenerate:' , pi . name ) pages [ pi . name ] = pi for alias in pi . alias . split ( ) : pages [ alias ] = pi return pages