sphinx

how to set a custom config value for sphinx in conf.py? (e.g., for sphinx.ext.ifconfig)

匿名 (未验证) 提交于 2019-12-03 02:26:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: [I split the original question into two after more testing and research] I defined my own configuration value in conf.py and wrote a minimal extension to make it visible from rst files. in conf.py: sys.path.insert(0, os.path.abspath('.')) extensions = ['sphinx.ext.ifconfig', 'myExt'] testlevel = 2 in a local myExt.py: def setup(app): app.add_config_value('testlevel', '', True) This works just fine; test.rst includes: .. ifconfig:: testlevel == 2 Hurray, it seems to work According to the doc of sphinx.ext.ifconfig , it seems possible to call

Conditional toctree in Sphinx

匿名 (未验证) 提交于 2019-12-03 02:18:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I want to do multiple versions of a documentation, which differ in the sections that are included. To achieve this I would usually use either the only directive or the ifconfig extension. However, I cannot use any of those in combination with the toctree directive. What I basically want is something like this: .. toctree:: :maxdepth: 2 intro strings datatypes numeric .. only:: university complex Is there a way to do that? 回答1: As far as I know there is no way to do what you would like. I have been struggling with the same issue, see https:/

Override html page template for a specific sphinx document

匿名 (未验证) 提交于 2019-12-03 02:14:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm implementing a documentation using Sphinx ( https://github.com/fridge-project/dbal-docs ) & would like to override the html page of a specific document. My interest is to override all directory indexes to not only show a simple ul. I have read the Sphinx documentation but I don't find something interesting about my issue... Does someone know a workaround? 回答1: For the record, this solution is much more a hack than a solution but for now, I don't find something better... First, of all you need to understand my workaround is based on the

Is OptionParser in conflict with sphinx?

匿名 (未验证) 提交于 2019-12-03 02:13:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm trying to write a documentation for my project in sphinx and whenever sphinx encounters OptionParser in my module it gives me: sphinx-build: error: no such option: -b I thought that it's impossible, so I wrote a simple module to check this: from optparse import OptionParser """some comment here""" parser = OptionParser(conflict_handler='resolve') parser.add_option('', '--force', action='store_true', dest='force', default=False, help='gqdel will skip asking questions, and delete them all.'); parser.add_option('', '--verbose', action=

How to force Sphinx to use Python 3.x interpreter

匿名 (未验证) 提交于 2019-12-03 01:59:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I try to create documentation for a project written with Python 3.x. Sphinx is the tool I want to use and, according to the official site , its last version 1.1.2 is compatible with Python 3.1+ . My OS is Archlinux, a Linux distribution which uses Python 3.2+ as the default Python package. The installation and configuration is straight forward ( easy_install -U Sphinx then sphinx-quickinstall ) and I was never asked to choose between the 2.x or 3.x Python interpreter. But when I ask Sphinx to create the documentation of my project,

How to use Python to programmatically generate part of Sphinx documentation

匿名 (未验证) 提交于 2019-12-03 01:52:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am using Sphinx to generate the documentation for a project of mine. In this project, I describe a list of available commands in a yaml file which, once loaded, results in a dictionary in the form {command-name : command-description} for example: commands = {"copy" : "Copy the highlighted text in the clipboard", "paste" : "Paste the clipboard text to cursor location", ...} What I would like to know, is if there is a method in sphinx to load the yaml file during the make html cycle, translate the python dictionary in some reStructuredText

Creating LaTeX math macros within Sphinx

匿名 (未验证) 提交于 2019-12-03 01:47:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm writing some mathematical code in Python and using Sphinx to produce the documentation. I know that Sphinx can handle LaTeX code in Python docstrings; see http://sphinx.pocoo.org/latest/ext/math.html#module-sphinx.ext.mathbase . How can I create LaTeX macros, such as \newcommand{\cG}{\mathcal{G}} , to use in the Python docstrings? 回答1: If you are using MathJax, here's a possible solution. I'm still looking for a nicer solution, but it might help if you need a quick hack. Create a file under the directory specified in the html_static_path

How to enable math in sphinx?

匿名 (未验证) 提交于 2019-12-03 01:38:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I am using sphinx with the pngmath extension to document my code that has a lot of mathematical expressions. Doing that in a *.rst file is working just fine. a \times b becomes: However, if I try the same inside a *.py file for example in a module documentation like so: """ a \times b """ I end up with Furthermore no amsmath functionality seems to work, either. What do I need to do, to also have math formulas in my *.py documentations? 回答1: Try putting a lower case 'r' before your docstring - like this: def multiply ( a , b ): r ""

sphinx customization of latexpdf output?

匿名 (未验证) 提交于 2019-12-03 01:28:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Just curious if anyone knows how to customize the sphinx output when using the latexpdf target? I've seen lots of custom stuff for html output, but cant seem to find any example of custom pdf output. Specifically, I'd be interested in customizing the title page, headers, footers, and possibly adding a few pages of front matter before the contents. Has anyone seen any examples of this kind of customization, or do people pretty much just use the "stock" sphinx output when generating pdfs? Thanks! 回答1: Yes i think better or clearer

Thinking Sphinx and acts_as_taggable_on plugin

匿名 (未验证) 提交于 2019-12-03 01:12:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I installed Sphinx and Thinking Sphinx for ruby on rails 2.3.2. When I search without conditions search works ok. Now, what I'd like to do is filter by tags, so, as I'm using the acts_as_taggable_on plugin, my Announcement model looks like this: class Announcement :title, :sortable => true indexes description, :as => :description, :sortable => true indexes tags.name, :as => :tags indexes category.name, :as => :category has category(:id), :as => :category_ids has tags(:id), :as => :tag_ids end For some reason, when I run the following command