On Fri, Nov 5, 2021 at 8:42 AM [email protected] <[email protected]>
wrote:
> I do like to write """<< quotation-section >>""" or even single quoted "<<
> quotation-section >>". Not crucial, but perhaps the test could be for
> whitespace + quotes?
I really do not want to do this. It would complicate the code (even one
'if' is too many), and imo it is mostly useless. Indeed, given the
reference:
"""<< quotation-section >>"""
And the corresponding definition node containing:
line 1
line 2
line 3
the output is:
"""
#@+<< quotation-section >>
#@+node:ekr.20211105101807.1: ** << quotation-section >>
line 1
line 2
line 3
#@-<< quotation-section >>
#@afterref
"""
How can this possibly be what you want? There are Leo sentinel comments
inside the triple-quoted string!
There is an straightforward alternative, which Leo's unit tests use
frequently. Define the contents of << quotation-section 2 >> this way:
a_var = textwrap.dedent('''\
line 1
line 2
line 3
''')
This is straightforward, and the generated code is:
#@+<< quotation-section 2 >>
#@+node:ekr.20211105102445.1: ** << quotation-section 2 >>
a_var = textwrap.dedent('''\
line 1
line 2
line 3
''')
#@-<< quotation-section 2 >>
Now the triple-quoted string contains only the expected lines!
Edward
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/leo-editor/CAMF8tS0qGtv3F6v7VMnLNvCXHJus%3DdnOWrbGi78occe1OEPqfg%40mail.gmail.com.