Commit graph

29 commits

Author SHA1 Message Date
Ivailo Monev
453680e04d kdecore: do not store the KCatalog object as KuitSemantics member
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-27 20:46:25 +03:00
Ivailo Monev
8bc18c9962 kdecore: do not output entities from KCmdLineArgsStatic::parseAllArgs()
the output goes to the TTY and there is no rich text handler there, note
that the plain format for the "email" tag also contained entities (even
before the KuitSemantics reimplementation)

because the plain format for the "email" tag

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-20 19:20:12 +03:00
Ivailo Monev
f56c50e41a kdecore: drop redundant "emphasis" markup tag
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-19 23:28:54 +03:00
Ivailo Monev
ddc3476e83 kdecore: KuitSemantics::format() optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 23:38:25 +03:00
Ivailo Monev
5e6bc849e0 kdecore: break once format matches the context in KuitSemantics::format()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 23:31:36 +03:00
Ivailo Monev
76ced36171 kdecore: KuitSemantics::format() optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 20:04:16 +03:00
Ivailo Monev
53cef8e793 kdecore: break the tag search on bogus tag in KuitSemantics::format()
because the tag will not be replaced in that case and will result in
infinite loop otherwise

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 01:02:51 +03:00
Ivailo Monev
cef5ea6e46 kdecore: drop non-operational "application" markup tag
it was not applying any formatting before the reimplementation thus it is
simply redundant

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 00:55:14 +03:00
Ivailo Monev
686ba65a7e kdecore: drop redundant "para" markup tag
not used in plain context, same as "p" in rich context. also now Katie will
detect the paragraphs as rich text

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-18 00:39:06 +03:00
Ivailo Monev
ae66400fc7 kdecore: drop redundant "nl" markup tag
not used in plain context, same as "br" in rich text

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 23:34:50 +03:00
Ivailo Monev
f1217c0e64 kdecore: likely KuitSemantics::format() branch optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 23:08:48 +03:00
Ivailo Monev
1c6ce50933 kdecore: drop support for overriding numbers localization via numid tag
fun fact: there is CLDR data for ~1000 languages and only ~50 use different
number system (not "latn")

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 22:08:20 +03:00
Ivailo Monev
86025d2c8a kdecore: pass the number width and fill character to KuitSemantics from KLocalizedString
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 19:43:51 +03:00
Ivailo Monev
528f427c67 kdecore: adjust expected results in KLocalizedString tests
text with "&lt;" in it is considered as rich text by Qt::mightBeRichText()
as special case. also entities are not markup and shall not be handled by
KuitSemantics (there is a class for that - KCharsets). entity is used
only in one place (kde-workspace/kate/part/view/kateviewhelpers.cpp) and it
does not even need special handling by KuitSemantics. so, instead of
slowing the whole markup parsing with redundant and unused feature I've
decided to not support it and even improve Katie's Qt::mightBeRichText()
function

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 18:16:26 +03:00
Ivailo Monev
b7b65494a4 kdecore: KuitSemantics optimizations
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 14:47:37 +03:00
Ivailo Monev
9a5af1214b kdecore: reimplement KuitSemantics
is interesting how much simpler it can be by assuming that the tags are
strict and by using Qt::mightBeRichText() for the rich text detection.
while mostly compatible (entities are not converted, some tags were not
used and some even did not do anything) it is subject to optimization by
using QStringMatcher or other tricks (like using a separate tag for the
numbers precision)

overall - no regular expression matching, no XML parser is used and does
what the old implementation was doing but with less code. also passes
most tests (the exception is KLocalizedString test case that expect
entities to be replaced)

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-17 01:43:12 +03:00
Ivailo Monev
bd063c8b56 generic: remove dead and irrelevant links references
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-08-10 14:26:19 +03:00
Ivailo Monev
d02d2b3fa4 kdecore: implement precision field for KuitSemantics
otherwise KLocale::formatNumber() has to guess the precision that was
passed to KLocalizedString::subs() and make up a localized integer string
with a magic wand, the precision for precise number types (e.g. ulong,
qlonglong, etc.) remains -1

fixes KSignalPlotter test case failure

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2023-07-28 15:45:04 +03:00
Ivailo Monev
1af12047e6 kdecore: remove unused KLocalizedString semantics
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-11-03 01:06:07 +02:00
Ivailo Monev
8d9978f7e5 kdecore: remove unused KLocalizedString semantics
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-11-03 00:47:26 +02:00
Ivailo Monev
169e338449 kdecore: convert KuitFormats functions to static
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2022-11-03 02:37:11 +02:00
Ivailo Monev
48f25f1fb5 kdecore: replace KuitSemantics::escape() with Qt::escape()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2021-03-18 09:46:22 +02:00
Ivailo Monev
9f33f0a2da kdecore: correct argument number in KuitSemanticsPrivate::parseOpenEl()
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2021-01-10 12:57:13 +02:00
Ivailo Monev
ceabb2ead0 kdecore: adjust to Katie changes
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
2019-05-08 04:28:58 +00:00
Ivailo Monev
b5b1aaed22 kdecore: fix some compiler warnings
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2016-05-26 14:48:40 +00:00
Ivailo Monev
d9cc003262 kdecore: remove unused KuitSemantics::mightBeRichText
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
2016-05-26 14:45:59 +00:00
Ivailo Monev
f4f2c7bc75 generic: misc cleanups 2015-09-04 22:56:23 +00:00
Ivailo Monev
21ad0df488 generic: make changes required for building against katie 2015-08-11 05:56:07 +03:00
Ivailo Monev
814163a8dc initial import 2014-11-13 01:04:59 +02:00