Previous changeset 0:8a18547725cf (2020-03-31) Next changeset 2:95a9dc82fc9a (2021-02-03) |
Commit message:
"planemo upload for repository https://github.com/bgruening/galaxytools/tree/master/tools/diff commit d1ef0f3da4118bf352c5acf720f277fc5ef07665" |
modified:
diff.xml |
added:
template.html |
b |
diff -r 8a18547725cf -r 02dfbbf869d8 diff.xml --- a/diff.xml Tue Mar 31 16:36:28 2020 -0400 +++ b/diff.xml Tue Apr 14 13:56:01 2020 -0400 |
[ |
@@ -1,9 +1,10 @@ -<tool id="diff" name="diff" version="3.6+galaxy0"> +<tool id="diff" name="diff" version="3.6+galaxy1"> - <description>analyzes two files and generates a text file with information about the lines that are different</description> + <description>analyzes two files and generates an unidiff text file with information about the differences and an optional Html report</description> <requirements> <requirement type="package" version="3.6">diffutils</requirement> + <requirement type="package" version="4.7">sed</requirement> </requirements> <stdio> @@ -12,33 +13,49 @@ </stdio> <command ><![CDATA[ - diff -u '$input1' '$input2' > '$output1' + diff -u '$input1' '$input2' > '$diff_file'; + #if $generate_report: + sed -e 's/@@title@@/Diff report for '$input1.element_identifier' and '$input2.element_identifier'/g' + -e 's/@@outputformat@@/'$output_format'/g' + -e '/@@diffoutput@@/{r'$diff_file'' -e ';d}' + '$__tool_directory__/template.html' > '$html_file' + #end if ]]> </command> <inputs> <param name="input1" type="data" format="txt" label="First input file" /> <param name="input2" type="data" format="txt" label="Second input file" /> + <param name="generate_report" type="boolean" checked="true" truevalue="true" falsevalue="false" label="Generate HTML report" help="Generates an HTML report to visualize the differences"/> + <param name="output_format" type="select" label="Choose report output format" help="Displays the differences in the report using the selected format. Either line by line or side by side."> + <option value="side-by-side">Side by side</option> + <option value="line-by-line">Line by line</option> + </param> </inputs> <outputs> - <data name="output1" format="txt" /> + <data format="txt" name="diff_file" from_work_dir="output.txt" label="${tool.name} on ${on_string}: Raw Output" /> + <data format="html" name="html_file" from_work_dir="output.html" label="${tool.name} on ${on_string}: Html Report"> + <filter>generate_report is True</filter> + </data> </outputs> <tests> - <test expect_exit_code="0" expect_failure="false"> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="1"> <param name="input1" value="file1.txt" /> <param name="input2" value="file1.txt" /> - <output name="output1"> + <param name="generate_report" value="false" /> + <output name="diff_file"> <assert_contents> <has_n_lines n="0" /> </assert_contents> </output> </test> - <test expect_exit_code="1" expect_failure="false"> + <test expect_exit_code="1" expect_failure="false" expect_num_outputs="1"> <param name="input1" value="file1.txt" /> <param name="input2" value="file2.txt" /> - <output name="output1"> + <param name="generate_report" value="false" /> + <output name="diff_file"> <assert_contents> <has_n_lines n="5" /> <has_line line=" a" /> @@ -46,6 +63,40 @@ </assert_contents> </output> </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + </assert_contents> + </output> + </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <param name="output_format" value="side-by-side" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + <has_text text="side-by-side" /> + </assert_contents> + </output> + </test> + <test expect_exit_code="0" expect_failure="false" expect_num_outputs="2"> + <param name="input1" value="file1.txt" /> + <param name="input2" value="file2.txt" /> + <param name="generate_report" value="true" /> + <param name="output_format" value="line-by-line" /> + <output name="html_file"> + <assert_contents> + <has_text text="!DOCTYPE html" /> + <has_text text="line-by-line" /> + </assert_contents> + </output> + </test> </tests> <help><![CDATA[ @@ -69,11 +120,13 @@ **Output** -A *single text file*, either: +A *text file*, either: - containing the lines differences in **unified format** (*unidiff*), - or an **empty** file if the two input files are the same. + +An **optional** *HTML report* with a friendlier visual representation of the differences. ]]> </help> @@ -87,5 +140,23 @@ url = {http://www.gnu.org/software/diffutils/}, } </citation> + <citation type="bibtex"> + @misc{diff2html, + author = {Rodrigo Fernandes}, + year = {2014}, + title = {Pretty diff to html javascript library (diff2html)}, + publisher = {Github}, + url = {https://github.com/rtfpessoa/diff2html}, + } + </citation> + <citation type="bibtex"> + @misc{sed, + author = {The Free Software Foundation (FSF), Inc}, + year = {2017}, + title = {sed (GNU sed)}, + publisher = {The Free Software Foundation (FSF), Inc}, + url = {http://www.gnu.org/software/sed/}, + } + </citation> </citations> </tool> |
b |
diff -r 8a18547725cf -r 02dfbbf869d8 template.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template.html Tue Apr 14 13:56:01 2020 -0400 |
[ |
b'@@ -0,0 +1,524 @@\n+<!DOCTYPE html>\n+<html>\n+\n+<head>\n+ <title>@@title@@</title>\n+\n+ <!-- CSS Syntax highlighting -->\n+ <style>\n+ .hljs {\n+ display: block;\n+ overflow-x: auto;\n+ padding: 0.5em;\n+ color: #333;\n+ background: #f8f8f8\n+ }\n+\n+ .hljs-comment,\n+ .hljs-quote {\n+ color: #998;\n+ font-style: italic\n+ }\n+\n+ .hljs-keyword,\n+ .hljs-selector-tag,\n+ .hljs-subst {\n+ color: #333;\n+ font-weight: bold\n+ }\n+\n+ .hljs-number,\n+ .hljs-literal,\n+ .hljs-variable,\n+ .hljs-template-variable,\n+ .hljs-tag .hljs-attr {\n+ color: #008080\n+ }\n+\n+ .hljs-string,\n+ .hljs-doctag {\n+ color: #d14\n+ }\n+\n+ .hljs-title,\n+ .hljs-section,\n+ .hljs-selector-id {\n+ color: #900;\n+ font-weight: bold\n+ }\n+\n+ .hljs-subst {\n+ font-weight: normal\n+ }\n+\n+ .hljs-type,\n+ .hljs-class .hljs-title {\n+ color: #458;\n+ font-weight: bold\n+ }\n+\n+ .hljs-tag,\n+ .hljs-name,\n+ .hljs-attribute {\n+ color: #000080;\n+ font-weight: normal\n+ }\n+\n+ .hljs-regexp,\n+ .hljs-link {\n+ color: #009926\n+ }\n+\n+ .hljs-symbol,\n+ .hljs-bullet {\n+ color: #990073\n+ }\n+\n+ .hljs-built_in,\n+ .hljs-builtin-name {\n+ color: #0086b3\n+ }\n+\n+ .hljs-meta {\n+ color: #999;\n+ font-weight: bold\n+ }\n+\n+ .hljs-deletion {\n+ background: #fdd\n+ }\n+\n+ .hljs-addition {\n+ background: #dfd\n+ }\n+\n+ .hljs-emphasis {\n+ font-style: italic\n+ }\n+\n+ .hljs-strong {\n+ font-weight: bold\n+ }\n+ </style>\n+\n+ <style>\n+ .d2h-wrapper {\n+ text-align: left\n+ }\n+\n+ .d2h-file-header {\n+ height: 35px;\n+ padding: 5px 10px;\n+ border-bottom: 1px solid #d8d8d8;\n+ background-color: #f7f7f7\n+ }\n+\n+ .d2h-file-stats {\n+ display: -webkit-box;\n+ display: -ms-flexbox;\n+ display: flex;\n+ margin-left: auto;\n+ font-size: 14px\n+ }\n+\n+ .d2h-lines-added {\n+ text-align: right;\n+ border: 1px solid #b4e2b4;\n+ border-radius: 5px 0 0 5px;\n+ color: #399839;\n+ padding: 2px;\n+ vertical-align: middle\n+ }\n+\n+ .d2h-lines-deleted {\n+ text-align: left;\n+ border: 1px solid #e9aeae;\n+ border-radius: 0 5px 5px 0;\n+ color: #c33;\n+ padding: 2px;\n+ vertical-align: middle;\n+ margin-left: 1px\n+ }\n+\n+ .d2h-file-name-wrapper {\n+ display: -webkit-box;\n+ display: -ms-flexbox;\n+ display: flex;\n+ -webkit-box-align: center;\n+ -ms-flex-align: center;\n+ align-items: center;\n+ width: 100%;\n+ font-family: Source Sans Pro, Helvetica Neue, Helvetica, Arial, sans-serif;\n+ font-size: 15px\n+ }\n+\n+ .d2h-file-name {\n+ white-space: nowrap;\n+ text-overflow: ellipsis;\n+ overflow-x: hidden\n+ }\n+\n+ .d2h-file-wrapper {\n+ border: 1px solid #ddd;\n+ border-radius: 3px;\n+ margin-bottom: 1em\n+ }\n+\n+ .d2h-diff-table {\n+ width: 100%;\n+ border-collapse: collapse;\n+ font-family: Menlo, Consolas, monospace;\n+ font-size: 13px\n+ }\n+\n+ .d2h-files-diff {\n+ display: block;\n+ width: 100%;\n+ height: 100%\n+ }\n+\n+ .d2h-file-diff {\n+ '..b'), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["line-by-line-numbers"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<div class="line-num1">\'), a.b(a.v(a.f("oldNumber", e, t, 0))), a.b("</div>"), a.b("\\n" + n), a.b(\'<div class="line-num2">\'), a.b(a.v(a.f("newNumber", e, t, 0))), a.b("</div>"), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["side-by-side-file-diff"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<div id="\'), a.b(a.v(a.f("fileHtmlId", e, t, 0))), a.b(\'" class="d2h-file-wrapper" data-lang="\'), a.b(a.v(a.d("file.language", e, t, 0))), a.b(\'">\'), a.b("\\n" + n), a.b(\' <div class="d2h-file-header">\'), a.b("\\n" + n), a.b(" "), a.b(a.t(a.f("filePath", e, t, 0))), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b(\' <div class="d2h-files-diff">\'), a.b("\\n" + n), a.b(\' <div class="d2h-file-side-diff">\'), a.b("\\n" + n), a.b(\' <div class="d2h-code-wrapper">\'), a.b("\\n" + n), a.b(\' <table class="d2h-diff-table">\'), a.b("\\n" + n), a.b(\' <tbody class="d2h-diff-tbody">\'), a.b("\\n" + n), a.b(" "), a.b(a.t(a.d("diffs.left", e, t, 0))), a.b("\\n" + n), a.b(" </tbody>"), a.b("\\n" + n), a.b(" </table>"), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b(\' <div class="d2h-file-side-diff">\'), a.b("\\n" + n), a.b(\' <div class="d2h-code-wrapper">\'), a.b("\\n" + n), a.b(\' <table class="d2h-diff-table">\'), a.b("\\n" + n), a.b(\' <tbody class="d2h-diff-tbody">\'), a.b("\\n" + n), a.b(" "), a.b(a.t(a.d("diffs.right", e, t, 0))), a.b("\\n" + n), a.b(" </tbody>"), a.b("\\n" + n), a.b(" </table>"), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b(" </div>"), a.b("\\n" + n), a.b("</div>"), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["tag-file-added"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<span class="d2h-tag d2h-added d2h-added-tag">ADDED</span>\'), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["tag-file-changed"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<span class="d2h-tag d2h-changed d2h-changed-tag">CHANGED</span>\'), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["tag-file-deleted"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<span class="d2h-tag d2h-deleted d2h-deleted-tag">DELETED</span>\'), a.fl() }, partials: {}, subs: {} }), t.defaultTemplates["tag-file-renamed"] = new i.Template({ code: function (e, t, n) { var a = this; return a.b(n = n || ""), a.b(\'<span class="d2h-tag d2h-moved d2h-moved-tag">RENAMED</span>\'), a.fl() }, partials: {}, subs: {} }) }])\n+ }));\n+ </script>\n+\n+</head>\n+\n+<body>\n+ <header>\n+ <h1>@@title@@</h1>\n+ </header>\n+\n+ <div id="myDiffElement"></div>\n+\n+ <footer>\n+ <p>Generated by <a href="https://galaxyproject.org/use/" target="_blank">Galaxy</a></p>\n+ </footer>\n+\n+ <script>\n+ document.addEventListener(\'DOMContentLoaded\', () => {\n+ const diffString = `\n+ @@diffoutput@@\n+ `;\n+ const targetElement = document.getElementById(\'myDiffElement\');\n+ const configuration =\n+ {\n+ inputFormat: \'json\',\n+ drawFileList: false,\n+ matching: \'lines\',\n+ highlight: true,\n+ outputFormat: \'@@outputformat@@\'\n+ };\n+ const diff2htmlUi = new Diff2HtmlUI(targetElement, diffString, configuration);\n+ diff2htmlUi.draw();\n+ diff2htmlUi.highlightCode();\n+ });\n+ </script>\n+</body>\n+\n+</html>\n\\ No newline at end of file\n' |