http://qs321.pair.com?node_id=269887

Maybe I missed it but is there any script or anything I could run offline to help preview my post to PM offline? Or it would pose security risk? Thanks.

Replies are listed 'Best First'.
(jeffa) Re: Offline Previewing
by jeffa (Bishop) on Jun 28, 2003 at 22:07 UTC
    As you can see, there is no easy, maintainence-free solution for this. It would be nice if there was some kind of 'render core' that could theoretically be abstracted out of the Everything engine, but there isn't (and probably for a very good reason too).

    So what can you do? Anytime i write a large post, i always start with POD. pod2html produces (IMHO) ugly HTML, but that's okay ... just filter the output through tidy:

    pod2html write_up.pod | tidy > write_up.html
    Now you have something to work with. The only problem is that pod2html escapes entities (< > & ") for you. This is both a boon and a bane ... boon because it escapes any example HTML you have in your write up, bane because it escapes common Perl operators (-> => > < = <=> ") as well. Honestly, i have no perfect solution for cleaning up this final step. I usually attack the problem with a handful of semi-intelligent (or was that semi-braindead) perl -pi -e one-liners and finish the rest by hand (data entry is so tedious). But it's better than relying on a browser to not crash.

    Also, don't forget about your scratchpad. It is perfect for sculpting a write up. ;)

    jeffa

    L-LL-L--L-LL-L--L-LL-L--
    -R--R-RR-R--R-RR-R--R-RR
    B--B--B--B--B--B--B--B--
    H---H---H---H---H---H---
    (the triplet paradiddle with high-hat)
    
      Ok. Actually it's not too hard to emulate Preview ourselves via XSL. Mostly we just have to take care of special tags like code or readmore and kinda ignore stuff like square brackets.

      Was just wondering why not let people preview offline so as to lessen the load on PM server. Some online survey apps did that. Using their proprietory apps, people create survey completely offline and upload the survey when done.

      Thanks for explaining.
        If we were all using IE, then I think it would be pretty easy to do via DHTML/XSL/XML, but since everyone is coming in on a variety of browsers that do or don't do various things (or at least not easily), it increases the complexity (and annoyance) of writing such a thing.

        That said, it would really be nice for people over a slow dial-up connection (I suppose that phrase is redundant) to not have to send it all up twice.

        I have written many DHTML apps in the past that did similar things, many manipulations and example renderings on this side, and then sends it all upstream at the end when things are finalized. It is "easy" on IE, but for us it was a series of custom apps for clients, so we could require IE - for a public website, you can't really require one type over another.

        Would have to grab the data out of the form, then just build the preview on the page via DHTML (or dump it out to an XML DOM and then run an XSL translation over it)... not too bad at all, and not a security risk at all to answer your question.

        -------------------------------------------------------------------
        There are some odd things afoot now, in the Villa Straylight.
Re: Offline Previewing
by hsmyers (Canon) on Jun 28, 2003 at 16:50 UTC
    Typically I write mine in a side window using an HTML capable editor like EditPlus---gets me formatting and spell checking. Problem is those specials like square brackets and readmores etc. Likewise I often forget to take out the 'pre' tags with attendant woe.

    --hsm

    "Never try to teach a pig to sing...it wastes your time and it annoys the pig."
Re: Offline Previewing
by artist (Parson) on Jun 28, 2003 at 16:28 UTC
Re: Offline Previewing
by Abigail-II (Bishop) on Jun 28, 2003 at 16:35 UTC
    If only Perlmonks would accept POD instead of markup resembling some subset of HTML....

    Abigail