Top Description Fields Constructors Methods
org.python.indexer.demos

pack-priv Class Linker

extends Object
Class Inheritance
Imports
org.python.indexer.Def, .Ref, .Indexer, .NBinding, .StyleRun, .Util, org.python.indexer.types.NModuleType, java.io.File, java.util.ArrayList, .List, .HashMap, .Map, java.util.regex.Matcher, .Pattern

Collects per-file hyperlinks, as well as styles that require the symbol table to resolve properly.

Field Summary

Modifier and TypeField and Description
private static final Pattern
private Map<String, List<StyleRun>>
private File
private String

Constructor Summary

AccessConstructor and Description
public
Linker(String
the root of the directory tree being indexed
root
,
File
the html output directory
outdir
)

Constructor.

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
addSemanticStyles(NBinding
the binding's main definition node
nb
)

Add additional highlighting styles based on information not evident from the AST.

public List<StyleRun>

Returns:

a possibly-empty list of styles for that path
getStyles
(String
an absolute source path
path
)

Returns the styles (links and extra styles) generated for a given file.

private void
processDefs(NBinding nb)

Create name anchors for definition sites.

pack-priv void
processRef(Ref ref, NBinding nb)

Adds a hyperlink for a single reference.

private void
processRefs(NBinding nb)

Collect cross-reference links for every file.

private List<StyleRun>
private String
toModuleUrl(NBinding nb)

Generate an anchorless URL linking to another file in the index.

private String
toURL(NBinding
the referenced binding
nb
,
String
the path containing the reference, or null if there was an error
path
)

Generate a URL for a reference to a binding.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CONSTANTback to summary
private static final Pattern CONSTANT
fileStylesback to summary
private Map<String, List<StyleRun>> fileStyles
outDirback to summary
private File outDir
rootPathback to summary
private String rootPath

Constructor Detail

Linkerback to summary
public Linker(String root, File outdir)

Constructor.

Parameters
root:String

the root of the directory tree being indexed

outdir:File

the html output directory

Method Detail

addFileStyleback to summary
private void addFileStyle(String path, StyleRun style)
addSemanticStyleback to summary
private void addSemanticStyle(Def def, StyleRun.Type type)
addSemanticStylesback to summary
private void addSemanticStyles(NBinding nb)

Add additional highlighting styles based on information not evident from the AST.

Parameters
nb:NBinding

the binding's main definition node

getStylesback to summary
public List<StyleRun> getStyles(String path)

Returns the styles (links and extra styles) generated for a given file.

Parameters
path:String

an absolute source path

Returns:List<StyleRun>

a possibly-empty list of styles for that path

processDefsback to summary
private void processDefs(NBinding nb)

Create name anchors for definition sites.

processRefback to summary
pack-priv void processRef(Ref ref, NBinding nb)

Adds a hyperlink for a single reference.

processRefsback to summary
private void processRefs(NBinding nb)

Collect cross-reference links for every file.

stylesForFileback to summary
private List<StyleRun> stylesForFile(String path)
toModuleUrlback to summary
private String toModuleUrl(NBinding nb)

Generate an anchorless URL linking to another file in the index.

toURLback to summary
private String toURL(NBinding nb, String path)

Generate a URL for a reference to a binding.

Parameters
nb:NBinding

the referenced binding

path:String

the path containing the reference, or null if there was an error