restructuredtext

Extending rst container to output extra div attributes

风流意气都作罢 提交于 2019-12-07 04:47:11
问题 I'm starting to use pelican with reStructuredText rst page format. I have custom javascript (jQuery) things that I'd like to control with div attributes like data-default-tpl="basename" with nested content. What to extend and what. I've looked at Directives and nodes , but I just can't wrap my head around how to do it. .. rstdiv:: class1 class2 :name: namessid :extra: thisIsMyextra .. rstdiv:: nested class3 :name: nestedid :extra: data-default-tpl="basename" some text .. container:: This is

How to fix column width in reStructuredText tables?

一世执手 提交于 2019-12-07 01:45:00
问题 I am using Sphinx to create this table: +---------------+---------------------+---------------------------+-------------------------------------+---------------------+ | Stakeholder | Major Value | Attitudes | Constraints | Major Interests | +===============+=====================+===========================+=====================================+=====================+ | Manager | Reduce data entry. | Strong commitment through | Cost, time and the required skill to| Google apps | | | Improve ft

Duplicate index warning on sphinx build; How do I include a file without indexing its contents?

与世无争的帅哥 提交于 2019-12-07 01:43:46
问题 I wish to create an single_html.rst file that contains all my class / method / attribute /etc... , but also split categorised symbols into seperate pages. e.g. single_html.rst .. single html .. include:: foo.rst .. include:: bar.rst bar.rst .. autoclass:: my.mod.Bar :members: foo.rst .. autoclass:: my.mod.Foo :members: This throws multiple duplicate object description errors: /path/to/project/my/mod.py:docstring of my.module.Bar:0: WARNING: duplicate object description of my.mod.Bar, other

python rtype docstring/restructured text for class factories/selectors

末鹿安然 提交于 2019-12-06 19:50:29
问题 :rtype: specifies that this is type of returned object Therefore, when I create object obj in following snippet I receive warning from IDE, that cls is not callable , since IDE expects, that cls is object of type SomeAbstractClass , and I want SomeAbstractClass itself IDE is right, since this is default behaviour. But how can I specify, that I am returning class, not instance of class? Specifying type instead of SomeAbstractClass helps a bit, but not a solution, since no further introspection

In reStructuredText, how to put an inline literal inside of a hyperlink?

谁说胖子不能爱 提交于 2019-12-06 18:50:10
问题 In my reStructuredText document, I have a section defined like so: Update the ``PATH`` Environment Variable ---------------------------------------- I would like to link to this section like so: * `Update the ``PATH`` Environment Variable`_ But, when this code is rendered to HTML, it comes out looking like this: Update the ``PATH` Environment Variable` I'd really like the environment variable PATH to appear in the literal style, but I am pretty new to this. Can anyone help me out? 回答1: With a

Extracting blocks of text from ReST documents by :ref:?

蹲街弑〆低调 提交于 2019-12-06 16:40:59
I have some reStructuredText documentation. I would like to use snippets from it in online help. It seems like one approach would be to 'snip' out pieces of markup by reference, e.g. .. _my_boring_section: Introductory prose ------------------ blah blah blah .. _my_interesting_section: About this dialog ----------------- talk about stuff which is relevant in contextual help How could I use python/docutils/sphinx to extract the markup for the _my_interesting_section marker? Chris I'm not sure how you could do this other than subclassing and customising the Docutils parser. If you just need the

How to create a custom HTML div in Sphinx that isn't automatically nested within a subsubsection?

被刻印的时光 ゝ 提交于 2019-12-06 09:02:17
I'm using the wonderful Sphinx tool to create some documentation and I need to create a custom HTML div so that I can style it apart from Sphinx's other, automatically-created, divs. This is possible to do using the container directive , but the problem is that if I use this directive below a subsubsection, it automatically nests the div created with the container directive within the subsubsection, like so: <div id="automatically-created sphinx subsubsection"> ... <div id="my custom container"></div> </div> Whereas, I want: <div id="automatically-created sphinx subsubsection"> ... </div> <div

reST: inline links with arbitrary titles?

心不动则不痛 提交于 2019-12-06 08:03:03
问题 If I've defined an internal hyperlink target, how can I link to it using arbitrary text as the link title? For example: _`This is a very long internal link target`. ... A `short reference`_ to the very long link target. How could I make the “short reference” target the “very long internal target”? Edit : Another example: Widgets ======= ... Use a `widget`_. How can I make “widget” (singular) link to the “Widgets” (plural) heading? (of course, I realize that this could be done using `widget`_

Adding background color of notes to Sphinx-generated PDF files?

試著忘記壹切 提交于 2019-12-06 04:30:43
问题 I am able to generate notes using the Sphinx directive .. notes:: . However, the notes in html file have a background color while those from the generated PDF don’t. How can I add color to Sphinx-generated PDF files? 回答1: You can add something like this in your conf.py file (see the doc for the options for the LaTeX output): latex_custom = r''' \definecolor{Admonition}{RGB}{221,233,239} \makeatletter \newenvironment{admonitionbox}{ \begin{lrbox}{\@tempboxa}\begin{minipage}{\columnwidth} }{

Use ReStructuredText for pretty source code listing

眉间皱痕 提交于 2019-12-05 18:33:44
As is asked and answered in this post , one can use SyntaxHighlighter for pretty code listing. With ReStructuredText, I can use raw directive as follows. .. raw:: html <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js"></script> <script type="text/javascript" src="http://alexgorbatchev.com/pub/sh/current/scripts/shBrushJScript.js"></script> <link type="text/css" rel="stylesheet" href="http://alexgorbatchev.com/pub/sh/current/styles/shCoreDefault.css"/> <script type="text/javascript">SyntaxHighlighter.all();</script> I could use `SyntaxHighlighter