/usr/share/doc/python-sphinx-gallery-doc/html/_sources/tutorials/plot_parse.rst.txt is in python-sphinx-gallery-doc 0.1.13-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | .. _sphx_glr_tutorials_plot_parse.py:
The Header Docstring
====================
When writting latex in a Python string keep in mind to escape the backslashes
or use a raw docstring
.. math:: \sin (x)
Closing this string quotes on same line
Direct first comment
with second line
.. code-block:: python
import numpy as np
.. code-block:: python
A = 1
import matplotlib.pyplot as plt
There is no need to always alternate between code and comment blocks
Now there is free repetition of both
And a single line of hashes can split your blocks
Latex in the comments does not need to be escaped
.. math::
\sin
.. code-block:: python
def dummy():
"""This should not be part of a 'text' block'"""
######################################
# Comment inside code to remain here
pass
# this should not be part of a 'text' block
####################################################################
Making a line cut in sphinx
.. warning::
The next kind of comments are not supported and become to hard to escape
so just don't code like this.
.. code-block:: python
def dummy2():
"""Function docstring"""
####################################
# This comment inside python indentation
# breaks the block structure and is not
# supported
dummy2
.. code-block:: python
"""Free strings are not supported they remain part of the code"""
New lines can be included in you block comments and the parser
is capable of retaining this significant whitespace to work with sphinx
So the reStructuredText headers survive
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
.. code-block:: python
print('one')
.. rst-class:: sphx-glr-script-out
Out::
one
Code block separators
##############################################################################
Surrounding a comment line with lines of # like a block spliter also
works and creates a new header for that comment block
too. Nevertheless to get rich text formatting we advise to use
RestructuredText syntax in the comment blocks.
.. code-block:: python
print('two')
.. rst-class:: sphx-glr-script-out
Out::
two
.. code-block:: python
B = 1
End comments
That's all folks !
.. literalinclude:: plot_parse.py
**Total running time of the script:** ( 0 minutes 0.000 seconds)
.. only :: html
.. container:: sphx-glr-footer
.. container:: sphx-glr-download
:download:`Download Python source code: plot_parse.py <plot_parse.py>`
.. container:: sphx-glr-download
:download:`Download Jupyter notebook: plot_parse.ipynb <plot_parse.ipynb>`
.. only:: html
.. rst-class:: sphx-glr-signature
`Gallery generated by Sphinx-Gallery <https://sphinx-gallery.readthedocs.io>`_
|