Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread tbp1...@gmail.com


On Thursday, January 21, 2021 at 5:29:51 PM UTC-5 jkn wrote:

> On Thursday, January 21, 2021 at 5:41:58 PM UTC tbp1...@gmail.com wrote:
>
>> It works for me :)  That is, the text of all the child nodes of the @rst 
>> node gets included in the single rst file that *rst3* outputs and the 
>> node headlines become subtitles. 
>>
>
> It depends what you mean by the 'it' that works ;-/
>
> I am mostly running under linux, and the simple usecase: something like
>
> @rst /home/jkn/path/to/file.rst
> ... subnodes
>
> does indeed work. It is when I start introducing path expressions to this 
> that is seems to fail...
>

I just tried using {{path}} expressions in the @rst node and they didn't 
work there, either.  When I put the nodes under an @path node, though, it 
worked as expected on my Windows system:

- @path {{d:}}{{sep}}{{temp}}{{sep}}{{xxx-rst}}
   - @rst pathtest
  - Node 1
  - Node 2
 Running the *rst3* command produced a file *pathtest.txt* in a directory* 
d:\temp\xxx-rst.  * 

...and the reason that I want to use path expressions is that I use the 
> same outline on different machines, where the path to the file is different.
>

I thought you'd say that :).  It looks like using an @path node does what 
is wanted, though.  One thing I've found using @path nodes is that once 
you've created one, you can't edit it by double-clicking in the headline.  
That keystroke is used for other purposes by @path nodes.  You can still 
edit the headline with the *edit-headline* command.. 

>
>> Here's how I have been running Sphinx on such a file.  I create a node 
>> that will contain the script for running Sphinx, and run it using CTRL-b 
>> (or you can turn it into a button).  The script looks like this:
>>
>> import os 
>>
> ...
>> os.system(f"cmd /k {cmd}")
>>
>
Of course, on Linux you would not use *cmd* here !

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/151724b9-f61b-4009-bd7c-72eeddb952den%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread jkn


On Thursday, January 21, 2021 at 5:41:58 PM UTC tbp1...@gmail.com wrote:

> It works for me :)  That is, the text of all the child nodes of the @rst 
> node gets included in the single rst file that *rst3* outputs and the 
> node headlines become subtitles. 
>

It depends what you mean by the 'it' that works ;-/

I am mostly running under linux, and the simple usecase: something like

@rst /home/jkn/path/to/file.rst
... subnodes

does indeed work. It is when I start introducing path expressions to this 
that is seems to fail...

  However, you don't have to use a path expression, even if it is in an 
@path node.  You can use an ordinary path for the node (e.g., 

> *d:/temp/rst-test/doc.txt*) - on Windows, Leo converts the slashes to 
> backslashes as needed (or you can just use backslashes).
>

...and the reason that I want to use path expressions is that I use the 
same outline on different machines, where the path to the file is different.


> I wouldn't bother using *.rst*  as an extension since *rst3* will add a 
> *.txt* extension anyway. E.g., the node headline could be
>
> *@rst d:/temp/xxx-rst/rst_test*
>
> After running the *rst3* command, you would have a file named* 
> rst_test.txt* in *d:\temp\xxx-rst*.
>

Indeed. As I say above, I can live with this, although (a) it seems a bit 
odd to force this,  instead of specifying in the @rst headline, and (b) 
this is inconsistent with the analogous command @adoc
 

>
> Here's how I have been running Sphinx on such a file.  I create a node 
> that will contain the script for running Sphinx, and run it using CTRL-b 
> (or you can turn it into a button).  The script looks like this:
>
> import os
>
> cmd = ('py -m sphinx -C '
> '-D  master_doc=xxx-rst '
> '-D source_suffix=.txt '
> '-D html_theme=sphinx_rtd_theme '  # Omit for a default theme
> '-D "project=RST Test" '
> '-D "copyright=Joseph Smith 2021" '  # Included here just for illustration!
> '. result')
>
> os.system(f"cmd /k {cmd}")
>
> Since this node will be  in the same Leo outline as the rst file, the 
> Sphinx output will go to that directory.  If you don't want that, you can 
> specify where it should go (another *-D* directive, I think, but I don't 
> remember its name).
>
>
Thanks - I am not yet running Sphinx on the output but that will probably 
happen in time.

