From ee180ade07e36dd1fb8c7bdca6ecbab44ded9eb8 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Mon, 4 May 2020 10:33:44 -0300 Subject: tdf#128519 Automate icon repl't table for Help bld The solution here is to create links.txt.xsl in the helpcontent2/helpers/ folder at build time because the directive in XSLT of online_transform.xsl must be hardcoded (compile time) and core/workdir/ is not. Change-Id: I8c4c8d0b8aed58c10a95c5d42bbd1b8acdb39614 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/93436 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpers/make_icon_link.txt.py | 51 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100755 helpers/make_icon_link.txt.py (limited to 'helpers') diff --git a/helpers/make_icon_link.txt.py b/helpers/make_icon_link.txt.py new file mode 100755 index 0000000000..e5ef3d2ee8 --- /dev/null +++ b/helpers/make_icon_link.txt.py @@ -0,0 +1,51 @@ +#!/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(sys.argv[1], "r") + +except IOError: + print "There was an error reading", file_icon + sys.exit() +try: + # open file stream + file_xsl = open(sys.argv[2], "w+") + +except IOError: + print "There was an error writing", file_xsl + sys.exit() + +file_xsl.write('\n'); +file_xsl.write('\n'); +file_xsl.write('\n'); +file_xsl.write('\n'); +file_xsl.write('\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].replace(".png",".svg"); + file_xsl.write(''+ b + '\n'); + +file_xsl.write('\n'); +file_xsl.write('\n'); +file_xsl.write('\n'); +file_xsl.write('\n'); + +file_xsl.close() +file_icon.close() +sys.exit() -- cgit