Spreadsheet directive for reStructuredText
rstSpreadsheet provides the spreadsheet directive for reStructuredText. You can use it from Docutils or Sphinx. Any python function/module can be used to calculate the cell value. Please see the documentation and examples
Install
pip install rstspreadsheet # or easy_install rstspreadsheet
Usage
Use as a standalone program:
python -m rstspreadsheet sample.rst sample.html
Or use as a sphinx extension by adding it to extensions:
extensions = [
# other extensions...
'rstspreadsheet']
Examples
Simple spreadsheet
You can do this simple calculation:
p |
q |
p and q |
not (p and q) |
|---|---|---|---|
0 |
0 |
0 |
1 |
1 |
0 |
0 |
1 |
0 |
1 |
0 |
1 |
1 |
1 |
1 |
0 |
with this simple code:
.. spreadsheet::
:eq: {2} = {0} and {1}
{3} = int(not {2})
=== === ========= ===============
p q p and q not (p and q)
=== === ========= ===============
0 0
1 0
0 1
1 1
=== === ========= ===============
Spreadsheet with python functions
If you want to calculate some complicated math functions like this:
function |
argument |
expression |
result |
|---|---|---|---|
fac |
5 |
fac(5) |
120.00 |
sin |
pi |
sin(pi) |
0.00 |
cos |
pi |
cos(pi) |
-1.00 |
exp |
1 |
exp(1) |
2.72 |
use python module/function!:
.. spreadsheet::
:eq: {2} = '{0}({1})'
{3} = {2}
:setup: from math import sin, cos, exp, pi
def fac(n):
return fac(n-1) * n if n > 1 else 1
:format: 3:'%0.2f'
======== ======== ========== ======
function argument expression result
======== ======== ========== ======
fac 5
sin pi
cos pi
exp 1
======== ======== ========== ======
Metadata
Release files for rstspreadsheet 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rstspreadsheet-0.1.2.tar.gz | 5.3 kB | Without provenance | Details for rstspreadsheet-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rstspreadsheet-0.1.2-py2.6.egg | Legacy Egg format | - | - | Details for rstspreadsheet-0.1.2-py2.6.egg |
Total release size: 17.1 kB
Release files / rstspreadsheet-0.1.2.tar.gz
| Download URL | rstspreadsheet-0.1.2.tar.gz |
|---|---|
| Size | 5.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
a9b2ff582af9b72d6bfcd3d60ce1da619044bdece290f51ae2b8e3a297f9f590
|
|
BLAKE2b-256 checksum How to use checksums |
d6a707d06a6b5e4c5abbd20f7c51522352ef3d53f2f3a504156c887d1211ec79
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / rstspreadsheet-0.1.2-py2.6.egg
| Download URL | rstspreadsheet-0.1.2-py2.6.egg |
|---|---|
| Size | 11.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
ea412a028ccba0f8befd18a32411e5f1cf03326e189799ca18069b24bcf69a89
|
|
BLAKE2b-256 checksum How to use checksums |
d4bed0c0692671f49cad6d436fc9f82f7647c9506675c888782eedf27cf51419
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for rstspreadsheet 0.1.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.