Leo php export for use on a server

39 views
Skip to first unread message

Richard

unread,
Apr 25, 2012, 6:38:22 AM4/25/12
to leo-e...@googlegroups.com
Is there a way to prepare php/html files for use on a server?

At the moment i have a leo workbook containing php, javascript and html files and nodes.

Is there a way to export files and strip leo comments/node information so that I can put these files onto a web server?
Or is there another way to accomplish this that I am missing?

Thanks

Matt Wilkie

unread,
Apr 25, 2012, 1:46:13 PM4/25/12
to leo-e...@googlegroups.com
This should be a non-issue, Leo is supposed to insert it's sentinels
(the name for Leo's metadata inserts and comments stored in @file
contents on disk) in the language's native comment delimiters so the
interpreter ignores them. This works for the languages I use, python
and dos batch files, but maybe the php/js ones leak a little.(?)

One method to save files without sentinels:

1. change the @file headline to @no-sent, save,
2. copy the output files somewhere else, then
3. change the headline back to @file (and save).

--matt

Matt Wilkie

unread,
Apr 25, 2012, 1:53:21 PM4/25/12
to leo-e...@googlegroups.com
> One method to save files without sentinels:

I thought there was a FAQ for this, but the closest match I found is
how to always work without sentinels[1,2], which is a different
scenario from "export this node tree without sentinels".

[1] http://webpages.charter.net/edreamleo/FAQ.html#how-can-i-use-leo-cooperatively-without-sentinels
[2] http://webpages.charter.net/edreamleo/FAQ.html#how-do-i-inhibit-sentinels-in-external-files

I found a menu item, "File >> Export >> Remove Sentinels" that works,
albeit in a strange (to me) fashion. Rather than operate on the
currently selected node it requires one to navigate to a file stored
on disk using the standard OS file chooser and then writes
"foobar.ext.txt" to the same directory.

So it's clunky, but a bit less so than the manual
@file-->@no-sent-->@file method I outlined earlier.

--
-matt

Richard

unread,
Apr 25, 2012, 2:32:16 PM4/25/12
to leo-e...@googlegroups.com
Thank you very much.

Export >> Remove Sentinals works great.

I had tried that before but for some reason had assumed that I was selecting where to save the exported file and not which file to export. *DOH*

Thanks again

Edward K. Ream

unread,
Apr 25, 2012, 2:49:31 PM4/25/12
to leo-e...@googlegroups.com
On Wed, Apr 25, 2012 at 1:32 PM, Richard <richard...@gmail.com> wrote:
> Thank you very much.
>
> Export >> Remove Sentinals works great.

Glad to hear it. And thanks to Matt for his comments.

The great thing about Python (and Leo) is that you can create a Leo
script based on the remove-sentinels command that will be easier to
use than using the system's file-save dialog.

A little searching (I never remember these kinds of details) leads to
the following node in leoPy.leo:

Code-->Core classes-->@file leoImport.py--><< class leoImportCommands
>>-->Export-->ic.removeSentinelsCommand--><< Write s into newFileName
>>

You can use this as the nucleus of (say) an @button script that will
automatically convert an @file tree to a corresponding file without
sentinels.

If you decide to do this, please feel free to ask whatever questions
you might have. I'm always happy to help script writers, and it's a
lot easier for me because I know what kind of searches will yield the
info I want.

Edward

Richard

unread,
Apr 25, 2012, 6:19:33 PM4/25/12
to leo-e...@googlegroups.com
Thanks for the information.

I think I need to upgrade my python skills before I attempt anything like that.

I've had a look through some of the code you mentioned and when I do get around to attempting this I'm sure I'll be back for your help.

Thanks,
Richard

HansBKK

unread,
Apr 26, 2012, 3:42:40 AM4/26/12
to leo-e...@googlegroups.com
On Thursday, April 26, 2012 1:49:31 AM UTC+7, Edward K. Ream wrote:
On Wed, Apr 25, 2012 at 1:32 PM, Richard <richard...@gmail.com> wrote:
> Thank you very much.
>
> Export >> Remove Sentinals works great.

Wouldn't the use of @shadow also satisfy this use case, but more transparently?

Reply all
Reply to author
Forward
0 new messages