Add: Gemini Support

This commit is contained in:
Kujiu 2021-01-31 00:41:56 +01:00
parent 95e318097f
commit 1ff5dbc445
Signed by: kujiu
GPG key ID: ABBB2CAC6855599F
3 changed files with 22 additions and 2 deletions

View file

@ -2,6 +2,11 @@
Changes Changes
======= =======
0.1.4 (*2020-01-31*)
====================
- Add support for Gemini nodes
0.1.3 (*2020-07-31*) 0.1.3 (*2020-07-31*)
==================== ====================

View file

@ -5,7 +5,7 @@ with open("README.rst", "r") as fh:
setup( setup(
name="sphinx_fasvg", name="sphinx_fasvg",
version="0.1.3", version="0.1.4",
url="https://procrastinator.nerv-project.eu/nerv-project/sphinx_fasvg", url="https://procrastinator.nerv-project.eu/nerv-project/sphinx_fasvg",
license="EUPL 1.2", license="EUPL 1.2",
author="Kujiu", author="Kujiu",

View file

@ -19,7 +19,7 @@ from sphinx.writers.text import TextTranslator
from sphinx.writers.manpage import ManualPageTranslator from sphinx.writers.manpage import ManualPageTranslator
from sphinx.util.osutil import relative_uri from sphinx.util.osutil import relative_uri
__version_info__ = (0, 1, 3) __version_info__ = (0, 1, 4)
__version__ = '.'.join([str(val) for val in __version_info__]) __version__ = '.'.join([str(val) for val in __version_info__])
@ -90,6 +90,12 @@ def text_visit_fa(self: TextTranslator, node: fa) -> None:
raise nodes.SkipNode raise nodes.SkipNode
def gemini_visit_fa(self, node: fa) -> None:
if 'alt' in node.attributes:
self.add_text('[%s]' % node['alt'])
raise nodes.SkipNode
def man_visit_fa(self: ManualPageTranslator, node: fa) -> None: def man_visit_fa(self: ManualPageTranslator, node: fa) -> None:
if 'alt' in node.attributes: if 'alt' in node.attributes:
self.body.append('[%s]' % node['alt']) self.body.append('[%s]' % node['alt'])
@ -149,6 +155,13 @@ def text_visit_falink(self: TextTranslator, node: fa) -> None:
raise nodes.SkipNode raise nodes.SkipNode
def gemini_visit_falink(self, node: fa) -> None:
self.end_block()
self.add_text('=> %s %s' % (node['url'], node['text']))
self.end_block()
raise nodes.SkipNode
def man_visit_falink(self: ManualPageTranslator, node: fa) -> None: def man_visit_falink(self: ManualPageTranslator, node: fa) -> None:
self.body.append('%s <%s>' % (node['text'], node['url'])) self.body.append('%s <%s>' % (node['text'], node['url']))
raise nodes.SkipNode raise nodes.SkipNode
@ -233,6 +246,7 @@ def setup(app):
texinfo=(texinfo_visit_fa, None), texinfo=(texinfo_visit_fa, None),
text=(text_visit_fa, None), text=(text_visit_fa, None),
man=(man_visit_fa, None), man=(man_visit_fa, None),
gemini=(gemini_visit_fa, None),
) )
app.add_node( app.add_node(
falink, falink,
@ -242,6 +256,7 @@ def setup(app):
texinfo=(texinfo_visit_falink, None), texinfo=(texinfo_visit_falink, None),
text=(text_visit_falink, None), text=(text_visit_falink, None),
man=(man_visit_falink, None), man=(man_visit_falink, None),
gemini=(gemini_visit_falink, None),
) )
app.add_config_value('fa_brands_path', 'fa/brands.svg', True) app.add_config_value('fa_brands_path', 'fa/brands.svg', True)
app.add_config_value('fa_regular_path', 'fa/regular.svg', True) app.add_config_value('fa_regular_path', 'fa/regular.svg', True)