Template:Repo link: Difference between revisions

Jump to navigation Jump to search
Improved SourceForge URL and link text handling for commits. Setting the 'view' parameter to 'commit' is no longer necessary when referencing a pure commit (i.e. not paths or branches are specified).
(Added commit or branch information to the SourceForge git web link text when the 'pre' parameter is set. The text ' (commit <commit>)' or ' (branch <branch>)' is appended to allow the link to be differentiated from the HEAD commit.)
(Improved SourceForge URL and link text handling for commits. Setting the 'view' parameter to 'commit' is no longer necessary when referencing a pure commit (i.e. not paths or branches are specified).)
Line 35: Line 35:
         -->{{{commit|{{{branch|next}}}}}}/ <!--                    The commit hash or next. -->
         -->{{{commit|{{{branch|next}}}}}}/ <!--                    The commit hash or next. -->
         }}<!--
         }}<!--
       -->{{#switch: {{{view|tree}}} <!--                           Tree, log, or commit view. -->
       -->{{#switch: {{{view|}}} <!--                               The different views. -->
           | tree = tree/
           | tree = tree/
           | log = log/?path{{=}}
           | log = log/?path{{=}}
           | rss = feed/
           | rss = feed/
           | commit =  
           | commit =  
          | #default =<!--                                        Set the view based on the user supplied parameters.
        -->{{#if: {{{path|}}}
            | tree/
            | {{#if: {{{commit|}}}
                |
                | tree/
              }}
          }}
         }}<!--
         }}<!--
       -->{{#switch: {{{view|tree}}} <!--                            Only show the path and line number if view!=rss. -->
       -->{{#switch: {{{view|}}}
           | rss =  
           | rss =  
           | #default = {{{path|}}}<!--                             The file path.
          | commit =
        -->{{#if: {{{line|}}} | &#35;l{{{line}}} }}<!--            The optional line number. -->
           | #default =<!--
        -->{{#if: {{{path|}}} <!--                                    Only show the path and line number if the path is supplied. -->
            | {{{path|}}}<!--                                       The file path.
          -->{{#if: {{{line|}}} | &#35;l{{{line}}} }}<!--            The optional line number. -->
          }}
         }}
         }}
       }} <!--
       }} <!--
Line 78: Line 90:
                   }}
                   }}
               }}<!--
               }}<!--
             -->{{#switch: {{{view|tree}}} <!--                     The view description. -->
             -->{{#switch: {{{view|}}} <!--                         The view description. -->
                 | tree =  
                 | tree =  
                 | log = <nowiki></nowiki> log view
                 | log = <nowiki></nowiki> log view
                 | commit = <nowiki></nowiki> commit view
                 | commit = <nowiki></nowiki> commit view
                 | rss = <nowiki></nowiki> RSS feed
                 | rss = <nowiki></nowiki> RSS feed
                | #default =<!--                                  Set the view based on the user supplied parameters.
              -->{{#if: {{{path|}}}
                  |
                  | {{#if: {{{commit|}}}
                      |<nowiki></nowiki> commit view
                    }}
                }}
               }}
               }}
           }}
           }}
