..spreadsheet:: Spreadsheet with python functions
: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
======== ======== ========== ======
..spreadsheet:: Use of the special variables
:eq:{1} = i
{2} = last
{3} = i == last
{4} = sum(col.int) + 1
{5} = cols[0].int
== == ====== =========== ================== =============
# i last i == last sum(col.int) + 1 cols[0].int
== == ====== =========== ================== =============
0
1
2
3
== == ====== =========== ================== =============
..spreadsheet:::eq:{1} = {0}:setup:this is error!
== ==
i j
== ==
0
1
2
== ==
i
j
0
1
2
System Message: ERROR/3 (/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/doc/sample.rst, line 2)
An error occurs while executing `:setup:`
Traceback (most recent call last):
File "/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/rstspreadsheet.py", line 314, in wrapper
result = func(*args, **kwds)
File "/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/rstspreadsheet.py", line 351, in _get_scope
exec code in scope
File "<string>", line 1
this is error!
^
SyntaxError: unexpected EOF while parsing
..spreadsheet:::eq:{1} = this is error!
{1:this is error, too} = 1
== ==
i j
== ==
0
== ==
i
j
0
System Message: ERROR/3 (/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/doc/sample.rst, line 2)
Following error occurs while validating the equation of the cell in 0-th row, 1-th col: ‘this is error!’
Traceback (most recent call last):
File "/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/rstspreadsheet.py", line 314, in wrapper
result = func(*args, **kwds)
File "<string>", line 1
this is error!
^
SyntaxError: unexpected EOF while parsing
System Message: ERROR/3 (/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/doc/sample.rst, line 2)
Following error occurs while validating the condition of the cell in 0-th row, 1-th col: ‘this is error, too’
Traceback (most recent call last):
File "/home/takafumi/repos/admin.tkf.bitbucket.org/rstspreadsheet/rstspreadsheet.py", line 314, in wrapper
result = func(*args, **kwds)
File "<string>", line 1, in <module>
NameError: name 'this' is not defined