You could run this script (below):
It only exports selected nodes, so if you want to export everything,
you have to select all the top level nodes, i.e. collapse all the nodes
so only the top level is visible, click the first one, and shift-click
the last one.
It exports to plain text... although you might be able to use the
template to describe HTML, not sure.
---cut here---
# template is everything between r""" and second """
# placeholders are H heading B body C children
# use \n in B and C lines for conditional blank lines
template = r"""H
B
* C"""
lines=[]
exp_only = g.app.gui.runAskYesNoCancelDialog(
c, 'Expanded nodes only?', 'Expanded nodes only?')
if exp_only == 'no':
exp_only = False
def export_text(p, indent=''):
spaces = ' '*(len(indent) - len(indent.lstrip(' ')))
for line in template.split('\n'):
if 'H' in line:
lines.append(indent + line.replace('H', p.h))
elif 'B' in line and p.b.strip():
prefix = line[:line.find('B')].replace('\\n', '\n')
for i in p.b.strip().split('\n'):
lines.append(spaces + prefix + i)
prefix = line[:line.find('B')].replace('\\n', '')
if line.endswith('\\n'):
lines.append('')
elif 'C' in line and (not exp_only or p.isExpanded()):
prefix = line[:line.find('C')].replace('\\n', '\n')
for child in p.children():
export_text(child, indent=spaces + prefix)
if line.endswith('\\n'):
lines.append('')
elif 'C' not in line and 'B' not in line:
lines.append(line)
if exp_only != 'cancel':
for i in c.getSelectedPositions():
export_text(i)
filename = g.app.gui.runSaveFileDialog('Save to file')
# filename = '/home/tbrown/del.txt'
if filename is not None:
open(filename,'w').write('\n'.join(lines))
---cut here---