Skip to main content

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
   ======== ======== ========== ======

You can see more examples here.

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)

Source distribution for rstspreadsheet 0.1.2
File Size Uploaded
rstspreadsheet-0.1.2.tar.gz 5.3 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for rstspreadsheet 0.1.2
File Interpreter ABI Platform
rstspreadsheet-0.1.2-py2.6.egg Legacy Egg format - - Details

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

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page