changeset 0:6423c038695d

First commit
author Vimalkumar Velayudhan <vimal@biotechcoder.com>
date Fri, 03 Jul 2015 11:59:29 +0100
parents
children da900b5a0bda
files html_export.py html_export.xml
diffstat 2 files changed, 59 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/html_export.py	Fri Jul 03 11:59:29 2015 +0100
@@ -0,0 +1,36 @@
+# -*- coding: utf-8 -*-
+import os
+import argparse
+
+parser = argparse.ArgumentParser(
+    description='Create a HTML output file with link to a sample text file')
+parser.add_argument('--html_file', default='html_export.html')
+parser.add_argument('--output_path', default=os.getcwd())
+args = parser.parse_args()
+
+html = """\
+<!DOCTYPE html>
+<html lang="en">
+<head>
+    <meta charset="utf-8">
+    <title>HTML export</title>
+ </head>
+<body>
+<h3>HTML output file with link to sample text file</h3>
+<p>Download: {content}</p>
+</body>
+</html>
+
+"""
+
+# create output directory
+os.mkdir(args.output_path)
+
+# create the text file with content
+with open(os.path.join(args.output_path, 'paths.txt'), 'w') as f:
+    paths = os.environ['PATH'].split(':')
+    f.write('\n'.join(paths))
+
+# write html file
+with open(args.html_file, 'w') as g:
+    g.write(html.format(content='<a href="paths.txt">paths.txt</a>'))
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/html_export.xml	Fri Jul 03 11:59:29 2015 +0100
@@ -0,0 +1,23 @@
+<tool id="html_export" name="html_export" version="0.1.0">
+    <description>Create a HTML output file with link to a sample text file
+    </description>
+    <stdio>
+        <exit_code range="1:"  level="fatal" description="Error" />
+    </stdio>
+    <command interpreter="python">html_export.py
+    --html_file "${html_file}"
+    --output_path "${html_file.files_path}"
+    </command>
+    <outputs>
+        <data format="html" name="html_file" label="Test HTML export"/>
+    </outputs>
+    <help>
+Test HTML export with included files
+------------------------------------
+This is a simple tool to test HTML export with attachments as described in the
+`wiki &lt;https://wiki.galaxyproject.org/Admin/Tools/Multiple Output Files&gt;`_
+
+The output will be a HTML file with link to a sample text file.
+
+</help>
+</tool>
\ No newline at end of file