Software for turning HTML into Plain Text?

Discussion in 'Mac Apps and Mac App Store' started by Macette, Sep 12, 2003.

  1. Macette macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Melbourne
    #1
    Howdy,

    Does anyone know of software for Mac OSX that I can use to strip html tags from a document and turn it into plain text? I've got a whole lot of horribly marked-up pages on a site that I'm redesigning using CSS, and I don't want to have to go through them one by one, getting rid of all the crud.

    Something Applescriptable would be cool...
     
  2. mrjamin macrumors 65816

    mrjamin

    Joined:
    Feb 6, 2003
    Location:
    Strongbadia
    #2
    Re: Software for turning HTML into Plain Text?

    a few lines of PHP could do it for you using a regexp to strip out everything inbetween and including < and >'s
     
  3. Macette thread starter macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Melbourne
    #3
    thanks - that's a good idea. Although it will probably take me as long to write the script as it would just to delete the tags by hand (but at least I'd learn something...)

    ta.
     
  4. mrjamin macrumors 65816

    mrjamin

    Joined:
    Feb 6, 2003
    Location:
    Strongbadia
    #4
    here's a hint on how to get started:

    http://www.php.net/striptags

    that pretty much does it for you!

    make sure you read through the comments on the page for further advice as it's not 100% reliable
     
  5. Macette thread starter macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Melbourne
    #5
    thanks! i've been doing a bit of php stuff recently and feel like i'm getting the hang of the syntax, but of course i still don't know a quarter of the available functions. this one is good.
     
  6. mrjamin macrumors 65816

    mrjamin

    Joined:
    Feb 6, 2003
    Location:
    Strongbadia
    #6
    i doubt many programmers do! there's no need to know many of them as the php site tells you all you need.

    with php (and most other languages) all you need is an idea of how its structured then you can find a function that'll do the job.

    best piece of advice for any programming? FLOW DIAGRAMS!
     
  7. Rower_CPU Moderator emeritus

    Rower_CPU

    Joined:
    Oct 5, 2001
    Location:
    San Diego, CA
    #7
    How about regexp matching in BBEdit?

    It'd be easier to play with expressions and see which works best in there than in PHP, IMO.
     
  8. mrjamin macrumors 65816

    mrjamin

    Joined:
    Feb 6, 2003
    Location:
    Strongbadia
    #8
    good idea but BBEdit costs money, and solving problems in PHP does your programming the world of good - its amazing how versatile PHP actually is, i've started using it for a lot of non-webbased stuff.
     
  9. Doctor Q Administrator

    Doctor Q

    Staff Member

    Joined:
    Sep 19, 2002
    Location:
    Los Angeles
    #10
    Will you get what you want if you open the page in a web browser and then save the page as text?
     
  10. mrjamin macrumors 65816

    mrjamin

    Joined:
    Feb 6, 2003
    Location:
    Strongbadia
    #11
    rock on!

    BareBones took the download link off their site a while ago and i've been looking for it for a while - quite why versiontracker.com wasn't by first port of call i don't know...
     
  11. matthew24 macrumors 6502

    matthew24

    Joined:
    May 30, 2002
    Location:
    Netherlands
    #12
    Netscape works fine for me (Save as).
    I would like to know if it is simple with BBEdit.
     
  12. tjwett macrumors 68000

    tjwett

    Joined:
    May 6, 2002
    Location:
    Brooklyn, NYC
    #13
    or you could view the site from a browser and simply copy and paste into Text Edit and save it out.
     
  13. Macette thread starter macrumors 6502

    Joined:
    Mar 5, 2002
    Location:
    Melbourne
    #14
    thanks for suggestions - I'd thought of the browser one already, but i've got, well, ten years of quarterly journals at about 12-15 articles an issue... so that's... 600 pages or something.

    is it possible to applescript something like that? I've only ever used applescripts made by other people, so I'm not really sure of what i can do with it.

    i've got bbedit - the full version! registered! paid for! - but again, am looking to do this thing as a batch, and haven't worked out how to make bbedit do that.
     
  14. tjwett macrumors 68000

    tjwett

    Joined:
    May 6, 2002
    Location:
    Brooklyn, NYC
    #15
    absolutely! i'm almost certain a script like exists for BBEdit. it's pretty simple. check out http://www.macscripter.net for scripts or look for one over at the Apple boards.
     

Share This Page