Template:Fgaddon aircraft source: Difference between revisions

Jump to navigation Jump to search
+-More comments and indentation; + So far commented beginnings of adding snapshot download link. Need to figure out how to throw error without code duplication
(Add path, branch, and line params, expand example, add related templates)
(+-More comments and indentation; + So far commented beginnings of adding snapshot download link. Need to figure out how to throw error without code duplication)
Line 1: Line 1:
http://sourceforge.net/p/flightgear/fgaddon/{{{r|HEAD}}}/tree/{{{b|trunk}}}/Aircraft/<!--
http://sourceforge.net/p/flightgear/fgaddon/{{{r|HEAD}}}<!--  tarball?path=/*no "/tree/"*  --><!--
-->/tree/<!--
-->{{#if: {{{b|}}} <!-- Is a branch defined? -->
  | <!-- Yes, add the branch to the URL --><!--
    -->branches/{{{b}}}
  | <!-- No, default to "trunk"  --><!--
    -->trunk
  }}/Aircraft/<!--
-->{{#if: {{{1|}}} <!-- Is an aircraft defined? -->
-->{{#if: {{{1|}}} <!-- Is an aircraft defined? -->
| <!-- Yes, go to file path --><!--
  | <!-- Yes, go to the aircraft directory --><!--
  -->{{{1}}}/<!--
    -->{{{1}}}/<!--
  -->{{#if: {{{2|}}} <!-- Is a path given? --><!--
    -->{{#if: {{{2|}}} <!-- Is a file path defined? -->
  -->| {{{2}}}{{#if: {{{l|}}} | &#35;l{{{l}}} }} <!-- Yes, add it to the URL --><!--
      | <!-- Yes, got to the file --><!--
  -->}}
        -->{{{2}}}<!--
| <!-- No, go to the default --><!--
          -->{{#if: {{{l|}}} <!-- Is a line number defined -->
-->}}<noinclude>
            | <!-- Yes, go to the line number --><!--
              -->&#35;l{{{l}}}
        }}
    }}
  | <!-- No, go to the default -->
}}<noinclude>
{{Informative template|1=
{{Informative template|1=
__NOTOC__
__NOTOC__
Line 14: Line 26:


== Usage ==
== Usage ==
  {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{cbr}}
  {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''r=''{{!}}''b=''{{!}}''l=''{{!}}''tarball=''{{cbr}}


All parameters are optional.
All parameters are optional.
Line 22: Line 34:
; path:  What follows after the aircraft's repository name in the URL.  Can be the path to a file or a directory.
; path:  What follows after the aircraft's repository name in the URL.  Can be the path to a file or a directory.


; r:  Optional revision number to use instead of <code>HEAD</code>.
; r:  Revision number to use instead of <code>HEAD</code>.


; b:  Optional branch name to use instead of <code>trunk</code>.
; b:  Branch name to use instead of <code>trunk</code>.


; l:  Used with the '''path''' parameter to link to a given line in a file.
; l:  Used with the '''path''' parameter to link to a given line in a file.
: {{inote|This parameter will not work if the linked file is of a certain file type, such as <code>.nas</code>. However, this is to do with SourceForge, not the template.}}
: {{inote|Due to SourceForge limitations this parameter does not fork for some file types, in particular <code>.nas</code> (Nasal) files.}}
<!--
; tarball:  If not empty, the link will create and link to a <code>.tar.gz</code> (tarball) snapshot of a an aircraft directory.
: {{inote|See also the section "Technical details" below.}} -->


== Examples ==
== Examples ==
Line 43: Line 58:


=== Branch name given ===
=== Branch name given ===
  <nowiki>{{fgaddon url|B-1B|b=branches/release-3.6.0}}</nowiki>
  <nowiki>{{fgaddon url|B-1B|b=release-3.6.0}}</nowiki>
{{fgaddon url|B-1B|b=branches/release-3.6.0}}
{{fgaddon url|B-1B|b=release-3.6.0}}


=== Path and line number given ===
=== Path and line number given ===
Line 56: Line 71:
  <nowiki>[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]</nowiki>
  <nowiki>[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]</nowiki>
[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]
[{{fgaddon url|F-15|Nasal/fox2.nas}} The F-15's missile system]
<!--
== Technical details ==
=== The tarball parameter ===
When used with the '''tarball=''' parameter, the template will link to a SourceForge page that will create a <code>.tar.gz</code> (tarball) compressed archive snapshot of a directory.  Currently the template is set up to only allow this for aircraft directories, in essence when no '''path''' or '''l''' (line) parameter is given.
{{inote|Creating the tarball can take some time.}}  -->


== Related templates ==
== Related templates ==

Navigation menu