Hi,
I dabbled a little with the vmware version of Sage and was able to
install EditArea, a javascript syntax highlighting library (http://
www.cdolivet.net/index.php?page=editArea). It is quite useful when
editing Python and can be turned on or off. It also allows callbacks
so pressing the save button can run evaluate_cell. It might be an
alternative to using the It's All Text Firefox plug-in.
The installation is very easy.
1) Install the EditArea library under /usr/local/sage/data/extcode/
notebook/javascript.
2) Edit /usr/local/sage/devel/sage-main/build/sage/server/notebook/
notebook.py and add the line: -
head += '\n<script type="text/javascript" src="/javascript/
editarea/edit_area/edit_area_full.js"></script>\n'
after
head += '\n<script type="text/javascript" src="/javascript/
main.js"></script>\n'
in function _html_head.
3) Edit /usr/local/sage/devel/sage-main/build/sage/server/notebook/
cell.py and add the lines: -
s += """
<script language="Javascript" type="text/javascript">
editAreaLoader.init({
id: "cell_input_%s"
,start_highlight: true
,allow_resize: "y"
,allow_toggle: true
,language: "en"
,syntax: "python"
,save_callback: "evaluate_cell('%s', false)"
,toolbar: "save,|, search, go_to_line, |, undo, redo, |,
select_font, |, change_smooth_selection, highlight, reset_highlight,
|, help"
,replace_tab_by_spaces: 4
,min_height: 350
,show_line_colors: true
});
</script>
"""%(id, id)
after
s += """
<textarea class="%s" rows=%s cols=%s
id = 'cell_input_%s'
onKeyPress = 'return input_keypress(%s,event);'
onKeyDown = 'return input_keydown(%s,event);'
onKeyUp = 'return input_keyup(%s, event);'
onBlur = 'cell_blur(%s); return true;'
onFocus = 'cell_focused(this,%s); return true;'
>%s</textarea>
"""%(cls, r, ncols, id, id, id, id, id, id, t)
in the function html_in.
4) Restart the notebook server.
Hope it might be useful.
Blair
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---