Package epydoc :: Package docwriter :: Module xlink :: Class UrlGenerator |
[hide private]
[frames] | no frames]

# Class UrlGenerator

source code

Generate URL from an object name.

Nested Classes | [hide private]
| IndexAmbiguous The name looked for is ambiguous

Instance Methods | [hide private]
`str` |
get_url(self, name) Look for a name and return the matching URL documentation. | source code
`tuple` of `str` |
get_canonical_name(self, name) Convert an object name into a canonical name. | source code

Class Variables | [hide private]
| _SEP_RE = `re.compile(r'`(?x)``(``[`a`-`zA`-`Z0`-`9_`]``+``)``|``(`\.`|`::`|`->`)``|``(`.`)`')`

Method Details | [hide private]

### get_url(self, name) | source code
Look for a name and return the matching URL documentation. First look for a fully qualified name. If not found, try with partial name. If no url exists for the given object, return `None`. Parameters: `name` (`str`) - the name to look for Returns: `str` the URL that can be used to reach the `name` documentation. `None` if no such URL exists. Raises: `IndexError` - no object found with `name` `DocUrlGenerator.IndexAmbiguous` - more than one object found with a non-fully qualified name; notice that this is an `IndexError` subclass

### get_canonical_name(self, name) | source code
Convert an object name into a canonical name. the canonical name of an object is a tuple of strings containing its name fragments, splitted on any allowed separator ('`.`', '`::`', '`->`'). Noise such parenthesis to indicate a function is discarded. Parameters: `name` (`str`) - an object name, such as `os.path.prefix()` or `lib::foo::bar` Returns: `tuple` of `str` the fully qualified name such `('os', 'path', 'prefix')` and `('lib', 'foo', 'bar')`