diff options
| author | Volker Krause <vkrause@kde.org> | 2020-12-18 17:37:32 +0100 | 
|---|---|---|
| committer | Volker Krause <vkrause@kde.org> | 2020-12-24 10:54:45 +0000 | 
| commit | 11ecd86909bd28269ab158c8b291a38e905aea3c (patch) | |
| tree | c1823ec231bc53b496acec6625de22b5d72df84f | |
| parent | 3f466f67e15bb285b7041a0b6b85d72ffb98e059 (diff) | |
| download | extra-cmake-modules-11ecd86909bd28269ab158c8b291a38e905aea3c.tar.gz extra-cmake-modules-11ecd86909bd28269ab158c8b291a38e905aea3c.tar.bz2  | |
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.
| -rwxr-xr-x | toolchain/generate-fastlane-metadata.py | 11 | 
1 files changed, 7 insertions, 4 deletions
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] += '</' + elem.tag + '>'      # 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':  | 
