diff options
author | Jan Holesovsky <kendy@collabora.com> | 2014-06-05 08:56:48 +0200 |
---|---|---|
committer | Jan Holesovsky <kendy@collabora.com> | 2014-06-05 09:01:02 +0200 |
commit | d595e5ec4e092344460f53d287b970c147913e99 (patch) | |
tree | c54235849ade6aa702c5047667303d316122e0a8 /writerfilter | |
parent | e0057072817ccad2a54eca45ffdb84d1c99ee7a7 (diff) |
writerfilter: Avoid a temporary file, sed can handle this by itself.
Change-Id: I7fde1b44809b1886730145f16878e0f1045b2555
Diffstat (limited to 'writerfilter')
-rw-r--r-- | writerfilter/CustomTarget_source.mk | 9 | ||||
-rwxr-xr-x | writerfilter/source/ooxml/tokens-to-xml.sed | 19 | ||||
-rw-r--r-- | writerfilter/source/ooxml/tokenxmlfooter | 1 | ||||
-rw-r--r-- | writerfilter/source/ooxml/tokenxmlheader | 1 |
4 files changed, 21 insertions, 9 deletions
diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk index 249ebca5b6bb..98da398ceea1 100644 --- a/writerfilter/CustomTarget_source.mk +++ b/writerfilter/CustomTarget_source.mk @@ -70,7 +70,6 @@ writerfilter_GEN_ooxml_Namespacesmap_xsl=$(writerfilter_WORK)/namespacesmap.xsl writerfilter_GEN_ooxml_Preprocess_xsl=$(writerfilter_WORK)/modelpreprocess.xsl writerfilter_GEN_ooxml_QNameToStr_cxx=$(writerfilter_WORK)/ooxml/qnametostr.cxx writerfilter_GEN_ooxml_ResourceIds_hxx=$(writerfilter_WORK)/ooxml/resourceids.hxx -writerfilter_GEN_ooxml_Token_tmp=$(writerfilter_WORK)/token.tmp writerfilter_GEN_ooxml_Token_xml=$(writerfilter_WORK)/token.xml writerfilter_SRC_model_NamespacePreprocess=$(writerfilter_SRC)/resourcemodel/namespace_preprocess.pl writerfilter_SRC_ooxml_Analyze_model_xsl=$(writerfilter_SRC)/ooxml/analyzemodel.xsl @@ -134,15 +133,11 @@ $(writerfilter_GEN_ooxml_ResourceIds_hxx) : $(writerfilter_SRC_ooxml_ResourceIds $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,XSL,1) $(call gb_Helper_abbreviate_dirs, $(writerfilter_XSLTCOMMAND) $(writerfilter_SRC_ooxml_ResourceIds_xsl) $(writerfilter_GEN_ooxml_Model_processed)) > $@ -$(writerfilter_GEN_ooxml_Token_tmp) : $(SRCDIR)/oox/source/token/tokens.txt | $(writerfilter_WORK)/.dir +$(writerfilter_GEN_ooxml_Token_xml) : $(SRCDIR)/oox/source/token/tokens.txt $(writerfilter_SRC)/ooxml/tokens-to-xml.sed | $(writerfilter_WORK)/.dir $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,CAT,1) - sed "s/\(.*\)/<fasttoken>\1<\/fasttoken>/" \ + sed -f $(writerfilter_SRC)/ooxml/tokens-to-xml.sed \ < $(SRCDIR)/oox/source/token/tokens.txt > $@ -$(writerfilter_GEN_ooxml_Token_xml) : $(writerfilter_SRC)/ooxml/tokenxmlheader $(writerfilter_GEN_ooxml_Token_tmp) $(writerfilter_SRC)/ooxml/tokenxmlfooter - $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,CAT,1) - cat $(writerfilter_SRC)/ooxml/tokenxmlheader $(writerfilter_GEN_ooxml_Token_tmp) $(writerfilter_SRC)/ooxml/tokenxmlfooter > $@ - $(writerfilter_WORK)/OOXMLFactory%.cxx : $(writerfilter_SRC)/ooxml/factoryimpl_ns.xsl $(writerfilter_GEN_ooxml_Model_processed) $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),build,XSL,1) $(call gb_Helper_abbreviate_dirs, $(writerfilter_XSLTCOMMAND) --stringparam file $@ $< $(writerfilter_GEN_ooxml_Model_processed)) > $@ diff --git a/writerfilter/source/ooxml/tokens-to-xml.sed b/writerfilter/source/ooxml/tokens-to-xml.sed new file mode 100755 index 000000000000..a45bc6ae165f --- /dev/null +++ b/writerfilter/source/ooxml/tokens-to-xml.sed @@ -0,0 +1,19 @@ +#! /usr/bin/sed -f +# +# 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/. +# + +# first line - insert <model> +1,1i\ +<model> + +# last line - append </model> +$,$a\ +</model> + +# everywhere - replace the input line with <fasttoken>...</fasttoken> +s/\(.*\)/<fasttoken>\1<\/fasttoken>/ diff --git a/writerfilter/source/ooxml/tokenxmlfooter b/writerfilter/source/ooxml/tokenxmlfooter deleted file mode 100644 index 6f664070c0dd..000000000000 --- a/writerfilter/source/ooxml/tokenxmlfooter +++ /dev/null @@ -1 +0,0 @@ -</model> diff --git a/writerfilter/source/ooxml/tokenxmlheader b/writerfilter/source/ooxml/tokenxmlheader deleted file mode 100644 index 25a92439af63..000000000000 --- a/writerfilter/source/ooxml/tokenxmlheader +++ /dev/null @@ -1 +0,0 @@ -<model> |