summaryrefslogtreecommitdiff
path: root/libappstream-glib/as-node.c
Commit message (Collapse)AuthorAgeFilesLines
* Improve handling of <em> and <code> tagsJan Alexander Steffens (heftig)2022-07-181-44/+64
| | | | | | | | | | This is still not great code but at least somewhat an improvement. Tests were expanded to showcase the new behavior. I think, ideally, we would append opening/closing tags to the ancestor `p` or `li` node's cdata as soon as we encounter the start/end of an `em` or `code` element. This would then also handle empty elements correctly.
* trivial: Turn is_{em,code}_text fields into bitfieldsJan Alexander Steffens (heftig)2022-07-181-2/+2
|
* Properly initialize AsNodeToXmlHelperJan Alexander Steffens (heftig)2022-07-181-2/+2
| | | | Fixes: https://github.com/hughsie/appstream-glib/issues/445
* Consider AppStream version as a stringCorentin Noël2021-08-031-9/+13
| | | | | | Always store the AppStream metadata version as a string and compare it like any other version. This allows to have 0.10 > 0.8 for instance.
* Support em/code tagsPhilip Müller2021-06-151-0/+36
| | | | Some appstream-data packages add <em> and </em> or <code> and </code> to the files. Not all package manager can handle that. An example would be pamac from Manjaro
* Don't ignore localized strings that are the same as originalIsaque Galdino2020-06-231-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | Avoiding storing identical strings is a clever measure to keep the appstream file small and clean, but it ignores translation differences between languages and their specific locales. Applications tend to "fallback" from missing locales by picking a translation of the same language but from a different locale. For instance, when missing a "pt_BR" translation, some apps will pick the "pt" translation instead. That usually works but there are some cases when it doesn't, such as for international words: Brazilian Portuguese (pt_BR) tends to use them, while European Portuguese (pt) has a translation for everything. This way, "GNOME Boxes" gets translated to "Caixas GNOME" in European Portuguese (pt) but the same "GNOME Boxes" name is expected in Brazilian Portuguese (pt_BR). This was initially reported as a Flatpak issue in https://lists.freedesktop.org/archives/flatpak/2019-May/001578.html Because OP was seeing the wrong translations in Flathub and GNOME Software. Original commit was done by @felipeborges in his personal branch at github, commit 54f97aadcd2c00f3d95b472db6e4dda1c0c9865b
* Fix crash with invalid children of <ul/>Fabian Vogt2020-04-221-1/+1
| | | | | | It segfaulted when building the error message as data_c->name was invalid. data_c was a valid tag, so only the data_c->tag union member was active. Fix the crash by calling the proper function instead and add a test case.
* docs: Fix examples of AsNodeToXmlFlags using an invalid flag.Robert Ancell2020-01-171-1/+1
|
* trivial: Fix some typos spotted using codespellRichard Hughes2019-04-081-1/+1
|
* Allow building on WindowsJehan2019-03-261-9/+14
| | | | Signed-off-by: Richard Hughes <richard@hughsie.com>
* Use the SPDX-License-Identifier in all source filesRichard Hughes2019-02-091-15/+1
|
* Escape quotes in attributesRobin Richtsfeld2018-07-111-0/+2
|
* trivial: Load all XML tags using the gperf lookup tableRichard Hughes2018-05-221-24/+21
|
* trivial: Always store the locale of 'C' as a static stringRichard Hughes2018-05-211-2/+2
|
* trivial: Don't duplicate the locale when unwrapping a localized nodeRichard Hughes2018-05-211-11/+12
|
* trivial: Store the locale as an interned stringRichard Hughes2018-05-211-9/+39
|
* trivial: Do not use deprecated API internallyRichard Hughes2018-05-211-7/+7
|
* trivial: Do less strcmp'ing when not keeping commentsRichard Hughes2018-05-211-5/+7
|
* Never include '&' in attribute valuesRichard Hughes2018-01-301-1/+6
| | | | Fixes: https://github.com/hughsie/lvfs-website/issues/33
* Fix an invalid read when using as_app_parse_data() from PythonRichard Hughes2018-01-241-20/+45
| | | | | | | | Using GObject Introspection we were creating an object using GLib.Bytes.new(buf) where buf was a python str object. This created a GBytes object with no trailing NUL char but we were expecting a NUL-terminated string when both doing fnmatch() and also processing the XML. Support this by guarding fnmatch and also by using the string length when using the GMarkupParseContext.
* trivial: Fix up some broken links in the generated documentationRichard Hughes2017-04-211-1/+1
|
* Fix compile with -Wdiscarded-qualifiersRichard Hughes2017-03-151-14/+47
| | | | Some distros helpfully force this on for some reason.
* as-node: Add back as_node_context_{get,set}_source_kind (#157)Iain Lane2017-02-281-0/+33
| | | | | | | These were renamed to …_format_kind in 0.9.6. This is a bit of a technicality, but the functions were formally part of the ABI before 0.9.6, and so should be retained to keep strict compatibility.
* trivial: Rename some non exported symbols to use AsFormatRichard Hughes2017-02-271-14/+14
|
* trivial: Use the new AsFormatKind definesRichard Hughes2017-02-271-10/+10
| | | | No code changes, and ensure we don't break API/ABI by using #define's.
* trivial: Fix a critical warning when parsing <p><ul><li/></ul></p>Richard Hughes2017-01-041-0/+4
|
* trivial: Don't include trailing whitespace from AppData filesRichard Hughes2016-12-071-2/+3
| | | | | Translators sometimes leave extra whitespace, so if we're parsing without AS_NODE_FROM_XML_FLAG_LITERAL_TEXT then just swallow the trailing spaces.
* trivial: Fix a tiny memory leak when escaping cdataRichard Hughes2016-11-261-4/+1
|
* trivial: Add as_ref_string_new_static()Richard Hughes2016-11-211-2/+2
| | | | This reduces the number of common duplicate strings like 'C'.
* Use refcounted strings as the localised keyRichard Hughes2016-11-211-2/+4
| | | | Saves 0.02Mb RSS.
* trivial: Don't split the text every time in the XML parsing hot pathRichard Hughes2016-11-211-0/+8
| | | | This speeds up parsing to as good as pre-refcounted string time.
* Use refcounted strings in all objectsRichard Hughes2016-11-211-119/+68
| | | | | This drops the RSS by ~1Mb and has the potential to do much more drastic things if this is used in GNOME Software.
* Don't export NULL tags from AppData fileRichard Hughes2016-11-181-1/+3
| | | | | If we're ignoring the non-native languages when parsing (but keeping the tree) then make sure we don't try exporting null text tags from the empty tree nodes.
* Dedupliate nonstandard tag names using a hash tableRichard Hughes2016-11-151-51/+68
| | | | This saves another 100k of RSS.
* Deduplicate common AsNode cdata sections for some tag typesRichard Hughes2016-11-141-3/+60
| | | | This saves yet another 1Mb of RSS when loading the Fedora AppStream file.
* Deduplicate the AsNode attribute key and value using a hash tableRichard Hughes2016-11-141-31/+90
| | | | This saves about 1Mb of RSS when loading the Fedora AppStream file.
* Do not save the XML attributes if the node or parent node is being ignoredRichard Hughes2016-11-101-11/+19
| | | | | This makes things a bit quicker to load and saves over 5Mb RSS on the giant Fedora AppStream file.
* Only load native languages when parsing AppStream dataRichard Hughes2016-11-031-2/+24
| | | | | | | This adds an optional flag that allows the node parser to ignore any nodes that do not match the native languages of the user. This increases startup speed of gnome-software by ~40ms but also drops the RSS by a massive 12Mb for the Fedora AppStream file.
* Fix a small memory leak when parsing yaml filesRichard Hughes2016-09-281-0/+17
|
* trivial: Fix several -Wsign-conversion issues on ARMRichard Hughes2016-08-221-3/+3
|
* Ensure predictable output order of XML attributesRichard Hughes2016-08-101-0/+18
|
* trivial: Post branch version bumpRichard Hughes2016-07-291-2/+2
| | | | Also, fix the 'Since' tags on the API not in the 0.5.* branch.
* trivial: Fix some gtk-doc markupRichard Hughes2016-07-251-0/+1
|
* Add two new GCC warnings and fix up signed/unsigned issuesRichard Hughes2016-07-251-7/+55
|
* trivial: Get rid of useless internal-only gtk-doc markupRichard Hughes2016-06-281-72/+0
|
* Implement DEP-11 MediaBaseUrl supportRobert Ancell2016-03-041-0/+31
|
* Add as_utils_string_replace()Richard Hughes2016-03-031-22/+3
| | | | This is used all over the place both in and out of tree.
* Split out as-markup into a new source fileRichard Hughes2016-03-031-0/+1
| | | | as-utils.c was getting much too big anyway. No API changes.
* trivial: Fix FALSE/NULL confusion spotted with GCC6Richard Hughes2016-03-031-1/+1
|
* trivial: Use G_DEFINE_QUARKKalev Lember2016-01-211-8/+1
|