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

20047Re: [Clip] HTML to wikiHow conversion clip

Expand Messages
  • Mr. Phillip Sand Hansel II
    Dec 2, 2009
    • 0 Attachment

      I knew that what I had mostly worked, but I also see that your approach is
      much cleaner and more direct.

      Thank you for leaving me a "character building challenge"; it helped me to
      more fully understand what the code was doing. :-)

      The Image replacement step did not work as expected; that caused me to read
      some help, but when I quickly got lost on the PCRE patterns section, I
      simply sat and stared at the code until I figured out some () were missing.
      I also added an extra set of double quotes (\x22 to close the imagename.jpg
      variable) and a middle variable, $2, which is the WIDTH & HEIGHT stuff I
      throw away.

      I changed...
      ^!Replace "(?is)<IMG SRC=\x22.*?ALT=\x22(.+?)\x22>" >>
      "[[Image:$1|thumb|$2]]" RAWS

      ^!Replace "(?is)<IMG SRC=\x22(.+?)\x22(.+?)ALT=\x22(.+?)\x22>" >>
      "[[Image:$1|thumb|$3]]" RAWS

      And then it did work as expected. Thank your for the improved method, and
      for making me grow.

      I will test some more real life conversions of HTML fles, and then perhaps
      create a wikiHow page on the topic. It is a useful tool if you've got HTML
      and want to share what is says with wikiFolk.

      Mr. Phillip Sand Hansel II

      ----- Original Message -----
      From: Sheri
      To: ntb-clips@yahoogroups.com
      Sent: Wednesday, December 02, 2009 4:49 PM
      Subject: Re: [Clip] HTML to wikiHow conversion clip

      Hi Phillip,

      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).


      ^!Replace "(?is)<H\d>(.+?)</H\d>" >> "== $1 ==" RAWS
      ^!Jump Doc_Start
      ^!Find "(?si)<ol>.+?</ol>" RS
      ^!Iferror olloopend
      ^!Replace "<li>" >> "#" RAHS
      ^!Jump Select_End
      ^!Goto olloop
      ^!Jump Doc_start
      ^!Find "(?si)<ul>.+?</ul>" RS
      ^!Iferror links
      ^!Replace "<li>" >> "*" RAHS
      ^!Jump Select_End
      ^!Goto ulloop
      ^!Replace "(?is)<A HREF=\x22(.+?)\x22>(.*?)</A>" >> "[[$1|$2]]" RAWS
      ^!Replace "(?is)<IMG SRC=\x22.*?ALT=\x22(.+?)\x22>" >>
      "[[Image:$1|thumb|$2]]" RAWS
      ^!Replace "(?is)<p>\R?" >> "*" RAWS
      ^!Replace "(?i)<[^>]+>" >> "" RAWS
      ;end of clip
    • Show all 8 messages in this topic