Viewing a user's posts from their profile, hides smileys/formatting


  • SockDev

    I'm curious about this, about the logic behind it - I'm not saying it's wrong, just that I don't quite understand it.

    Pick a user, any user, head to their profile and you'll see their activity stream. Of course you can filter that specifically to their posts, but that doesn't matter so much in this case.

    I get that you're providing a synopsis of the posts and that it's only partial... but you're handling formatting of links and of @ mentions, while ignoring any other formatting, including replacing smileys with [smiley].

    This seems inconsistent to me - either it should be all formatting, or no formatting, not half and half. At least, that's my take on it. Wonder what everyone else things.


    Filed under: at least the software uses the more sane spelling of smiley, the failure to use such leads to the ridiculous use of 'smilies' for plural and 'smilie' for singular.

  • Winner of the 2016 Presidential Election

    I think it makes sense in case of images to not be shown but replaced with the [image] size -tag. And I assumed that Smileys / Emoticons / Emojis / Whatever they are called could be viewed as a subset of pictures. Hence they get the special treatment of being removed. Thats just my take on it, though.

    Filed under: Maybe you can interpret it as a Text (and Links) only representation


  • SockDev

    Images I can agree with, and I suppose there's logic here with smileys. But what about other formatting? What drew my attention was in @sam 's profile, where he's inlined some HTML comment code that's not formatted.

    I haven't dug far enough to check whether any other textual formatting is covered or not covered though. But I get the feeling bold/italic/etc wouldn't be either.


  • Banned

    Excerpting issue. If you take the first 300 chars of HTML content, what happens if you cut it in the middle of...


  • SockDev

    See, this is where I've been so spoiled with my choice of forum software for years. It does bbcode by way of stepping through it and parsing it tag by tag. This has two side effects - performance sucks, but not as much as the alternative of DOS-by-regexp - and the fact that you know what tags you're currently in the middle of, and can safely and sanely exit those tags again.

    Or even take slightly more markup than you need and start at 300 and gradually expand if you have to, to avoid cutting markup.


  • Winner of the 2016 Presidential Election

    What happens if I start an image at position 295? I don't wanna count and test it out, but if you are able to filter out images then you should not have problems with other tags either, right?



  • @codinghorror said:

    what happens if you cut it in the middle of...

    Well, you add more regex, obviously. No, more than that. Yes. More. More.


  • SockDev

    Now you have more problems.

    Alternatively, of course, there's always solutions like putting them in a div with a fixed max-height and overflow:scroll.

    There's all kinds of solutions, that have already been done, already tested and deployed in forums for years.

    Filed under: smells like NIH syndrome



  • Treat an image/emoji as one character...


  • SockDev

    Pretend it's like UTF-8. You're dealing with multiple bytes that form a single unit 😉


  • Discourse touched me in a no-no place

    @Arantor said:

    Pretend it's like UTF-8.

    Or internally use the object replacement character, U+00FFFC, as that's intended to be for this sort of thing IIRC.


  • Winner of the 2016 Presidential Election

    @Arantor said:

    See, this is where I've been so spoiled with my choice of forum software for years. It does bbcode by way of stepping through it and parsing it tag by tag. This has two side effects - performance sucks, but not as much as the alternative of DOS-by-regexp - and the fact that you know what tags you're currently in the middle of, and can safely and sanely exit those tags again.

    I wrote my BBCode parser in .NET, and it works similarly, with a stack. It's smart enough to interleave tags, so if you type: [b]Discourse [i]sucks [u]worse [/b]than [/i]Community [/u]Server, you get <strong>Discourse <em>sucks <u>worse </u></em></strong><em><u>than </u></em><u>Community </u>Server.

    It's also smart enough to close inline tags when it encounters a block-level tag (or eof), filter out redundant tags (links within links, for example) and prevent whitespace collapsing.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.