Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Readmore in source

by QwertyD (Pilgrim)
on Jan 22, 2003 at 04:35 UTC ( #228938=note: print w/replies, xml ) Need Help??


in reply to XML-style readmore not being parsed

On a semi-related note, speaking of well-formed SGML, is there a good reason why the <readmore> tag appears in the HTML that's sent to the browser? The browser can't do anything with it directly, it makes it even harder for the page to validate, and it prevents tools like HTML-Tidy from processing the source until the <readmore> is manually removed.

While I understand that there are good reasons to be able to figure out where and if a page contains a <readmore>, why couldn't it be transformed to <!-- readmore --> before the HTML is sent to the browser?

Then again, I'm sure there's probably a good reason and I just can't think of/find it.


How do I love -d? Let me count the ways...

Replies are listed 'Best First'.
Re: Readmore in source (reasons)
by tye (Sage) on Jan 22, 2003 at 21:27 UTC
    1. Because the easiest "solution" was to just add "readmore" to the list of approved HTML tags.
    2. Because this node contains <!-- readmore --> (here:) but contains no <readmore> tag.
    3. Because eventually we should provide a better solution that offers links like
      • "read less" (redisplay this node but with READMORE bits hidden)
      • "read more" (default thread display)
      • "read all" (redisplay this thread with all READMORE bits shown for all replies)
      • "hide replies" or otherwise adjust the replies depth to display
      • etc.
      and (we hope) have "read less" only appear if there is a <readmore> hiding in the current node.
    4. Because our nodes are rarely "valid" so only crazy people try to have them validate and a tool called "HTML Tidy" shouldn't require you to tidy up the HTML before you give it to it. q-:
    We also should eventually have a [ ] readless option during Preview.

                    - tye
Re: Readmore in source
by theorbtwo (Prior) on Jan 22, 2003 at 05:02 UTC

    I belive the reason is efficency. If you're looking at the node directly, the entire pass devoted to processing <readmore>s is skipped. It seems silly to run the pass just so we can change it into a comment, when it already isn't doing any harm. Yeah, it makes it a little harder to validate, but that's a rather minor concern. (It isn't actualy that much of an efficency issue, either, but I don't see the benifit in writing the code to do it.)


    Warning: Unless otherwise stated, code is untested. Do not use without understanding. Code is posted in the hopes it is useful, but without warranty. All copyrights are relinquished into the public domain unless otherwise stated. I am not an angel. I am capable of error, and err on a fairly regular basis. If I made a mistake, please let me know (such as by replying to this node).

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2020-06-01 22:40 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you really want to know if there is extraterrestrial life?



    Results (11 votes). Check out past polls.

    Notices?