Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

indentation in CDATA blocks like command and help #43

Open
peterjc opened this issue Jun 7, 2017 · 5 comments
Open

indentation in CDATA blocks like command and help #43

peterjc opened this issue Jun 7, 2017 · 5 comments
Assignees

Comments

@peterjc
Copy link
Contributor

peterjc commented Jun 7, 2017

Cross reference galaxyproject/tools-iuc#1346 (comment) from @nsoranzo

Should we have a recommend style for indenting CDATA blocks? I agree with him that excessive indentation of the command tags is undesirable, and likewise for the RST in the help tags having no extra indentation makes copy/paste to and from an RST editor far easier.

My proposal:

Multiple lines of content should be written as follows (example based on tools/trinotate/trinotate.xml ), aligned starting flush left rather than following the XML containing tag's indentation:

    <command><![CDATA[
#if str($cond_download.select_download) == "yes":
    wget --no-verbose 'https://data.broadinstitute.org/Trinity/Trinotate_v3_RESOURCES/Trinotate_v3.sqlite.gz' -O Trinotate.sqlite.gz &&
    gunzip Trinotate.sqlite.gz &&
#else:
    ln -s '$cond_download.trinotate_sqlite_in' Trinotate.sqlite
#end if

Trinotate Trinotate.sqlite init --gene_trans_map '$gene_trans_map' --transcript_fasta $trinity --transdecoder_pep '$transdecoder' &&
#if $blastp:
    Trinotate Trinotate.sqlite LOAD_swissprot_blastp '$blastp' &&
#end if
#if $blastx:
    Trinotate Trinotate.sqlite LOAD_swissprot_blastx '$blastx' &&
#end if
#if $hmmscan:
    Trinotate Trinotate.sqlite LOAD_pfam '$hmmscan' &&
#end if
#if $tmhmm:
    Trinotate Trinotate.sqlite LOAD_tmhmm '$tmhmm' &&
#end if
#if $signalp:
    Trinotate Trinotate.sqlite LOAD_signalp '$signalp' &&
#end if

Trinotate Trinotate.sqlite report -E $report_option.E --pfam_cutoff $report_option.pfam_cutoff $report_option.incl_pep $report_option.incl_trans > '$trinotate_out';
    ]]></command>

Do not use a new line for the opening <![CDATA[ text nor the closing ]]> text.

Do not leave a blank line after the opening tag and <![CDATA[, nor leave a blank line before the closing ]]> and closing tag.

Single lines of content may be written as either:

<command><![CDATA[perl $__tool_directory__/xpath -q -e '$expression' $input > $output]]></command>

(example from tools/xpath/xpath.xml), or following the recommenced multi-line style:

    <command><![CDATA[
perl $__tool_directory__/xpath -q -e '$expression' $input > $output
    ]]></command>
@bgruening
Copy link
Member

@peterjc go ahead and make a PR :)

@nsoranzo
Copy link
Member

nsoranzo commented Jun 7, 2017

💯

@peterjc
Copy link
Contributor Author

peterjc commented Jun 7, 2017

Note that right now the tools-iuc XML files have a range of usage here - and its the kind of change while it is trivial in theory, it would be easy to accidentally break things.

@nsoranzo
Copy link
Member

nsoranzo commented Jun 7, 2017

Indentation is not significant in Cheetah, so this kind of changes shouldn't have any impact.

Any way I'm happy to have this as a suggested (not mandatory) code style.

@mvdbeek
Copy link
Contributor

mvdbeek commented Nov 23, 2017

👍

@mvdbeek mvdbeek self-assigned this Nov 23, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants