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

G'day All,

Would it be possible to truncate individual "Nodes To Consider" items that exceed a certain size.

This request was prompted by the fact that, for about the last day or two, the first three entries take up about 20 screenfuls (on my 27'' monitor with my browser extended to its full height). I have encountered single items like this in the past, but never this many: it makes navigation very difficult.

I'm not fussed about what actual size is chosen, perhaps 2,000 characters. I wouldn't want the number of lines to be the criterion: the second item, at the moment, contains a single line with 4,263 characters.

I'd envisage some simple line, following the truncation, which says something like: "Truncated at 2,000 characters, follow the link above to see the full post.".

Normal posts which exceed a maximum number of characters — I'm not sure of the limit; 64K? — have something similar. Perhaps the code used for that could be reused for this.

— Ken

  • Comment on Truncation of individual "Nodes to Consider"

Replies are listed 'Best First'.
Re: Truncation of individual "Nodes to Consider"
by cavac (Priest) on Nov 29, 2021 at 15:31 UTC

    Hmm, stuff with HTML is not that easy to truncate cleanly. It's certainly possible, but the server might have to generate the appropriate end tags. That means at least porting or adapting code from some other place (the post preview function might be a good place to start)

    On the other hand, the more annoying a post in NTC is, the faster it will get required votes to "Edit" or "Reap". That is also something to keep in mind. That's the trouble with a nice, friendly place like PM. You can't "admin abuse" a troll unless the community gives you the go ahead.

    perl -e 'use Crypt::Digest::SHA256 qw[sha256_hex]; print substr(sha256_hex("the Answer To Life, The Universe And Everything"), 6, 2), "\n";'

      G'day cavac,

      I don't have access to PM code, so I can't comment on how easy or difficult this might be. I did suggest reusing code that I thought was already in place; although, that was just a guess.

      I don't know if your comment about "... the more annoying a post in NTC is ..." is truly valid. Those long posts hung around for quite some time: they're gone now (but it is more than a month later).

      Anyway, thanks for giving this some thought and responding.

      — Ken

        > I did suggest reusing code that I thought was already in place;

        Last time I checked posts were rejected not truncated if longer than x kb (x~~64 ?).

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery

      > Hmm, stuff with HTML is not that easy to truncate cleanly. It's certainly possible, but the server might have to generate the appropriate end tags.

      PM is using a selfmade configurable parser to

      • "validate" the HTML and
      • activate the markup and
      • deactivate potentially malicious elements.

      IMHO it's not 100% correct and has loopholes.

      A truncation mechanism would need to be added on top of this, which is unlikely.

      Anyway folding away huge branches of the DOM might be far better and easier than truncating, but would still require a better parser.

      Cheers Rolf
      (addicted to the Perl Programming Language :)
      Wikisyntax for the Monastery

        G'day Rolf,

        ++ (x3) Thanks for the effort you put in to investigate this. It's appreciated.

        Yes, 64kB is roughly the number I seem to remember seeing in documentation somewhere on this site; unfortunately, I can't locate this and don't remember the exact number. Also, I'm pretty certain I've never attempted to post anything that large.

        It looks like implementing this request would involve a massive amount of work and, as such, probably won't happen. That's fine: it's just a feature, not a bug fix, and the situation that I described only occurs rarely.

        — Ken

Re: Truncation of individual "Nodes to Consider"
by footpad (Abbot) on Oct 29, 2021 at 11:53 UTC

    ...Quoth the raven... <readmore>

    Traditionally, we've let individual monks determine the formatting for their nodes and relied on /msg and Consideration to help keep things tidy.

    Given the size of the backlog, these tools may help in the short term. YMMV.

    Update: Whoops...my apologies. I just realized that you were talking about NTC, not Meditations. Very sorry. Still early here. This isn't the reply you're looking for. Move along. Move along.

    --f

Re: Truncation of individual "Nodes to Consider" ( css instantaneous )
by Anonymous Monk on Oct 29, 2021 at 06:27 UTC
    Use css its instantaneous?

      I was requesting a feature that works for all users out of the box; not something, that all users who'd like this feature, have to write their own CSS for.

      — Ken

        Hi Ken

        > I was requesting a feature that works for all users out of the box;

        Yeah, but who is going to implement it?

        If you found a good CSS solution, you could petition the gods/pmdevs to write a patch.

        (and probably soon after someone will complain that he needs it individually deactivated, so someone will need to patch the User Settings too)

        Cheers Rolf
        (addicted to the Perl Programming Language :)
        Wikisyntax for the Monastery