Template:Simgear file: Difference between revisions

Jump to navigation Jump to search
Add line parameter; fix "simgear/simgear/..." > "simgear.." abbreviation bug; slightly shorten abbreviated commit IDs to match the SF abbreviation; add link to {{fgaddon url}}
m (Minor text changes)
(Add line parameter; fix "simgear/simgear/..." > "simgear.." abbreviation bug; slightly shorten abbreviated commit IDs to match the SF abbreviation; add link to {{fgaddon url}})
Line 6: Line 6:
       | <!-- Yes. Add a trailing slash and tilde after the reference (needed for the SourceForge URL). --><!--
       | <!-- Yes. Add a trailing slash and tilde after the reference (needed for the SourceForge URL). --><!--
         -->/~
         -->/~
     }}/tree/{{{1|}}} simgear/{{{1|}}}] ({{{2}}})
     }}/tree/{{{1|}}}<!--
    -->{{#if: {{{3|}}} <!-- Is a line defined? -->
      | &#35;l{{{3}}}
    }} <!--
-->{{#ifeq: {{lc: {{#titleparts: {{{1|}}} | 1 }} }} <!-- Does the file path start with "simgear"? -->
  | simgear
  | {{{1|}}} <!-- Yes, abbreviate the label ("simgear/simgear..." -> "simgear/...") -->
  | simgear/{{{1|}}} <!-- No, do not abbreviate -->
  }}] ({{{2}}}{{#if: {{{3|}}} | ,&nbsp;line&nbsp;{{{3}}} }})
   | <!-- No, a commit reference is not defined.  Fall back on "next" and do not display commit reference. --><!--
   | <!-- No, a commit reference is not defined.  Fall back on "next" and do not display commit reference. --><!--
     -->next/tree/{{{1|}}} <!--
     -->next/tree/{{{1|}}}<!--
-->{{#ifeq: {{#titleparts: {{{1|}}} | 1 }} <!-- Does the file path start with "simgear"? -->
    -->{{#if: {{{3|}}} <!-- Is a line defined? -->
      | &#35;l{{{3}}}
    }} <!--
-->{{#ifeq: {{lc: {{#titleparts: {{{1|}}} | 1 }} }} <!-- Does the file path start with "simgear"? -->
   | simgear  
   | simgear  
   | {{{1|}}} <!-- Yes, abbreviate the label ("simgear/simgear..." -> "simgear/...") -->
   | {{{1|}}} <!-- Yes, abbreviate the label ("simgear/simgear..." -> "simgear/...") -->
   | simgear/{{{1|}}} <!-- No, do not abbreviate -->
   | simgear/{{{1|}}} <!-- No, do not abbreviate -->
   }}]
   }}]{{#if: {{{3|}}} | &nbsp;(line&nbsp;{{{3}}}) }}
}}<noinclude>
}}<noinclude>
{{Informative template|1=
{{Informative template|1=
Line 21: Line 32:


== Usage ==
== Usage ==
  {{obr}}'''simgear file'''{{!}}''path''{{!}}''reference''{{cbr}}
  {{obr}}'''simgear file'''{{!}}''path''{{!}}''reference''{{!}}''line''{{cbr}}


Both parameters are optional.
Both parameters are optional.
Line 28: Line 39:


; reference:  A commit reference.  Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the '''next''' branch.
; reference:  A commit reference.  Usually the SHA-1 commit ID (which can be abbreviated), but it can also be a tag or a branch name. If empty, the link will point to the '''next''' branch.
; line:  A line number. This should just be a single number, as SourceForge does not support multiple line numbers.
: {{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.}}


== Examples ==
== Examples ==
Line 42: Line 56:
{{simgear file|simgear/canvas/Canvas.cxx|release/2.12.0}}
{{simgear file|simgear/canvas/Canvas.cxx|release/2.12.0}}


  {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c222{{cbr}}
  {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c2{{cbr}}
{{simgear file|simgear/canvas/Canvas.cxx|4f94c222}}
{{simgear file|simgear/canvas/Canvas.cxx|4f94c2}}


  {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c22241e5ef90026fd087168b24a13ee5ef9b{{cbr}}
  {{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c22241e5ef90026fd087168b24a13ee5ef9b{{cbr}}
Line 51: Line 65:
  {{obr}}simgear file{{!}}version{{cbr}}
  {{obr}}simgear file{{!}}version{{cbr}}
{{simgear file|version}}
{{simgear file|version}}
=== Line parameter given ===
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}{{!}}5{{cbr}}
{{simgear file|simgear/canvas/Canvas.cxx||5}}
{{obr}}simgear file{{!}}simgear/canvas/Canvas.cxx{{!}}4f94c2{{!}}5{{cbr}}
{{simgear file|simgear/canvas/Canvas.cxx|4f94c2|5}}


== Related templates ==
== Related templates ==
Line 56: Line 77:
* {{tl|flightgear file}}
* {{tl|flightgear file}}
* {{tl|fgdata file}}
* {{tl|fgdata file}}
* {{tl|fgaddon url}}


}}
}}

Navigation menu