helpers/convertfilters.py | 9 +++------ helpers/make_icon_link.txt.py | 24 ++++++++++++------------ 2 files changed, 15 insertions(+), 18 deletions(-)
New commits: commit ff6b674fc9034f2f70f78159c0bb16924d8ff2c1 Author: Ilmari Lauhakangas <[email protected]> AuthorDate: Thu Jul 25 16:48:49 2024 +0300 Commit: Ilmari Lauhakangas <[email protected]> CommitDate: Thu Jul 25 15:50:32 2024 +0200 helpers: fix issues found by Ruff linter Change-Id: I0fd932259a79bef030d6450a2770cb28c4c840b7 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/171015 Tested-by: Ilmari Lauhakangas <[email protected]> Reviewed-by: Ilmari Lauhakangas <[email protected]> Tested-by: Jenkins diff --git a/helpers/convertfilters.py b/helpers/convertfilters.py index 863cbb23e2..c2557205cc 100755 --- a/helpers/convertfilters.py +++ b/helpers/convertfilters.py @@ -16,9 +16,6 @@ import os import sys -import random -import time -from math import floor from lxml import etree output_file_path = os.path.join(os.path.dirname(sys.argv[0]), "convertfilters.xhp") @@ -169,11 +166,11 @@ for module in modules: </tablecell> \ </tablerow> ' - output += f'\ + output += '\ </table> \ </section> ' -output += f'\ +output += '\ </body> \ </helpdocument>' @@ -181,4 +178,4 @@ with open(output_file_path, "w") as f: f.write(output) print(f' Done. File saved at: {output_file_path}.') -print(f'Please move this file into helpcontent2/source/text/shared/guide.') +print('Please move this file into helpcontent2/source/text/shared/guide.') diff --git a/helpers/make_icon_link.txt.py b/helpers/make_icon_link.txt.py index 573af4050c..d8f37f3765 100644 --- a/helpers/make_icon_link.txt.py +++ b/helpers/make_icon_link.txt.py @@ -26,23 +26,23 @@ except IOError: print("There was an error writing", file_xsl) sys.exit() -file_xsl.write('<?xml version="1.0" encoding="UTF-8"?> '); -file_xsl.write('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> '); -file_xsl.write('<xsl:template name="linktxt"> '); -file_xsl.write('<xsl:param name="src1"/> '); +file_xsl.write('<?xml version="1.0" encoding="UTF-8"?> ') +file_xsl.write('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> ') +file_xsl.write('<xsl:template name="linktxt"> ') +file_xsl.write('<xsl:param name="src1"/> ') file_xsl.write('<xsl:choose> ') for line in file_icon: if line[0] != "#" : if line.find('png',0, len(line)) != -1 : - a = "\'" + line.split()[0] + "\'"; - b = line.split()[1].replace(".png",".svg"); - file_xsl.write('<xsl:when test="$src1=' + a + '"><xsl:text>'+ b + '</xsl:text></xsl:when> '); - -file_xsl.write('<xsl:otherwise><xsl:value-of select="$src1"/></xsl:otherwise> '); -file_xsl.write('</xsl:choose> '); -file_xsl.write('</xsl:template> '); -file_xsl.write('</xsl:stylesheet> '); + a = "\'" + line.split()[0] + "\'" + b = line.split()[1].replace(".png",".svg") + file_xsl.write('<xsl:when test="$src1=' + a + '"><xsl:text>'+ b + '</xsl:text></xsl:when> ') + +file_xsl.write('<xsl:otherwise><xsl:value-of select="$src1"/></xsl:otherwise> ') +file_xsl.write('</xsl:choose> ') +file_xsl.write('</xsl:template> ') +file_xsl.write('</xsl:stylesheet> ') file_xsl.close() file_icon.close()
