varst.utils.substitution module#
- class varst.utils.substitution.Substitution(rst_file: RstFile)#
Bases:
object
- find(text: str) str #
Find substitution definition by substitution text.
- Parameters:
text – The string value of substitution text.
- Returns:
Returns substitution definition if it exists.
- Raises:
KeyError – If substitution definition is not in file.
- update(text: str, data: str) None #
Update substitution definition by using substitution text and data.
- Parameters:
text – The string value of substitution text.
data – The string value of substitution data.
- varst.utils.substitution.directive_type(substitution: str) str #
Get directive type from substitution definition.
- Parameters:
substitution – The string value of substitution definition.
- Returns:
Returns directive type.
- Raises:
ValueError – If directive type is not valid.
- varst.utils.substitution.substitution_def(text: str, data: str, directive: str = 'replace') str #
Create substitution definition by using substitution text and data.
- Parameters:
text – The string value of substitution text.
data – The string value of substitution data.
directive – The string value of directive type.
- Returns:
Returns substitution definition.