Re: [frogs] output port into a string?

[ Thread Index | Date Index | More lilynet.net/frogs Archives ]




On 9/2/10 10:13 AM, "Graham Percival" <graham@xxxxxxxxxxxxxxxxx> wrote:

> Hi all,
> 
> I'm trying to un-gimpify the text markup list.  This is part of the
> automatically generated notation appendices.  In particular, I'm
> trying to remove the @node ... @appendixsec   from the auto-generated
> file, so that those commands can be in the notation-appendices.tely
> file so that we can safely regenerate the @menu...@end menu sections.
> 
> A shorter explanation: scheme generates a file.  I want to generate
> that file without the first two lines.
> 
> I succeeded with mark-list-commands.tely.  Unfortunately,
> markup-commands.tely is generated by dumping text into a port, which
> is a file -- instead of the (IMO much more sensible) way of generating
> a string, them putting that string into a file.  The other notation
> appendices are generated that way.
> 
> One option is to copy the dump-node definition in
> scm/documentation-lib.scm, name the copy dump-non-node, and remove the
> @node @section portion of the function.  But this feels like a crappy
> "solution" to me.
> 
> 
> Can scheme redirect an output port into a file?  If I could convert
> this into a string, I can happily cut off the first 20 chars or so,
> then dump the remainder into a file.

Ports can be files, strings, or void.  See

<http://www.gnu.org/software/guile/manual/html_node/String-Ports.html#String
-Ports>

for information on how you can use the function with a port to return a
string, which you can then modify and send out to the file (in the form of
the original port).

I haven't followed up on all of the details, but I think these calls should
work for you.

HTH,

Carl



---
----
Join the Frogs!


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/