Hello Jesse,
Dam, Jesse van wrote, On 06/19/2012 01:27 PM:
> I found a solution, it seemed that I made a stupid mistake somewhere. But the
> following solution will work to preserve the original text in the edit field.
>
> Add the following to your parameter
>
> [...]
>
> Then I use the following code in ruby to decode it again
> def unescape(val)
> res = ""
> escape = false
> [ ... ]
>
> If you want to preserve tabs you will have to add them, but example should be
> clear on how to do that.
>
Alternatively,
You can use the undocumented "url_paste", "file_data" variables which are never
sanitized (but like all undocumented things - use at your own risk) [1].
Also,
It seems you want to give your use a big text area in which to write
complicated text, a quicker solution might be to use a config file, and in your
ruby script simply read the file - this preserves everything the user entered,
with no extra work required (besides reading the file).
This is a snippet from an AWK tool [2], that allows users to enter long AWK
programs:
===
<command interpreter="sh">awk_wrapper.sh '$input1' '$output'
'$awk_script'</command>
<inputs>
<param format="txt" name="input1" type="data" label="File to process"/>
<param name="url_paste" type="text" area="true" size="5x35" label="AWK
Program" help="" />
</inputs>
<outputs>
<data format="input" name="output" metadata_source="input1"/>
</outputs>
<configfiles>
<configfile name="awk_script">$url_paste</configfile>
</configfiles>
===
Galaxy will create a temporary file (<configfile>) and put whatever the user
entered there - newlines and everything.
-gordon
[1]: undocumented non-sanitized variables:
$ grep NEVER lib/galaxy/util/__init__.py
# is NEVER_SANITIZE required now that sanitizing for tool parameters can be
controlled on a per parameter basis and occurs via InputValueWrappers?
NEVER_SANITIZE = ['file_data', 'url_paste', 'URL', 'filesystem_paths']
if key not in self.NEVER_SANITIZE and True not in [
key.endswith( "|%s" % nonsanitize_parameter ) for nonsanitize_parameter in
self.NEVER_SANITIZE ]: #sanitize check both ungrouped and grouped parameters by
name. Anything relying on NEVER_SANITIZE should be changed to not require this
and NEVER_SANITIZE should be removed
[2] AWK tool:
http://hannonlab.cshl.edu/galaxy_unix_tools/download.html
___________________________________________________________
Please keep all replies on the list by using "reply all"
in your mail client. To manage your subscriptions to this
and other Galaxy lists, please use the interface at:
http://lists.bx.psu.edu/