My experience: I'm a 'user' not a 'developer' of sphinx. But I have
figured out how to crib my own extension to define new inline :role:'s with
color and font changes to work for both latex and html with all the visit &
depart latex and html functions.
Now I want to change the way a :term:`word` shows up inline, in particular
in latex, but html as well, because to me a term inline looks like all the
other cross references and doesn't easily direct people to the glossary
instead of someplace else. Will start with latex...
What I don't know is if there's some value I can key off of to just set a
latex preamble entry (but I don't think so) or if I have to extend the
latex writer.
Rooting around in sphinx/writers/latex.py class LaTeXTranslator method
visit_reference I find a comment in a chunk relating to hyperlinks
elif uri.startswith('%'):
# references to documents or labels inside documents
hashindex = uri.find('#')
if hashindex == -1:
# reference to the document
id = uri[1:] + '::doc'
else:
# reference to a label
id = uri[1:].replace('#', ':')
self.body.append(self.hyperlink(id))
self.body.append(r'\emph{')
if len(node) and hasattr(node[0], 'attributes') and \
'std-term' in node[0].get('classes', []):
# don't add a pageref for glossary terms
self.context.append('}}}')
else:
if self.builder.config.latex_show_pagerefs and not \
self.in_production_list:
self.context.append('}}} (%s)' % self.hyperpageref(id))
else:
self.context.append('}}}')
So, from what I'm seeing, this is where the :term: cross reference gets
added to the latex output. I believe I can't override method visit_glossary
(higher up in same class but does just 'pass') to change the \emph to
something else (say bold and textcolor purple or some such), but would have
to redo this entire visit_reference function instead.
Am I on the right track?
It seems that to allow customization, that the glossary text style should
be applied in its own method instead of being locked to what hyperlink uses.
Suggestions on how to do this customization?
Thanks.
--
You received this message because you are subscribed to the Google Groups
"sphinx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sphinx-users.
For more options, visit https://groups.google.com/d/optout.