dear all

I started to play with sage recently and noticed that stand-alone
scripts and worksheets are really decoupled. I would prefer to have
script, for doing quick and dirty calculations, but next it would be
good to use notebook to share it with colleagues.
 is there simple way to convert  stand-alone scripts to a worksheet
and vice versa?

I'm thinking about script like rst2sage, which can take a sage file
and create worksheet.txt file for notebook. rst text can be in
comments, like this:
---> cut <---
#!/usr/bin/env sage

###  Ttitle 1
### ======
###
### some explanations for the code

var('x y') # define variables
f = x + y # define functions
# other funny stuff

### some more explanation
### with *rst markup*

def somefunction(x):
    return x / 2

# use new function
print somefunction(1)
---> cut <---

processing of such a file should give

---> cut <---
<h1 class="title">Title 1</h1>

<p>some explanations for the code</p>

{{{id=0|
var('x y') # define variables
f = x + y # define functions
# other funny stuff
///
}}}

<p>some more explanation
with <em>rst markup</em></p>

{{{id=1|
def somefunction(x):
    return x / 2
///
}}}

{{{id=2|
# use new function
print somefunction(1)
///
}}}
---> cut <---

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel-unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to