Next changeset 1:da03e96d1939 (2016-09-23) |
Commit message:
planemo upload for repository https://github.com/galaxyproject/tools-iuc/tree/master/tools/weather_app commit daa27cb2061f0d1cfd0f9bdc55e7073c2543f719 |
added:
ansi2html.sh simple_weather.xml test-data/Moon@1986-Oct-06 |
b |
diff -r 000000000000 -r d2dd051f072b ansi2html.sh --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/ansi2html.sh Tue Jul 19 11:55:14 2016 -0400 |
[ |
b'@@ -0,0 +1,514 @@\n+#!/bin/sh\n+\n+# Convert ANSI (terminal) colours and attributes to HTML\n+\n+# Licence: LGPLv2\n+# Author:\n+# http://www.pixelbeat.org/docs/terminal_colours/\n+# Examples:\n+# ls -l --color=always | ansi2html.sh > ls.html\n+# git show --color | ansi2html.sh > last_change.html\n+# Generally one can use the `script` util to capture full terminal output.\n+# Changes:\n+# V0.1, 24 Apr 2008, Initial release\n+# V0.2, 01 Jan 2009, Phil Harnish <philharnish@gmail.com>\n+# Support `git diff --color` output by\n+# matching ANSI codes that specify only\n+# bold or background colour.\n+# P@draigBrady.com\n+# Support `ls --color` output by stripping\n+# redundant leading 0s from ANSI codes.\n+# Support `grep --color=always` by stripping\n+# unhandled ANSI codes (specifically ^[[K).\n+# V0.3, 20 Mar 2009, http://eexpress.blog.ubuntu.org.cn/\n+# Remove cat -v usage which mangled non ascii input.\n+# Cleanup regular expressions used.\n+# Support other attributes like reverse, ...\n+# P@draigBrady.com\n+# Correctly nest <span> tags (even across lines).\n+# Add a command line option to use a dark background.\n+# Strip more terminal control codes.\n+# V0.4, 17 Sep 2009, P@draigBrady.com\n+# Handle codes with combined attributes and color.\n+# Handle isolated <bold> attributes with css.\n+# Strip more terminal control codes.\n+# V0.23, 28 Feb 2016\n+# http://github.com/pixelb/scripts/commits/master/scripts/ansi2html.sh\n+\n+gawk --version >/dev/null || exit 1\n+\n+if [ "$1" = "--version" ]; then\n+ printf \'0.23\\n\' && exit\n+fi\n+\n+usage()\n+{\n+printf \'%s\\n\' \\\n+\'This utility converts ANSI codes in data passed to stdin\n+It has 4 optional parameters:\n+--bg=dark --palette=linux|solarized|tango|xterm --css-only|--body-only\n+E.g.: ls -l --color=always | ansi2html.sh --bg=dark > ls.html\' >&2\n+ exit\n+}\n+\n+if [ "$1" = "--help" ]; then\n+ usage\n+fi\n+\n+processArg()\n+{\n+ [ "$1" = "--bg=dark" ] && { dark_bg=yes; return; }\n+ [ "$1" = "--css-only" ] && { css_only=yes; return; }\n+ [ "$1" = "--body-only" ] && { body_only=yes; return; }\n+ if [ "$1" = "--palette=solarized" ]; then\n+ # See http://ethanschoonover.com/solarized\n+ P0=073642; P1=D30102; P2=859900; P3=B58900;\n+ P4=268BD2; P5=D33682; P6=2AA198; P7=EEE8D5;\n+ P8=002B36; P9=CB4B16; P10=586E75; P11=657B83;\n+ P12=839496; P13=6C71C4; P14=93A1A1; P15=FDF6E3;\n+ return;\n+ elif [ "$1" = "--palette=solarized-xterm" ]; then\n+ # Above mapped onto the xterm 256 color palette\n+ P0=262626; P1=AF0000; P2=5F8700; P3=AF8700;\n+ P4=0087FF; P5=AF005F; P6=00AFAF; P7=E4E4E4;\n+ P8=1C1C1C; P9=D75F00; P10=585858; P11=626262;\n+ P12=808080; P13=5F5FAF; P14=8A8A8A; P15=FFFFD7;\n+ return;\n+ elif [ "$1" = "--palette=tango" ]; then\n+ # Gnome default\n+ P0=000000; P1=CC0000; P2=4E9A06; P3=C4A000;\n+ P4=3465A4; P5=75507B; P6=06989A; P7=D3D7CF;\n+ P8=555753; P9=EF2929; P10=8AE234; P11=FCE94F;\n+ P12=729FCF; P13=AD7FA8; P14=34E2E2; P15=EEEEEC;\n+ return;\n+ elif [ "$1" = "--palette=xterm" ]; then\n+ P0=000000; P1=CD0000; P2=00CD00; P3=CDCD00;\n+ P4=0000EE; P5=CD00CD; P6=00CDCD; P7=E5E5E5;\n+ P8=7F7F7F; P9=FF0000; P10=00FF00; P11=FFFF00;\n+ P12=5C5CFF; P13=FF00FF; P14=00FFFF; P15=FFFFFF;\n+ return;\n+ else # linux console\n+ P0=000000; P1=AA0000; P2=00AA00; P3=AA5500;\n+ P4=0000AA; P5=AA00AA; P6=00AAAA; P7=AAAAAA;\n+ P8=555555; P9=FF5555; P10=55FF55; P11=FFFF55;\n+ P12=5555FF; P13=FF55FF; P14=55FFFF; P15=FFFFFF;\n'..b' sc=c\n+ state=2\n+ continue\n+ }\n+ else if(c=="\\b") {\n+ # backspace move insertion point back 1\n+ if(spc) attr[x,y]=atos(span)\n+ x=x>1?x-1:1\n+ continue\n+ }\n+ else if(c=="\\"") {\n+ split(substr(string,i+2),cord,";")\n+ cc=substr(string,i+1,1);\n+ if(cc=="T") {\n+ # Transliterate on/off\n+ if(cord[1]==1&&state==3) last_mode=state=4\n+ if(cord[1]==0&&state==4) last_mode=state=3\n+ }\n+ else if(cc=="C") {\n+ # Clear\n+ if(cord[1]+0) {\n+ # Screen - if Recording dump screen\n+ if(dumpStatus==dsActive) ret=ret dump_screen()\n+ dumpStatus=dsActive\n+ delete dump\n+ delete attr\n+ x=y=1\n+ } else {\n+ # To end of line\n+ for(pos=x;pos<maxX;pos++) {\n+ dump[pos,y]=" "\n+ if (!spc) delete attr[pos,y]\n+ else attr[pos,y]=atos(span)\n+ }\n+ }\n+ }\n+ else if(cc=="J") {\n+ # Jump to x,y\n+ i+=length(cord[2])+1\n+ # If line is higher - dump previous screen\n+ if(dumpStatus==dsActive&&cord[1]<y) {\n+ ret=ret dump_screen();\n+ dumpStatus=dsNew;\n+ }\n+ x=cord[2]\n+ if(length(cord[1]) && y!=cord[1]){\n+ y=cord[1]\n+ if(y>maxY) maxY=y\n+ # Change y - start recording\n+ dumpStatus=dumpStatus?dumpStatus:dsReset\n+ }\n+ }\n+ else if(cc=="M") {\n+ # Move left/right on current line\n+ x+=cord[1]\n+ }\n+ else if(cc=="X") {\n+ # delete on right\n+ for(pos=x;pos<=maxX;pos++) {\n+ nx=pos+cord[1]\n+ if(nx<maxX) {\n+ if((nx SUBSEP y) in attr) attr[pos,y] = attr[nx,y]\n+ else delete attr[pos,y]\n+ if((nx SUBSEP y) in dump) dump[pos,y] = dump[nx,y]\n+ else delete dump[pos,y]\n+ } else if(spc) {\n+ attr[pos,y]=atos(span)\n+ dump[pos,y]=" "\n+ }\n+ }\n+ }\n+ else if(cc=="R") {\n+ # Reset attributes\n+ while(spc) delete span[spc--]\n+ }\n+ i+=length(cord[1])+2\n+ continue\n+ }\n+ else if(state==4&&i>=start&&i<=end&&c in Trans) c=Trans[c]\n+ }\n+ if(dumpStatus==dsReset) {\n+ delete dump\n+ delete attr\n+ ret=ret"\\n"\n+ dumpStatus=dsActive\n+ }\n+ if(dumpStatus==dsNew) {\n+ # After moving/clearing we are now ready to write\n+ # somthing to the screen so start recording now\n+ ret=ret"\\n"\n+ dumpStatus=dsActive\n+ }\n+ if(dumpStatus==dsActive||dumpStatus==dsOff) {\n+ dump[x,y] = c\n+ if(!spc) delete attr[x,y]\n+ else attr[x,y] = atos(span)\n+ if(++x>maxX) maxX=x;\n+ }\n+ }\n+ # End of line if dumping increment y and set x back to first col\n+ x=1\n+ if(!dumpStatus) return ret dump_line(y,1);\n+ else if(++y>maxY) maxY=y;\n+ return ret\n+}\n+BEGIN{\n+ OFS=FS\n+ # dump screen status\n+ dsOff=0 # Not dumping screen contents just write output direct\n+ dsNew=1 # Just after move/clear waiting for activity to start recording\n+ dsReset=2 # Screen cleared build new empty buffer and record\n+ dsActive=3 # Currently recording\n+ F="abcdefghijklmnopqrstuvwxyz{}`~"\n+ T="\xe2\x96\x92\xe2\x90\x89\xe2\x90\x8c\xe2\x90\x8d\xe2\x90\x8a\xc2\xb0\xc2\xb1\xe2\x90\xa4\xe2\x90\x8b\xe2\x94\x98\xe2\x94\x90\xe2\x94\x8c\xe2\x94\x94\xe2\x94\xbc\xe2\x8e\xba\xe2\x8e\xbb\xe2\x94\x80\xe2\x8e\xbc\xe2\x8e\xbd\xe2\x94\x9c\xe2\x94\xa4\xe2\x94\xb4\xe2\x94\xac\xe2\x94\x82\xe2\x89\xa4\xe2\x89\xa5\xcf\x80\xc2\xa3\xe2\x97\x86\xc2\xb7"\n+ maxX=80\n+ delete cur;\n+ x=y=1\n+ for(i=1;i<=length(F);i++)Trans[substr(F,i,1)]=substr(T,i,1);\n+}\n+\n+{ $0=encode($0) }\n+1\n+END {\n+ if(dumpStatus) {\n+ print dump_screen();\n+ }\n+}\'\n+)\n+\n+[ "$body_only" ] || printf \'</pre>\n+</body>\n+</html>\\n\'\n' |
b |
diff -r 000000000000 -r d2dd051f072b simple_weather.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simple_weather.xml Tue Jul 19 11:55:14 2016 -0400 |
[ |
@@ -0,0 +1,74 @@ +<tool id="simple_weather" name="SimpleWeather" version="0.1.0"> + <requirements> + <requirement type="package" version="7.45.0">curl</requirement> + <requirement type="package" version="4.1.3">gawk</requirement> + </requirements> + <stdio> + <exit_code range="1:" /> + </stdio> + <command><![CDATA[ + curl 'http://wttr.in/$place$units' 2>/dev/null | sh $__tool_directory__/ansi2html.sh >> '$out_file1'; + ]]></command> + <inputs> + <param name="place" label="Select a place, us-zip code, airport shortcut, webpage, or moon (with optional date)" type="text" value="Bloomington" help="webpages need a '@' sign in front to run see help for more information"> + <sanitizer sanitize="False"/> + </param> + <param name="units" label="Units" type="select" > + <sanitizer sanitize="False"/> + <option value="?m" selected="true">metric (SI)</option> + <option value="?u">non-metric (USCS)</option> + </param> + </inputs> + <outputs> + <data format="html" name="out_file1" label="${tool.name}: ${place}"/> + </outputs> + <tests> + <test> + <param name="place" value="Moon@1986-Oct-06"/> + <output name="output1"> + <assert_contents> + <has_text_matching expression="N.*e.*w.* .*M.*o.*o.*n.* .*\+" /> + <has_text_matching expression="2.* .* .*2.*:.*0.*5.*:.*5.*1" /> + <has_text_matching expression="4.* .*1.*6.*:.*2.*9.*:.*5.*6" /> + </assert_contents> + </output> + </test> + </tests> + <help><![CDATA[ +HELP: +----- +Supported location types: +------------------------- +:: + + "" # current location (ip adress) + paris # city name + muc # airport code (3 letters) + @stackoverflow.com # domain name + 94107 # area codes (us only) + +Special locations: +------------------- +:: + + moon # Moon phase (add ,+US or ,+France for these cities) + moon@1999-Oct-02 # Moon phase on a particular date + + + +--- wrapped by Aarif Mohamed Nazeer Batcha and Jochen Bick --- + + ]]></help> + <citations> + <citation type="bibtex"> +@misc{githubwttr.in, + author = {chubin}, + year = {2015}, + title = {wttr.in}, + publisher = {GitHub}, + journal = {GitHub repository}, + url = {https://github.com/chubin/wttr.in}, +}</citation> + </citations> + +</tool> \ No newline at end of file |
b |
diff -r 000000000000 -r d2dd051f072b test-data/Moon@1986-Oct-06 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/test-data/Moon@1986-Oct-06 Tue Jul 19 11:55:14 2016 -0400 |
b |
b'@@ -0,0 +1,326 @@\n+<html>\n+<head>\n+<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>\n+<style type="text/css">\n+.ef0,.f0 { color: #000000; } .eb0,.b0 { background-color: #000000; }\n+.ef1,.f1 { color: #AA0000; } .eb1,.b1 { background-color: #AA0000; }\n+.ef2,.f2 { color: #00AA00; } .eb2,.b2 { background-color: #00AA00; }\n+.ef3,.f3 { color: #AA5500; } .eb3,.b3 { background-color: #AA5500; }\n+.ef4,.f4 { color: #0000AA; } .eb4,.b4 { background-color: #0000AA; }\n+.ef5,.f5 { color: #AA00AA; } .eb5,.b5 { background-color: #AA00AA; }\n+.ef6,.f6 { color: #00AAAA; } .eb6,.b6 { background-color: #00AAAA; }\n+.ef7,.f7 { color: #AAAAAA; } .eb7,.b7 { background-color: #AAAAAA; }\n+.ef8, .f0 > .bold,.bold > .f0 { color: #555555; font-weight: normal; }\n+.ef9, .f1 > .bold,.bold > .f1 { color: #FF5555; font-weight: normal; }\n+.ef10,.f2 > .bold,.bold > .f2 { color: #55FF55; font-weight: normal; }\n+.ef11,.f3 > .bold,.bold > .f3 { color: #FFFF55; font-weight: normal; }\n+.ef12,.f4 > .bold,.bold > .f4 { color: #5555FF; font-weight: normal; }\n+.ef13,.f5 > .bold,.bold > .f5 { color: #FF55FF; font-weight: normal; }\n+.ef14,.f6 > .bold,.bold > .f6 { color: #55FFFF; font-weight: normal; }\n+.ef15,.f7 > .bold,.bold > .f7 { color: #FFFFFF; font-weight: normal; }\n+.eb8 { background-color: #555555; }\n+.eb9 { background-color: #FF5555; }\n+.eb10 { background-color: #55FF55; }\n+.eb11 { background-color: #FFFF55; }\n+.eb12 { background-color: #5555FF; }\n+.eb13 { background-color: #FF55FF; }\n+.eb14 { background-color: #55FFFF; }\n+.eb15 { background-color: #FFFFFF; }\n+.ef16 { color: #000000; } .eb16 { background-color: #000000; }\n+.ef17 { color: #00005f; } .eb17 { background-color: #00005f; }\n+.ef18 { color: #000087; } .eb18 { background-color: #000087; }\n+.ef19 { color: #0000af; } .eb19 { background-color: #0000af; }\n+.ef20 { color: #0000d7; } .eb20 { background-color: #0000d7; }\n+.ef21 { color: #0000ff; } .eb21 { background-color: #0000ff; }\n+.ef22 { color: #005f00; } .eb22 { background-color: #005f00; }\n+.ef23 { color: #005f5f; } .eb23 { background-color: #005f5f; }\n+.ef24 { color: #005f87; } .eb24 { background-color: #005f87; }\n+.ef25 { color: #005faf; } .eb25 { background-color: #005faf; }\n+.ef26 { color: #005fd7; } .eb26 { background-color: #005fd7; }\n+.ef27 { color: #005fff; } .eb27 { background-color: #005fff; }\n+.ef28 { color: #008700; } .eb28 { background-color: #008700; }\n+.ef29 { color: #00875f; } .eb29 { background-color: #00875f; }\n+.ef30 { color: #008787; } .eb30 { background-color: #008787; }\n+.ef31 { color: #0087af; } .eb31 { background-color: #0087af; }\n+.ef32 { color: #0087d7; } .eb32 { background-color: #0087d7; }\n+.ef33 { color: #0087ff; } .eb33 { background-color: #0087ff; }\n+.ef34 { color: #00af00; } .eb34 { background-color: #00af00; }\n+.ef35 { color: #00af5f; } .eb35 { background-color: #00af5f; }\n+.ef36 { color: #00af87; } .eb36 { background-color: #00af87; }\n+.ef37 { color: #00afaf; } .eb37 { background-color: #00afaf; }\n+.ef38 { color: #00afd7; } .eb38 { background-color: #00afd7; }\n+.ef39 { color: #00afff; } .eb39 { background-color: #00afff; }\n+.ef40 { color: #00d700; } .eb40 { background-color: #00d700; }\n+.ef41 { color: #00d75f; } .eb41 { background-color: #00d75f; }\n+.ef42 { color: #00d787; } .eb42 { background-color: #00d787; }\n+.ef43 { color: #00d7af; } .eb43 { background-color: #00d7af; }\n+.ef44 { color: #00d7d7; } .eb44 { background-color: #00d7d7; }\n+.ef45 { color: #00d7ff; } .eb45 { background-color: #00d7ff; }\n+.ef46 { color: #00ff00; } .eb46 { background-color: #00ff00; }\n+.ef47 { color: #00ff5f; } .eb47 { background-color: #00ff5f; }\n+.ef48 { color: #00ff87; } .eb48 { background-color: #00ff87; }\n+.ef49 { color: #00ffaf; } .eb49 { background-color: #00ffaf; }\n+.ef50 { color: #00ffd7; } .eb50 { background-color: #00ffd7; }\n+.ef51 { color: #00ffff; } .eb51 { background-color: #00ffff; }\n+.ef52 { color: #5f0000; } .eb52 { background-color: #5f0000; }\n+.ef53 { color: #5f005f; } .eb53 { background-color: #5f005f; '..b'8"> </span><span class="ef84"> </span><span class="ef83"> @ \\\t</span><span class="ef119"> </span><span class="ef118">New Moon </span><span class="ef154">+ </span>\n+<span class="ef39"> </span><span class="ef38"> </span><span class="ef44"> </span><span class="ef43"> </span><span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118">|\t 2 2:0</span><span class="ef154">5:51</span>\n+<span class="ef44"> </span><span class="ef43"> </span><span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118">@ |\t Fir</span><span class="ef154">st Quarter</span><span class="ef148"> </span><span class="ef184">-</span>\n+<span class="ef44"> </span><span class="ef43"> </span><span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> @ |\t </span><span class="ef154">4 16:29:56</span>\n+<span class="ef44"> </span><span class="ef43"> </span><span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> o </span><span class="ef154">/\t </span>\n+<span class="ef44"> </span><span class="ef43"> </span><span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> |\t </span>\n+<span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> . /\t </span>\n+<span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> /\t </span>\n+<span class="ef49"> </span><span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> . /\'</span><span class="ef148">\t</span><span class="ef184"> </span>\n+<span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> \' </span><span class="ef148">/</span><span class="ef184">\t </span>\n+<span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> </span><span class="ef148">.</span><span class="ef184">-\'\t </span>\n+<span class="ef48"> </span><span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> </span><span class="ef148"> </span><span class="ef184">-\'\t </span>\n+<span class="ef84"> </span><span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> </span><span class="ef148"> </span><span class="ef184">-\'\t </span>\n+<span class="ef83"> </span><span class="ef119"> </span><span class="ef118"> </span><span class="ef154"> </span><span class="ef148">-</span><span class="ef184">\'\t </span>\n+\n+\n+Check new Feature: <span class="f2"><span class="bold">wttr.in/Moon</span></span> or <span class="f2"><span class="bold">wttr.in/Moon@2016-Mar-23</span></span> to see the phase of the Moon\n+Follow <span class="f0 b6">@igor_chubin</span> for wttr.in updates\n+</pre>\n+</body>\n+</html>\n' |