Move to Poetry
This commit is contained in:
19
gergelypolonkaieu_site/plugins/custom_roles.py
Normal file
19
gergelypolonkaieu_site/plugins/custom_roles.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from docutils import nodes
|
||||
from docutils.parsers import rst
|
||||
|
||||
|
||||
def keyboard_role(name, rawtext, text, lineno, inliner, options=None, content=None):
|
||||
return [nodes.raw('', f'<kbd>{text}</kbd>', format='html')], []
|
||||
|
||||
|
||||
def superscript_role(name, rawtext, text, lineno, inliner, options=None, content=None):
|
||||
return [nodes.raw('', f'<sup>{text}</sup>', format='html')], []
|
||||
|
||||
|
||||
def register_roles():
|
||||
rst.roles.register_local_role('kbd', keyboard_role)
|
||||
rst.roles.register_local_role('sup', superscript_role)
|
||||
|
||||
|
||||
def register():
|
||||
register_roles()
|
Reference in New Issue
Block a user