[sphinx-users] Re: Is there any way to format an index entry in monospace?
Hi, Please use stylesheet to change the looks of HTMLs. Thanks, Takeshi KOMIYA 2016年9月3日土曜日 7時58分56秒 UTC+9 Jason S: > > I want to format certain index entries in monospace, because they are > program identifiers (instead of index terms). > > How can I do this? > -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
[sphinx-users] Re: Numbered start/offset for multiple toctrees?
Hi, You can give section number to :numbered: option of toctree directive. .. toctree:: :caption: Part I :numbered: 1 foo bar .. toctree:: :caption: Part II :numbered: 1 baz qux But unfortunately, this feature is imcomplete. This effects to only HTML builder. Other builders does not refer this. And figure number is not reseted on second Section.1 To my knowledge, there are no enough solution to assign same section number in same document. Thanks, Takeshi KOMIYA 2016年9月7日水曜日 7時32分36秒 UTC+9 geek...@mgmiller.net: > > Hi, > > Haven't been able to find a solution to this problem, can anyone help? I > have a book with three parts and am using multiple numbered toctrees to > implement it, e.g.: > > .. toctree:: > :caption: Part I > :maxdepth: 1 > :numbered: > > chA > chB > ... > > .. toctree:: > :caption: Part II > :maxdepth: 1 > :numbered: > > chC > chD > ... > > > A caption is set on each toctree to separate and label the Parts of the > book on the front page. While the first Part is numbered as expected, the > rest aren't. I would like the chapters of the subsequent toctrees to start > at the next number available, but instead they restart at 1. In other > words, the entry at chC will be numbered as 1. instead of perhaps 5, 10, or > 20. > > I also have numbered figures throughout. I've also tried changing the > chapter numbers with the sectnum directive, and it works if you disable > toctree numbering, however it then breaks my numbered figures---they lose > their chapter numbers, e.g. resets to "Fig. 1" instead of "Fig 10.1". > > (It seemed like this worked before, but I've not been able to get it to > work recently. Might have been my imagination?) > > Is there a better way to do this? Can I subclass the toctree to make a > small modification on the start number/offset? Not sure where to find the > code that handles it, as it doesn't seem to be in the directive files. > > Thanks in advance, > -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
[sphinx-users] Re: Role functions have an inliner, how do I get it from within a Directive?
Hi, You can use self.state.nested_parse() instead at Directive.run(). Thanks, Takeshi KOMIYA 2016年9月7日水曜日 3時45分06秒 UTC+9 Jason S: > > Custom role functions have an inliner: > > def myrole(role, rawtext, text, lineno, inliner, options={}, content=[]): > > ... > > > But what about a custom Directive? How can I get the inliner from within the > run() function? I need to call inliner.nested_parse(). > > > -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
[sphinx-users] Numbered start/offset for multiple toctrees?
Hi, Haven't been able to find a solution to this problem, can anyone help? I have a book with three parts and am using multiple numbered toctrees to implement it, e.g.: .. toctree:: :caption: Part I :maxdepth: 1 :numbered: chA chB ... .. toctree:: :caption: Part II :maxdepth: 1 :numbered: chC chD ... A caption is set on each toctree to separate and label the Parts of the book on the front page. While the first Part is numbered as expected, the rest aren't. I would like the chapters of the subsequent toctrees to start at the next number available, but instead they restart at 1. In other words, the entry at chC will be numbered as 1. instead of perhaps 5, 10, or 20. I also have numbered figures throughout. I've also tried changing the chapter numbers with the sectnum directive, and it works if you disable toctree numbering, however it then breaks my numbered figures---they lose their chapter numbers, e.g. resets to "Fig. 1" instead of "Fig 10.1". (It seemed like this worked before, but I've not been able to get it to work recently. Might have been my imagination?) Is there a better way to do this? Can I subclass the toctree to make a small modification on the start number/offset? Not sure where to find the code that handles it, as it doesn't seem to be in the directive files. Thanks in advance, -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
[sphinx-users] Re: Role functions have an inliner, how do I get it from within a Directive?
import sphinx from docutils import nodes from docutils.parsers.rst import Directive from docutils.parsers.rst import directives from docutils.statemachine import ViewList class CustomDirective(Directive): has_content = True required_arguments = 1 option_spec = { } app = None def run(self): node = nodes.Element() node.document = self.state.document env = self.state.document.settings.env docname = env.docname new_content='\n'.join(self.content) sphinx.util.nodes.nested_parse_with_titles(self.state, ViewList(new_content. splitlines(), source=docname), node) return node.children I think the above is about the smallest example possible. It will take the content of the directive and render it as reST. --Peter On Tuesday, September 6, 2016 at 11:45:06 AM UTC-7, Jason S wrote: > > Custom role functions have an inliner: > > def myrole(role, rawtext, text, lineno, inliner, options={}, content=[]): > > ... > > > But what about a custom Directive? How can I get the inliner from within the > run() function? I need to call inliner.nested_parse(). > > > -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.
[sphinx-users] Role functions have an inliner, how do I get it from within a Directive?
Custom role functions have an inliner: def myrole(role, rawtext, text, lineno, inliner, options={}, content=[]): ... But what about a custom Directive? How can I get the inliner from within the run() function? I need to call inliner.nested_parse(). -- 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 sphinx-users+unsubscr...@googlegroups.com. To post to this group, send email to sphinx-users@googlegroups.com. Visit this group at https://groups.google.com/group/sphinx-users. For more options, visit https://groups.google.com/d/optout.