Template:Repo link: Difference between revisions

Jump to navigation Jump to search
Redesign and large simplification of the GitLab URL and Mediawiki link text construction. If the 'user' or 'proj' parameters are not supplied, the base GitLab URL will be constructed, and the default text of "GitLab website" will be used.
(Redesign and large simplification of the GitHub URL and Mediawiki link text construction. Now if the 'user' or 'proj' parameters are not supplied the base GitHub URL will be constructed, and the default text of "GitHub website" will be used.)
(Redesign and large simplification of the GitLab URL and Mediawiki link text construction. If the 'user' or 'proj' parameters are not supplied, the base GitLab URL will be constructed, and the default text of "GitLab website" will be used.)
Line 255: Line 255:
| gitlab = <!--
| gitlab = <!--
-->{{{protocol|https}}}://<!--                                      URL protocol (default = https).
-->{{{protocol|https}}}://<!--                                      URL protocol (default = https).
-->gitlab.com/<!--                                                 The URL.
-->gitlab.com<!--                                                   The URL.
-->{{#if: {{{user|}}} <!--                                         Project or user? -->
-->{{#if: {{{user|{{{proj|}}}}}} | {{#if: {{{repo|}}}<!--           Continue with the URL construction, only if the project or repository is given. -->
    | {{{user}}}
    | {{#if: {{{user|}}} <!--                                      Project or user? -->
    | {{{proj|}}}
        | /{{{user}}}
  }}/<!--
        | /{{{proj|}}}
-->{{{repo|}}}<!--                                                 The version control repository.
      }}<!--
-->{{#switch: {{{type|git web}}} <!--                               Web interface or base URL. -->
    -->{{#if: {{{repo|}}} | /{{{repo|}}}}}<!--                     The version control repository.
    | git = .git<!--                                               Append '.git' to the base repository URL. -->
    -->{{#switch: {{{type|git web}}} <!--                           The URL type. -->
    | git web = <!--                                               TODO: The rest of the URL
        | git = .git<!--                                           Append '.git' to the base repository URL. -->
  --><nowiki></nowiki> {{#if: {{{text|}}}
        | git web = /<!--                                         TODO: The rest of the URL. -->
      | {{{text}}}<!--                                             The text description for the link. -->
        | zip = /repository/archive.zip<!--                        The base zip file URL.
      | {{#ifeq: {{{full|}}} | 1
        -->{{#if: {{{commit|{{{tag|{{{branch|master}}}}}}}}}
          | <!--                                                   No text. -->
            | &#63;ref={{{commit|{{{tag|{{{branch|master}}}}}}}}}<!-- Download for a specific commit, tag, or branch (defaulting to master). -->
          | {{#if: {{{pre|}}}
          }}
              | {{{pre}}}<!--                                     A prefix to the link label. -->
      }}
              | {{#if: {{{simplepath|}}}
  }}}} <!--
                  | <!--                                           No project, repository or branch. -->
-->{{#if: {{{text|}}}
                  | gitlab/<!--                                   Site advertising.
    | {{{text}}}<!--                                               The text description for the link. -->
                  -->{{{user|{{{proj|}}}}}}/<!--                   The user or project name.
    | {{#ifeq: {{{full|}}} | 1
                  -->{{{repo|}}}/<!--                               The repository name.
        | <!--                                                     No text. -->
                  -->{{{commit|{{{tag|{{{branch|}}} }}} }}}<!--     The commit, tag, or branch.-->
        | {{#if: {{{user|{{{proj|}}}}}}
                }}
            | {{#if: {{{repo|}}}
            }}
                | {{#if: {{{pre|}}}
        }}
                    | {{{pre}}}<!--                               A prefix to the link label. -->
    }}
                    | {{#if: {{{simplepath|}}}
    | zip = /repository/archive.zip<!--                           The base zip file URL.
                        | <!--                                     No project, repository or branch. -->
    -->{{#if: {{{commit|{{{tag|{{{branch|}}} }}} }}}
                        | gitlab/<!--                             Site advertising.
        | &#63;ref={{{commit|{{{tag|{{{branch|}}} }}} }}}<!--     Download for a specific commit, tag, or branch. -->
                        -->{{{user|{{{proj|}}}}}}/<!--             The user or project name.
      }} <!--
                        -->{{{repo|}}}/<!--                         The repository name.
    -->{{#if: {{{text|}}}
                        -->{{{commit|{{{tag|{{{branch|master}}}}}}}}}<!-- The commit, tag, or branch.-->
        | {{{text}}}<!--                                           The text description for the link. -->
                      }}
        | {{#ifeq: {{{full|}}} | 1
                  }}<!--
            | <!--                                                No text. -->
                -->{{#switch: {{{type|git web}}} <!--               The URL type. -->
            | {{#if: {{{pre|}}}
                    | git web =
                | {{{pre}}}<!--                                   A prefix to the link label. -->
                      {{#if: {{{path|}}} | /{{{path}}}}}<!--       The file or directory path.
                | {{#if: {{{simplepath|}}}
                    -->{{#if: {{{line|}}} | &#35;L{{{line}}}}} <!-- The optional line number(s).
                    | <!--                                         No project, repository or branch. -->
                    -->{{#switch: {{{view|tree}}} <!--             TODO:  The view description. -->
                    | gitlab/<!--                                  Site advertising.
                        | tree =
                    -->{{{proj|}}}/<!--                            The project name.
                      }}
                    -->{{{repo|}}}/<!--                            The repository name.
                    | zip = <nowiki></nowiki> zip file<!--         The link description. -->
                    -->{{{commit|{{{tag|{{{branch|}}} }}} }}}<!--   The commit, tag, or branch.-->
                   }}
                   }}
               }} <nowiki></nowiki> zip file<!--                    The link description. -->
               }}
            | GitLab website
           }}
           }}
       }}
       }}

Navigation menu