Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

(jeffa) Re: Offline Previewing

by jeffa (Bishop)
on Jun 28, 2003 at 22:07 UTC ( [id://269939]=note: print w/replies, xml ) Need Help??


in reply to Offline Previewing

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)

Replies are listed 'Best First'.
Re: (jeffa) Re: Offline Previewing
by chunlou (Curate) on Jun 28, 2003 at 23:14 UTC
    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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://269939]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2024-04-23 10:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found