On Sat, 10 May 2014 04:08:16 -0700 (PDT)
Marc van Grootel <[email protected]> wrote:
> Hi,
>
> I tried posting before but something must've gone wrong as I can't
> find a trace of it on the list.
It came through ok - sometimes I don't see things I've posted either,
it can be a bit random.
You could use a command like this:
for nd in p.self_and_subtree():
lines = nd.b.split('\n')
for n in range(len(lines)):
if lines[n].startswith('.. NODE-ID: '):
break
else:
lines.extend(['', ''])
n = len(lines) - 1
lines[n] = '.. NODE-ID: %s' % nd.v.gnx
nd.b = '\n'.join(lines)
c.redraw()
that would add
.. NODE-ID: tbrown.20140224093559.11864
to all node bodies, updating it as needed, when you re-rerun the
script, that is.
Not sure if that exactly answers your question, but it is probably the
simplest approach to what I think you're asking.
Cheers -Terry
> Recently I started using Leo on a documentation project so I'm mainly
> usfor nd in p.self_and_subtree():
lines = nd.b.split('\n')
for n in range(len(lines)):
if lines[n].startswith('.. NODE-ID: '):
break
else:
lines.extend(['', ''])
n = len(lines) - 1
lines[n] = '.. NODE-ID: %s' % nd.v.gnx
nd.b = '\n'.join(lines)
c.redraw()
ing Leo to edit and get rst output.
>
> A bit of context. I am using rst mostly because it's easy to write
> and it provides structured output in the form of XML. I convert this
> XML to DITA which is a topic-based documentation format. I chose Leo
> for it's outlining capabilities and cloned nodes. The outline
> structure in .leo files can be converted to DITA maps (kinda like
> table of contents) and the node content to DITA topics which are
> pulled into DITA maps to form a manual.
>
> What I am looking for is a way to get the unique ids that Leo gives
> each node and use them to link topics to maps. This fits in very well
> with topic re-use as cloned nodes all have the same id. I looked a
> bit at the rst3 plugin code but I wondered if there is a way to get
> the node ids into the rst output without patching this plugin code.
>
> I am curious if there is an easy way to do this.
>
> Thanks
> --Marc
>
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.