Loading ...
Sorry, an error occurred while loading the content.

20048Re: [Clip] HTML to wikiHow conversion clip

Expand Messages
  • flo.gehrke
    Dec 3, 2009
    • 0 Attachment
      --- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
      > I gave it a quick stab, no guarantees. I'm sure documents will still need some cleanup after using it. There's at least one long line that will need to be joined after copying this clip from email or archives (the IMG line).
      > Regards,
      > Sheri
      > ^!Replace "(?is)<H\d>(.+?)</H\d>" >> "== $1 ==" RAWS
      > ^!Jump Doc_Start...

      Hi Sheri,

      I would like to point out just some small details regarding the last 8 lines (I've added some line numbers for description)...

      1. :links
      2. ^!Replace "(?is)<A HREF=\x22(.+?)\x22>(.*?)</A>" >> "[[$1|$2]]" RAWS
      3. :images
      4. ^!Replace "(?is)<IMG SRC=\x22.*?ALT=\x22(.+?)\x22>" >> "[[Image:$1|thumb|$2]]" RAWS
      5. ^!Replace "(?is)<p>\R?" >> "*" RAWS
      6. :tags
      7. ^!Replace "(?i)<[^>]+>" >> "" RAWS
      8. ;end of clip

      Line #2: I think, Phillip wants to see some more space in the replacement.

      Line #4: For me, it doesn't capture a second substring, so '$2' remains empty and is literally output with the replacement.

      Line #5: Produces some asterisks which I can't see in Phillip's result (omitted in my proposal).

      What would you think of replacing the last lines with...

      ^!Replace "(?is)<A HREF=\x22(.+?)\x22>(.*?)</A>" >> "[[$1\x20|\x20$2]]" RAWS
      ; Next line extended
      ^!Replace "(?isx) <IMG\x20SRC=\x22 ([^\x22]+) \x22.+ALT=\x22 (.+) \x22>" >> "[[Image:$1\x20|thumb|\x20$2]]" AWRS
      ^!Replace "(<[^>]+>\R)+" >> "\r\n" AWRS
      ; Join the image-line
      ^!Find "^\[\[Image:\C+\]" WRS
      ^!Menu Modify/Lines/Join Lines
      ^!Jump 1
      ; end of clip

      Probably, some more improvements are needed. For example, joining more lines?

    • Show all 8 messages in this topic