J^n

Remember, with this Python way to concatenate string fragments, you need to 
> enclose them all in the parentheses as shown.  Otherwise, use any 
> concatenation method you like, but I think this is the most readable.
>
> With this script, you don't actually need a Sphinx configuration file and 
> so you don't have to run the Sphinx make (if that's still what it is 
> called) to build a config file.  Of course, if you need to set more options 
> you might have to go ahead and build a config file after all, but this way 
> is usually enough for me.
>
> If you decide to use a command like this, be aware that the shell that is 
> launched by the last line will not terminate after the build is complete.  
> If you are running leo from a console, that same console window will be 
> reused by the shell you just launched.  So after the build is done, you 
> have to type *exit* in the console to get control of Leo again.  You 
> could avoid that by using cmd /c instead, but I have found that the shell 
> may terminate before all the output has been written (at least on Windows - 
> I haven't tried it on Linux).  If you are running Leo without a console, 
> then you will still need to terminate the new console yourself.
>
> You can also break up your document into a series of *.rst* files, but 
> that's another topic.
> On Thursday, January 21, 2021 at 10:13:37 AM UTC-5 jkn wrote:
>
>> >  If @rst is including the entire path in the file name, you can put the 
>> @rst node under an @path node.
>>
>> Hmm, I tried that - the file gets written with the correct pathname 
>> (location and filename) when the rst3 command is run - but the output is 
>> incorrect. No child nodes seem to be being used.
>>
>> I haven't used @path directives before, so I read the instructions ;-). I 
>> also tried using @path within the body (of the @rst node) without success. 
>> It is almost as if @path 'breaks' @rst.
>>
>> So 'should' this work?
>>
>> @path {{g.app.homeDir}}{{sep}}path{{sep}}to{{sep}}
>> @rst  mtRestFile.rst
>> TitleNode
>>  SectionNode
>> ...
>>
>> ?
>> (doesn't seem to)
>>
>> J^n
>>
>>
>>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/be8d576c-0a33-4ddb-9fdf-75973ae3a886n%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread tbp1...@gmail.com


On Thursday, January 21, 2021 at 12:41:58 PM UTC-5 tbp1...@gmail.com wrote:

> ... The script looks like this:
>
> import os
>
> cmd = ('py -m sphinx -C '
> '-D  master_doc=xxx-rst '
> '-D source_suffix=.txt '
> '-D html_theme=sphinx_rtd_theme '  # Omit for a default theme
> '-D "project=RST Test" '
> '-D "copyright=Joseph Smith 2021" '  # Included here just for illustration!
> '. result')
>
> os.system(f"cmd /k {cmd}")
>
> Since this node will be  in the same Leo outline as the rst file, the 
> Sphinx output will go to that directory.  If you don't want that, you can 
> specify where it should go (another *-D* directive, I think, but I don't 
> remember its name)
>

Ha, of course.  No new directive needed.  The sphinx command ends with 
 .  The "." in the above example just means that the 
source will be in the current directory.  So if the source files are in 
,  replace the ". result"  with "source result".

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/9141ab5c-7223-40f4-9dee-9920a38daa0cn%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread tbp1...@gmail.com
It works for me :)  That is, the text of all the child nodes of the @rst 
node gets included in the single rst file that *rst3* outputs and the node 
headlines become subtitles.  However, you don't have to use a path 
expression, even if it is in an @path node.  You can use an ordinary path 
for the node (e.g., *d:/temp/rst-test/doc.txt*) - on Windows, Leo converts 
the slashes to backslashes as needed (or you can just use backslashes).

I wouldn't bother using *.rst*  as an extension since *rst3* will add a 
*.txt* extension anyway. E.g., the node headline could be

*@rst d:/temp/xxx-rst/rst_test*

After running the *rst3* command, you would have a file named* rst_test.txt* 
in *d:\temp\xxx-rst*.

Here's how I have been running Sphinx on such a file.  I create a node that 
will contain the script for running Sphinx, and run it using CTRL-b (or you 
can turn it into a button).  The script looks like this:

import os

cmd = ('py -m sphinx -C '
'-D  master_doc=xxx-rst '
'-D source_suffix=.txt '
'-D html_theme=sphinx_rtd_theme '  # Omit for a default theme
'-D "project=RST Test" '
'-D "copyright=Joseph Smith 2021" '  # Included here just for illustration!
'. result')

os.system(f"cmd /k {cmd}")

Since this node will be  in the same Leo outline as the rst file, the 
Sphinx output will go to that directory.  If you don't want that, you can 
specify where it should go (another *-D* directive, I think, but I don't 
remember its name).

Remember, with this Python way to concatenate string fragments, you need to 
enclose them all in the parentheses as shown.  Otherwise, use any 
concatenation method you like, but I think this is the most readable.

With this script, you don't actually need a Sphinx configuration file and 
so you don't have to run the Sphinx make (if that's still what it is 
called) to build a config file.  Of course, if you need to set more options 
you might have to go ahead and build a config file after all, but this way 
is usually enough for me.

