changeset 9:6378f8384f30 draft

planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/text_processing/text_processing commit 5d3a6a822897569f22f288589543562f54482418
author bgruening
date Fri, 01 Dec 2017 13:47:28 -0500
parents 4c752559b236
children e39fceb6ab85
files replace_text_in_line.xml
diffstat 1 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/replace_text_in_line.xml	Wed Jul 12 14:07:57 2017 -0400
+++ b/replace_text_in_line.xml	Fri Dec 01 13:47:28 2017 -0500
@@ -1,3 +1,4 @@
+<?xml version="1.0" encoding="UTF-8"?>
 <tool id="tp_replace_in_line" name="Replace Text" version="@BASE_VERSION@.0">
     <description>in entire line</description>
     <macros>
@@ -8,13 +9,25 @@
     </requirements>
     <version_command>sed --version | head -n 1</version_command>
     <command>
+    <!--
+         This looks quite strange but it is intentional. We have used U+0090 as
+         the replacement brackets in the sed expression. This meets multiple requirements for use:
+
+         - is legal entity in XML 1.0 (https://en.wikipedia.org/wiki/Valid_characters_in_XML)
+         - is legal as a sed delimiter character (must be single-byte)
+         - is not in string.printable
+
+         Thus, this should execute properly. Additionally it allows users to
+         use characters like '/' and '\' and '|' in their regex without them
+         being able to prematurely terminate the expression.
+     -->
 <![CDATA[
         sed
             -r
             --sandbox
-            "s/$find_pattern/$replace_pattern/g"
-            "$infile"
-        > "$outfile"
+            's$find_pattern$replace_patterng'
+            '$infile'
+        > '$outfile'
 ]]>
     </command>
     <inputs>