Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: Simplify HTML programatically

by Anonymous Monk
on Nov 27, 2007 at 14:08 UTC ( #653234=note: print w/replies, xml ) Need Help??


in reply to Re^2: Simplify HTML programatically
in thread Simplify HTML programatically

Many thanx for your reply.

Well, the snippet you posted is more or less what I need. However, I dont know perl and it looks more serverside than clientside. My need:

I need to clean all html-tags from a string with some exception-tags. I can only define the exceptions, not the tags to clean. This must be accomplished clientside, preferably javascript, possibly javascript dom even thou then ill be well out of my depth.

Background (read it or not, its verbose): entering windows vista the active-x wysiwyg html editor on a content management system im hosting stopped working. My job was to integrate the fck instead of the activex.

The old component never removed copy-pasted tags from word etc, it just "hugged the text" with its own fonttags, thus hiding loads of garbage thats still in the db. fck cannot support these css fonttags in sufficiently userfriendly manner so, in the future im using h1,h2,h3 and such together with css. However, when a user wishes to edit stuff that was produced with the old editor i fret that there might be inconsistences between h1 (fck) and font class=r1(old wysiwyg).

And, further, if I exchange normal text markup in old editor(font class="f1") with that of fck(nothing) all the junk that has been copy-pasted into the cms system and then been hidden by hug-the-text-fonttags will suddenly surface. Thus, i want to nuke everything, on usercommand, except for stuff like links, linebreaks, tables, images paragraphtags etcetera.

/nic

Replies are listed 'Best First'.
Re^4: Simplify HTML programatically
by wfsp (Abbot) on Nov 27, 2007 at 14:41 UTC
    The snippet could be written to run on the client or the server.

    Javascript: I can't help you there I'm afraid. Are you saying you want to do this in the browser?

    If what you want to do is rewrite a lot of HTML I think we'll be able to help.

    Your best bet to post a new question with a representative (but fairly short) example of your 'junk' and an example of what you want it to look like.

      Ok, will do, thanx for info. Problem with the junk is i havent got a clue what it is. Its hundereds of users with next to no knowledge that has been at it for years putting up html pages anywhichway they could ram it through the old wysiwyg component, so, i expect the "junk" is anything and everything.
Re^4: Simplify HTML programatically
by Anonymous Monk on Nov 27, 2007 at 14:36 UTC
    Just to clearify, its the tags themselves i want to remove, not the text they enclose.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (5)
As of 2021-02-28 01:21 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?