CodeIgniter Forums
Typography - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forum-28.html)
+--- Forum: CodeIgniter 4 Discussion (https://forum.codeigniter.com/forum-31.html)
+--- Thread: Typography (/thread-75272.html)



Typography - fabsn182 - 01-21-2020

https://github.com/codeigniter4/CodeIgniter4/blob/develop/system/Typography/Typography.php

Is this really something CI4 should include?
It is not configurable, it only suits the english language and it is a lot of "work" in just the `autoTypography()` method.
To me, it looks like an old class, ported to work with CI4, that's just in there for an absolute edge case. And since one should/would rarely use it, it should not be included in the main CI4 installation

If it stays, it must be configurable. Split `autoTypography()` into multiple methods that can be called independently (and maybe chained).
Why, you ask? Want to have em dashes but no newline formatting? Naa, can't do that.
Want to have curly quotes but as real utf8 characters, not html entities? Sorry mate, can't help you there.

I don't want to insult anyone but it looks like a insufficient (compare with https://github.com/mundschenk-at/php-typography), lazy and slow - and therefore wrong - way of doing those things. CI4 should not encourage working with Text/HTML like that. Especially not, when it's using RegEx to match HTML tags


RE: Typography - kilishan - 01-21-2020

You're free to submit pull requests with any changes you'd like to see. Much more effective than simply complaining.

I actually did look at php-typography when porting that over. It's great. And it's pretty large. Yes, I've found simple formatting helpful provided by typography class in CI useful for certain instances. And always been frustrated when I needed something more than nl2br when working in other frameworks, but less robust than php-typography. Luckily it's easy to use either.


RE: Typography - InsiteFX - 01-21-2020

It fits in perfectly with a Blog web site...


RE: Typography - fabsn182 - 01-22-2020

(01-21-2020, 09:05 AM)InsiteFX Wrote: It fits in perfectly with a Blog web site...
One that only offers it's content in English and only when you really want to have every modification made every time. If you output your blog content (uncached) using this class/method, you're not paying attention to performance. So, as I said, it is only usable in edge cases.


RE: Typography - includebeer - 01-23-2020

(01-22-2020, 03:56 AM)fabsn182 Wrote:
(01-21-2020, 09:05 AM)InsiteFX Wrote: It fits in perfectly with a Blog web site...
One that only offers it's content in English and only when you really want to have every modification made every time. If you output your blog content (uncached) using this class/method, you're not paying attention to performance. So, as I said, it is only usable in edge cases.

Why only for english text?

Regarding the performance aspect, the doc is clear on that, you should cache the final result:
Quote:Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted. If you choose to use this function you may want to consider caching your pages.