summaryrefslogtreecommitdiff
path: root/make_icon_link.txt.py
diff options
context:
space:
mode:
authorOlivier Hallot <olivier.hallot@libreoffice.org>2018-11-10 19:54:22 -0200
committerOlivier Hallot <olivier.hallot@libreoffice.org>2018-11-11 20:41:50 +0100
commit4f351cf5ffbba2877b16593ab9ebb76c6d723980 (patch)
tree5cbc558232782a0c156b8b809ea33f0aa3a06384 /make_icon_link.txt.py
parent12cf5b53b185177924dd7ce572bc7451c9edc76b (diff)
Fix icon display in Help pages
1) The python script creates the replacement table (xsl) for missing icons from colibre/links.txt. Later it should go to build system. 2) Handle icon tables when images are not from icon-theme Change-Id: If946af6fc6c05431c07470c01082a46e0fdbdde0 Reviewed-on: https://gerrit.libreoffice.org/63254 Tested-by: Jenkins Reviewed-by: Olivier Hallot <olivier.hallot@libreoffice.org>
Diffstat (limited to 'make_icon_link.txt.py')
-rwxr-xr-xmake_icon_link.txt.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/make_icon_link.txt.py b/make_icon_link.txt.py
new file mode 100755
index 0000000000..9e2a860b31
--- /dev/null
+++ b/make_icon_link.txt.py
@@ -0,0 +1,49 @@
+#!/usr/bin/python
+
+#
+# This file is part of the LibreOffice project.
+#
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this
+# file, You can obtain one at http://mozilla.org/MPL/2.0/.
+#
+#
+# Generate XSL equivalent for Colibre icon images from link.txt
+#
+
+import sys
+
+try:
+ # open file stream
+ file_icon = open("../icon-themes/colibre/links.txt", "r")
+except IOError:
+ print "There was an error reading", file_icon
+ sys.exit()
+try:
+ # open file stream
+ file_xsl = open("help3xsl/links.txt.xsl", "w+")
+except IOError:
+ print "There was an error writing", file_xsl
+ sys.exit()
+
+file_xsl.write('<?xml version="1.0" encoding="UTF-8"?>\n');
+file_xsl.write('<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">\n');
+file_xsl.write('<xsl:template name="linktxt">\n');
+file_xsl.write('<xsl:param name="src1"/>\n');
+file_xsl.write('<xsl:choose>\n')
+
+for line in file_icon:
+ if line[0] != "#" :
+ if line.find('png',0, len(line)) <> -1 :
+ a = "\'" + line.split()[0] + "\'"
+ b = line.split()[1]
+ file_xsl.write('<xsl:when test="$src1=' + a + '"><xsl:text>'+ b + '</xsl:text></xsl:when>\n');
+
+file_xsl.write('<xsl:otherwise><xsl:value-of select="$src1"/></xsl:otherwise>\n');
+file_xsl.write('</xsl:choose>\n');
+file_xsl.write('</xsl:template>\n');
+file_xsl.write('</xsl:stylesheet>\n');
+
+file_xsl.close()
+file_icon.close()
+sys.exit()