From e11fca7e6ef36de4e49473b3ff3126678fd41225 Mon Sep 17 00:00:00 2001 From: Olivier Hallot Date: Wed, 6 Oct 2021 12:01:17 -0300 Subject: tdf#140781 Improve Help for Text (encoded) filter options -Regenerated convertfilters.xhp -Added examples from start_parameters.xhp -Updated pyhon script -refactor xml Change-Id: I730aa77b87133701c2beb3efc9559f7145ce15bd Reviewed-on: https://gerrit.libreoffice.org/c/help/+/123150 Tested-by: Jenkins Reviewed-by: Olivier Hallot --- helpers/convertfilters.py | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) (limited to 'helpers') diff --git a/helpers/convertfilters.py b/helpers/convertfilters.py index dcb25af00a..f3d0e7060a 100755 --- a/helpers/convertfilters.py +++ b/helpers/convertfilters.py @@ -11,7 +11,7 @@ # # Run this script followed by the path of instdir/share/registry/ # i.e.: ./convertfilters.py /path/to/source/core/instdir/share/registry -# +# # Requires Python 3.6 or greater. import os @@ -35,9 +35,9 @@ if not os.path.exists(registry_dir): modules = ["writer.xcd","calc.xcd","impress.xcd","draw.xcd","math.xcd","base.xcd","graphicfilter.xcd"] def gen_id(apiname): - '''This function accepts module name and an API Name of the filter, and then generate + '''This function accepts module name and an API Name of the filter, and then generate a unique ID. API Names are used since they are unique within the page. - + Do not use random numbers or sequence-count numbers here since it will cause all words to be "fuzzy" in PO files when the xhp file is regenerated. ''' @@ -45,7 +45,7 @@ def gen_id(apiname): apiname = apiname.replace("(", "_") apiname = apiname.replace(")", "_") apiname = apiname.replace("/", "_") - + return apiname output = ''' @@ -78,10 +78,16 @@ output = ''' - Tables with filter names for command line document conversion. + Tables with filter names for command line document conversion. +

Usage

+Filter names are used when importing and exporting files in alien formats and converting files formats through the command line. +soffice --convert-to OutputFileExtension[:OutputFilterName[:OutputFilterParams[,param]]] [--outdir output_dir] + +soffice --infilter="InputFilterName[:InputFilterParams[,param]]" +--infilter="Text (encoded):UTF8,LF,Liberation Mono,en-US". ''' output += ''' @@ -107,7 +113,7 @@ for module in modules: for filter_node in filternodes: uiname = str(filter_node.findtext('prop[@oor:name="UIName"]/value', namespaces=namespaces)) apiname = filter_node.attrib['{' + namespaces['oor'] + '}name'] - + filter_type = str(filter_node.findtext('prop[@oor:name="Type"]/value', namespaces=namespaces)) type_node = tree.find( f'oor:component-data[@oor:name="Types"]/node/node[@oor:name="{filter_type}"]', @@ -117,11 +123,11 @@ for module in modules: extensions = str(type_node.findtext('prop[@oor:name="Extensions"]/value', namespaces=namespaces)) except AttributeError: continue - + filter_data = [uiname, apiname, mediatype, extensions] print(filter_data) filters.append(filter_data) - + output += f'\
\n\ \n\ @@ -156,13 +162,13 @@ for module in modules: {item[0]}\n\ \n\ \n\ - {item[1]}\n\ + "{item[1]}"\n\ \n\ \n\ {item[2]} ({item[3]})\n\ \n\ \n' - + output += f'\ \n\
\n' -- cgit