in reply to Re: Re: Re: Re: Portably transforming a string to a valid filename
in thread Portably transforming a string to a valid filename

The method behind my madness, so to speak, was that a given user could then fairly easily translate the nodes to a group of html files, one to a topic -- if, for instance, one had written extensively about a topic and wanted to make the information available to those who don't use E2 or Google.The initial version (which, admittedly, isn't posted yet) allows one to use a regexp to select which writeups a given user wants to save from the database, which could apply equally well to a single-file mode.

I was planning some sort of single-file functionality eventually, particularly so that one could pull out a group of nodes, revise them, and then auto-node them back into the database. I'm uncertain whether or not XML is the way to go, given I'm hardly an XML expert (or a Perl one, for that matter). Perhaps a single-XML-file option and a single-"text" file option.

FWIW, an E2 user whose code I <strikeout>stole</strikeout> borrowed from (don't worry, it's GPL) to create it suggested the following regexp to me: $nodefilename =~ y,/:\\?'*&quot;&lt;&gt;;&amp;!\0,,d;
, and I use a separate operation to translate spaces to underscores unless an option is selected that prevents this (for instance, if one is running Windows).

  • Comment on Re: Re: Re: Re: Re: Portably transforming a string to a valid filename
  • Download Code

Replies are listed 'Best First'.
Re: Re: Re: Re: Re: Re: Portably transforming a string to a valid filename
by arturo (Vicar) on Feb 20, 2001 at 03:32 UTC

    If you don't know XML, and XML might be good for the project (especially as you can use XSLT to do the HTMLifying), this might be a good time to learn XML =)

    But, whatever works for ya!

    Philosophy can be made out of anything. Or less -- Jerry A. Fodor