[pmwiki-users] Strip markup to generate plain text

Peter & Melodye Bowers pbowers at pobox.com
Wed Feb 13 03:43:24 CST 2008


> Perhaps a stupid question but is there some way to generate
> plain text from pmwiki content source?

I wasn't sure what you meant by "markdown" -- do you mean "plain text"
*after* markup has been applied?  Or are you looking for the source text
with the markup still visible?  Or (as your subject might indicate) are you
looking for the text with the markup simply stripped out?

I'm guessing you're already familiar with the ?action=source addition on the
URL?  That gives you access to the source.  (Or simply edit the page.)

If you're looking for the source text and want to do a bunch of pages (i.e.,
specifying ?action=source or editing each page is not an option) then within
the next few days the {(cp ...)} function from WikiSh will give you that
capability.  You will be able to specify {(cp MyGroup.* GroupB.FileA
TEXT--newdir)} where MyGroup.* and GroupB.FileA represent the types of
file-patterns you can specify and newdir represents an existing directory.
The TEXT-- means that you want them written out in simple text rather than
being copied as wiki pages.

I had started this function last night before I saw your email, but it won't
be done for a few day or so, probably.  If you need it urgently let me know
and I'll see if I can carve out some time for it tonight...

If you are looking for plain text with markup stripped out then you may want
to look into Hans's ExtractText with the markup=snip option.  You could
"search" for "." (i.e., return every line) and specify markup=snip so that
you got markup simply deleted.  [Hans, might a SnipMarkup() function with a
corresponding {(SnipMarkup ...)} MX be a good function to have available in
PowerTools?  Just a tho't...  I know I could make use of it with WikiSh.]

If these (viewing source or viewing source without markup codes) is not what
you're looking for then my apologies -- you may want to look into some of
the caching recipes to see a post-markup version.  I believe these recipes
result in HTML, though, which probably is not what you're looking for if
you're looking for "plain text".  You can also generate PDF using another
recipe called PublishPDF.  Maybe one of these recipes might have an option
to produce plain text?  That's a shot in the dark...

-Peter




More information about the pmwiki-users mailing list