Joe (erebrandir) wrote in lj_dev,
Joe
erebrandir
lj_dev

Patch - cleanhtml.pl: lj-cut links to targets

Abstract

This patch allows lj-cut tags to link to HTML targets in the full post.

Description

With the introduction of the capability to close the lj-cut tag, and consequently, the capability to have multiple lj-cut tags in a single post, I feel there is a need to have the lj-cut tags link directly to the place in the text of the full post (in talkread.bml) where the cut was made.

When reading a long post that has been cut, following the "Read more..." links presently takes you to the top of the talkread.bml view of the post. Finding the spot where the cut was made can sometimes be a chore, and it interrupts the flow of reading.

I simply added a few lines of code to add an HTML target into the full view of the post at the points where each cut was made.

So:

You know, I think I'm going to take a really long survey now.
<lj-cut> <!--links to talkread.bml?journal=somejournal&itemid=12345#cutid1-->
[Really long survey]
</lj-cut>

Hey, I'm bored. I'm going to take another one.
<lj-cut> <!--links to talkread.bml?journal=somejournal&itemid=12345#cutid2-->
[Another really long survey]
</lj-cut>

Becomes:

You know, I think I'm going to take a really long survey now.
<a name="cutid1"></a>
[Really long survey]

Hey, I'm bored. I'm going to take another one.
<a name="cutid2"></a>
[Another really long survey]

Patch

This patch was tested on my home test server.

livejournal/cgi-bin/cleanhtml.pl.128.diff

NOTE: Also included in this patch are the changes to the comment cleaner that I've been trying to push for several weeks. I got mostly positive feedback on them, but the changes were never committed (Ref: 384202, 385933).

Subscribe
  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 5 comments