Line 94: Line 113:
           | #default =
           | #default =
           {{{commit|HEAD}}}/<!--                                  The revision number or HEAD.
           {{{commit|HEAD}}}/<!--                                  The revision number or HEAD.
         -->{{#switch: {{{view|tree}}} <!--                         Tree, log, or commit view. -->
         -->{{#switch: {{{view|}}} <!--                             The different views. -->
             | tree = tree/
             | tree = tree/
             | log = log/?path{{=}}
             | log = log/?path{{=}}
            | rss =
             | commit =  
             | commit =  
            | #default =<!--                                      Set the view based on the user supplied parameters.
          -->{{#if: {{{branch|{{{path|}}}}}}
              | tree/
              | {{#if: {{{commit|}}}
                  |
                  | tree/
                }}
            }}
           }}
           }}
         }}
         }}
       }}<!--
       }}<!--
     -->{{#switch: {{{view|tree}}} <!--                              Only show the branch, path, and line number if view != commit. -->
     -->{{#switch: {{{view|}}}
         | commit =  
         | commit =  
         | rss = feed/
         | rss = feed/
         | #default = {{{branch|trunk}}}<!--                       The base path or branch (default = trunk).
         | #default =<!--
      -->{{#if: {{{path|}}} | /{{{path}}} }}<!--                    The file path.
       -->{{#switch: {{{type|}}}
       -->{{#switch: {{{type|}}}
           | svn =  
           | svn = <!--
            {{#if: {{{commit|}}} | @r{{{commit}}} }}<!--           The optional revision number. -->
        -->{{{branch|trunk}}}<!--                                  The base path or branch (default = trunk).
           | svn web =
        -->{{#if: {{{path|}}} | /{{{path}}} }}<!--                  The file path.
             {{#if: {{{line|}}} | &#35;l{{{line}}} }} <!--         The optional line number. -->
        -->{{#if: {{{commit|}}} | @r{{{commit}}} }}<!--             The optional revision number. -->
           | svn web = <!--
        -->{{#if: {{{branch|{{{path|}}}}}} <!--                    Only show the branch, path, and line number if a branch or path is supplied. -->
             | {{{branch|trunk}}}<!--                              The base path or branch (default = trunk).
          -->{{#if: {{{path|}}}
              | /{{{path}}}<!--                                    The file path.
            -->{{#if: {{{line|}}} | &#35;l{{{line}}} }}<!--         The optional line number, but only if the path is supplied. -->
            }}
            | {{#if: {{{commit|}}} | | trunk}}<!--                Minimally show the trunk if no commit is given. -->
          }}
         }}
         }}
       }} <!--
       }} <!--
Line 123: Line 159:
                     | {{{user|{{{proj|flightgear}}}}}}/<!--        The user or project name.
                     | {{{user|{{{proj|flightgear}}}}}}/<!--        The user or project name.
                     -->{{{repo|flightgear}}}<!--                    The repository name.
                     -->{{{repo|flightgear}}}<!--                    The repository name.
                     -->{{#ifeq: {{{view|}}} | rss | <!--           The repository branch (if view != rss). -->
                     -->{{#switch: {{{view|}}}<!--                   The repository branch. -->
                         | /{{{branch|trunk}}}
                         | rss =
                        | commit =
                        | #default = <!--
                      -->{{#if: {{{branch|{{{path|}}}}}}
                          | /{{{branch|trunk}}}
                        }}
                       }}
                       }}
                   }}
                   }}
               }}<!--
               }}<!--
             -->{{#switch: {{{view|tree}}}
             -->{{#switch: {{{view|}}}
                 | rss =  
                 | rss =  
                 | #default =
                 | #default =
Line 137: Line 178:
               -->{{#if: {{{commit|}}} | @r{{{commit}}}}} <!--      The commit. -->
               -->{{#if: {{{commit|}}} | @r{{{commit}}}}} <!--      The commit. -->
               }}<!--
               }}<!--
             -->{{#switch: {{{view|tree}}} <!--                     The view description. -->
             -->{{#switch: {{{view|}}} <!--                         The view description. -->
                 | tree =  
                 | tree =  
                 | log = <nowiki></nowiki> log view
                 | log = <nowiki></nowiki> log view
                 | commit = <nowiki></nowiki> commit view
                 | commit = <nowiki></nowiki> commit view
                 | rss = <nowiki></nowiki> RSS feed
                 | rss = <nowiki></nowiki> RSS feed
                | #default =<!--                                  Set the view based on the user supplied parameters.
              -->{{#if: {{{branch|{{{path|}}}}}}
                  |
                  | {{#if: {{{commit|}}}
                      |<nowiki></nowiki> commit view
                    }}
                }}
               }}
               }}
           }}
           }}

Navigation menu