From 11ecd86909bd28269ab158c8b291a38e905aea3c Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Fri, 18 Dec 2020 17:37:32 +0100 Subject: Preserve the rich-text subset supported by F-Droid This should improve the alignment issues currently seen in bullet point lists that we use frequently in the description text. --- toolchain/generate-fastlane-metadata.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'toolchain') diff --git a/toolchain/generate-fastlane-metadata.py b/toolchain/generate-fastlane-metadata.py index a345282a..30d16927 100755 --- a/toolchain/generate-fastlane-metadata.py +++ b/toolchain/generate-fastlane-metadata.py @@ -30,6 +30,9 @@ languageMap = { "ca": "ca-ES" } +# see https://f-droid.org/en/docs/All_About_Descriptions_Graphics_and_Screenshots/ +supportedRichTextTags = { 'li', 'ul', 'ol', 'li', 'b', 'u', 'i' } + # Android appdata.xml textual item parser # This function handles reading standard text entries within an Android appdata.xml file # In particular, it handles splitting out the various translations, and converts some HTML to something which F-Droid can make use of @@ -44,18 +47,18 @@ def readText(elem, found): if not lang in found: found[lang] = "" - # Do we have a HTML List Item? - if elem.tag == 'li': - found[lang] += "ยท " - # If there is text available, we'll want to extract it # Additionally, if this element has any children, make sure we read those as well # It isn't clear if it is possible for an item to not have text, but to have children which do have text # The code will currently skip these if they're encountered if elem.text: + if elem.tag in supportedRichTextTags: + found[lang] += '<' + elem.tag + '>' found[lang] += elem.text for child in elem: readText(child, found) + if elem.tag in supportedRichTextTags: + found[lang] += '' # Finally, if this element is a HTML Paragraph (p) or HTML List Item (li) make sure we add a new line for presentation purposes if elem.tag == 'li' or elem.tag == 'p': -- cgit v1.2.1