If you decide to use a command like this, be aware that the shell that is 
launched by the last line will not terminate after the build is complete.  
If you are running leo from a console, that same console window will be 
reused by the shell you just launched.  So after the build is done, you 
have to type *exit* in the console to get control of Leo again.  You could 
avoid that by using cmd /c instead, but I have found that the shell may 
terminate before all the output has been written (at least on Windows - I 
haven't tried it on Linux).  If you are running Leo without a console, then 
you will still need to terminate the new console yourself.

You can also break up your document into a series of *.rst* files, but 
that's another topic.
On Thursday, January 21, 2021 at 10:13:37 AM UTC-5 jkn wrote:

> >  If @rst is including the entire path in the file name, you can put the 
> @rst node under an @path node.
>
> Hmm, I tried that - the file gets written with the correct pathname 
> (location and filename) when the rst3 command is run - but the output is 
> incorrect. No child nodes seem to be being used.
>
> I haven't used @path directives before, so I read the instructions ;-). I 
> also tried using @path within the body (of the @rst node) without success. 
> It is almost as if @path 'breaks' @rst.
>
> So 'should' this work?
>
> @path {{g.app.homeDir}}{{sep}}path{{sep}}to{{sep}}
> @rst  mtRestFile.rst
> TitleNode
>  SectionNode
> ...
>
> ?
> (doesn't seem to)
>
> J^n
>
>
>

-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/6d20372c-8b6f-4ab3-9dfe-bdbbff0fc2bcn%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread jkn
>  If @rst is including the entire path in the file name, you can put the 
@rst node under an @path node.

Hmm, I tried that - the file gets written with the correct pathname 
(location and filename) when the rst3 command is run - but the output is 
incorrect. No child nodes seem to be being used.

I haven't used @path directives before, so I read the instructions ;-). I 
also tried using @path within the body (of the @rst node) without success. 
It is almost as if @path 'breaks' @rst.

So 'should' this work?

@path {{g.app.homeDir}}{{sep}}path{{sep}}to{{sep}}
@rst  mtRestFile.rst
TitleNode
 SectionNode
...

?
(doesn't seem to)

J^n


-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/6d3d7f84-9899-4bc4-b68f-9b1175ecdb23n%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread jkn


On Thursday, January 21, 2021 at 2:38:25 PM UTC tbp1...@gmail.com wrote:

> For an @rst node,  the *rst3* command adds a *.txt* extension to every 
> filename.  Maybe there is a setting to change this, I don't know.


Yes, I saw that - I wasn't wild about it but I can live with that for now. 
@adoc doesn't do the corresponding appending
 

> Sphinx is happy working with **.txt* files, as long  as you tell it to in 
> the Sphinx configuration.


I was presuming that - thanks
 

>   If @rst is including the entire path in the file name, you can put the 
> @rst node under an @path node.


I will take a look at that idea - thanks. The enhancement issue I will file 
will probably ask for some consistency in the documentation, I am not clear 
what directives are 'supposed' to honour the path expressions

  If you haven't tried to use the *rst3 *command yet, I suggest you check 
> it out.  It's perfect for building sphinx documents.
>
> That was exactly what I was in the middle of when I hit this!

Thanks, J^n

 

> On Thursday, January 21, 2021 at 8:32:06 AM UTC-5 Edward K. Ream wrote:
>
>> On Thu, Jan 21, 2021 at 7:16 AM jkn  wrote:
>>
>>>
>>> Hi Edward
>>> I am looking at switching from occasionally creating documents via 
>>> AsciiDoc, to via ReStructuredText instead (my new company uses ResT, sphinx 
>>> etc, which is nice).
>>>
>>> I am used to using 'path expressions' in the headline for an @adoc file:
>>>
>>> @adoc {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.adoc
>>>
>>> But this:
>>>
>>> @rst {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.rst
>>>
>>> creates a file with the 'unmunged' name. Is this an oversight?
>>>
>>> I was a bit surprised since I thought @adoc built on work already done 
>>> for @rst. Or was it @md??
>>>
>>
>> When in doubt, trust what happens :-) I have no particular recollection 
>> of this issue. Feel free to file an enhancement issue.
>>
>> 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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/c25364e1-01cb-41f9-87ae-81e6c16fc731n%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread tbp1...@gmail.com
For an @rst node,  the *rst3* command adds a *.txt* extension to every 
filename.  Maybe there is a setting to change this, I don't know. Sphinx is 
happy working with **.txt* files, as long  as you tell it to in the Sphinx 
configuration.  If @rst is including the entire path in the file name, you 
can put the @rst node under an @path node.  If you haven't tried to use the 
*rst3 
*command yet, I suggest you check it out.  It's perfect for building sphinx 
documents.

On Thursday, January 21, 2021 at 8:32:06 AM UTC-5 Edward K. Ream wrote:

> On Thu, Jan 21, 2021 at 7:16 AM jkn  wrote:
>
>>
>> Hi Edward
>> I am looking at switching from occasionally creating documents via 
>> AsciiDoc, to via ReStructuredText instead (my new company uses ResT, sphinx 
>> etc, which is nice).
>>
>> I am used to using 'path expressions' in the headline for an @adoc file:
>>
>> @adoc {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.adoc
>>
>> But this:
>>
>> @rst {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.rst
>>
>> creates a file with the 'unmunged' name. Is this an oversight?
>>
>> I was a bit surprised since I thought @adoc built on work already done 
>> for @rst. Or was it @md??
>>
>
> When in doubt, trust what happens :-) I have no particular recollection of 
> this issue. Feel free to file an enhancement issue.
>
> 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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/2fb9449e-aad8-4f94-b6b3-b1baf1471d83n%40googlegroups.com.


Re: @adoc not honouring path expressions in headline?

2021-01-21 Thread Edward K. Ream
On Thu, Jan 21, 2021 at 7:16 AM jkn  wrote:

>
> Hi Edward
> I am looking at switching from occasionally creating documents via
> AsciiDoc, to via ReStructuredText instead (my new company uses ResT, sphinx
> etc, which is nice).
>
> I am used to using 'path expressions' in the headline for an @adoc file:
>
> @adoc {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.adoc
>
> But this:
>
> @rst {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.rst
>
> creates a file with the 'unmunged' name. Is this an oversight?
>
> I was a bit surprised since I thought @adoc built on work already done for
> @rst. Or was it @md??
>

When in doubt, trust what happens :-) I have no particular recollection of
this issue. Feel free to file an enhancement issue.

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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/CAMF8tS0yWt_Qh7%2BFa8BOkEycwuDXfY%3DPLmhQ3jwth8R4djrBnw%40mail.gmail.com.


@adoc not honouring path expressions in headline?

2021-01-21 Thread jkn

Hi Edward
I am looking at switching from occasionally creating documents via 
AsciiDoc, to via ReStructuredText instead (my new company uses ResT, sphinx 
etc, which is nice).

I am used to using 'path expressions' in the headline for an @adoc file:

@adoc {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.adoc

But this:

@rst {{g.app.homedir}}{{sep}}myproject{{sep}}docs{{sep}}docname.rst

creates a file with the 'unmunged' name. Is this an oversight?

I was a bit surprised since I thought @adoc built on work already done for 
@rst. Or was it @md??

Enjoy your vacation, in any case!

Thanks & Regards
Jon N




-- 
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 leo-editor+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/65cab27f-a88e-4092-8ae8-2c0fe9df0012n%40googlegroups.com.