Page 1 of 1

Re: BBcode lcase -- Uppercase to Lowercase

Posted: Tue May 14, 2019 5:37 am
by david63
Perhaps it's just me but why would you want such a BBcode? If you want the text in lowercase the surely you would type it in that way and not type it as uppercase and then apply a BBcode. :?

Re: BBcode lcase -- Uppercase to Lowercase

Posted: Tue May 14, 2019 5:58 am
by EA117
david63 wrote:
Tue May 14, 2019 5:37 am
....surely you would type it in that way...
And if you're not the one who typed the text? We quote things that we didn't type, we code block code we didn't type... surely its not unfathomable the desire to up-case or down-case a list of hashes, a list of IDs, a list of file names, etc., that you're just pasting in and not typing in real time.

Neet trick on the unique ID for the element. I was about to say "but the BBCode can only be used once", and then had to eat my hat. 😜

    Re: BBcode lcase -- Uppercase to Lowercase

    Posted: Wed May 15, 2019 5:45 am
    by mrgoldy
    Unfortunately this creates a lot of html elements with the same id. And inserts inline script each time this bbcode is used.

    Re: BBcode lcase -- Uppercase to Lowercase

    Posted: Wed May 15, 2019 9:03 am
    by EA117
    mrgoldy wrote:
    Wed May 15, 2019 5:45 am
    Unfortunately this creates a lot of html elements with the same id. And inserts inline script each time this bbcode is used.
    Do you mind sharing any specifics on what leads to the summarization as "unfortunately?" Wouldn't moving the JavaScript to the end of the page just give us the chance to see the un-transformed text, before then seeing the transformed text, by not transforming it until after the document was completed? And when the duplicate IDs never actually exist within the DOM because the code addresses this point, is there still even an issue there? Thanks.

    Re: BBcode lcase -- Uppercase to Lowercase

    Posted: Wed May 15, 2019 3:12 pm
    by mrgoldy
    Okay.
    And what if you try to use this as bbcode:
    [lower]{TEXT;postFilter=strtolower}[/lower]

    With just {TEXT} as HtML replcement.
    Or <xsl:apply-templates/>

    Currently on my phone but something like that should be possible.

    Re: BBcode lcase -- Uppercase to Lowercase

    Posted: Wed May 15, 2019 4:45 pm
    by mrgoldy
    I wouldn’t know about the accentuated vowels.
    Not sure what you mean with the line breaks. But you can add a tag rule, like so:
    [lower]{TEXT;postFilter=strtolower #createParagraphs=true}[/lower]
    You can try any of the rules here that could affect it: https://s9etextformatter.readthedocs.io ... Tag_rules/

    Re: BBcode ucase -- Lowercase to Uppercase

    Posted: Thu May 16, 2019 2:46 pm
    by mrgoldy
    Could you give me a bit more details on "the line breaks".
    What is expected and what is happening, then I can look into it.

    Re: BBcode ucase -- Lowercase to Uppercase

    Posted: Fri May 17, 2019 5:48 am
    by 3Di
    You should first try without an editor (WYSIWYG or similars.. like ckeditor or so on).
    Once you are done with native core code then you can try to port the desired behaviour to your extensions. ;)

    Moreover..

    Line breaks? You mean linefeeds?
    Accented vowels? You mean UTF-8 Character Encoding?

    Re: BBcode ucase -- Lowercase to Uppercase

    Posted: Fri May 17, 2019 11:10 am
    by mrgoldy
    That picture did help out a lot.
    Unfortunately I couldn't find a solution to it.
    As soon as you cast a filter (preFilter= or postFilter=) over the value, the line breaks are removed.

    However, what I just realised, you can also use CSS.
    BBCode: [lower]{TEXT}[/lower]
    HTML: <span style="text-transform: lowercase;">{TEXT}</span>

    And if you do not want the in-line style, you can just add a class to your stylesheets, like styles/your_style/theme/common.css and use that instead within the html replacement: <span class="lower">{TEXT}</span>

    Code: Select all

    .lower {
    	text-transform: lowercase;
    }

    Re: BBcode ucase -- Lowercase to Uppercase

    Posted: Fri May 17, 2019 12:24 pm
    by EA117
    mrgoldy wrote:
    Fri May 17, 2019 11:10 am
    However, what I just realised, you can also use CSS.
    Yeah, I fell into that hole, too. They already clarified the existence of the CSS solution in their top post, and the intention to use this alternative solution instead. I've been assuming "original text is not modified" means (for them) there is some importance to the page content actually being the modified text; e.g. some particular scenario or platform in which a cut-n-paste or other action would continue to get the original non-CSS-transformed text instead of the intended modification to the text.

    Re: BBcode ucase -- Lowercase to Uppercase

    Posted: Fri May 17, 2019 12:46 pm
    by EA117
    picaron wrote:
    Mon May 13, 2019 9:50 pm
    The use of CSS is discarded because, with this method, the original text is not modified.
    For the record, what is the scenario in which the CSS solution was not sufficient?