Template:Repo link: Difference between revisions

Jump to navigation Jump to search
Modified the Gitorious URL generation so that if no project or repository is given, then just the base URL https://gitorious.org is created.
(GitLab URL fix for 'type = git'.)
(Modified the Gitorious URL generation so that if no project or repository is given, then just the base URL https://gitorious.org is created.)
Line 318: Line 318:
| gitorious = <!--
| gitorious = <!--
-->{{{protocol|https}}}://<!--                                      URL protocol (default = https).
-->{{{protocol|https}}}://<!--                                      URL protocol (default = https).
-->gitorious.org/<!--                                               The URL.
-->gitorious.org<!--                                               The URL (stop here if no project or repository is given).
-->{{{proj|fg}}}/<!--                                               The project (default = fg).
-->{{#if: {{{proj|}}} | {{#if: {{{repo|}}}
-->{{{repo|flightgear}}}<!--                                       The version control repository.
    | {{#if: {{{proj|}}} | /{{{proj}}}}}<!--                       The project.
-->{{#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}}} <!--                             Web interface or base URL. -->
    | git web = ?<!--
      | git = .git<!--                                             Append '.git' to the base repository URL. -->
      -->p={{{proj|fg}}}<!--                                       The project and repository names, with '.git' appended.
      | git web = ?<!--
        -->&#58;{{{repo|flightgear}}}<!--
    -->p={{{proj|fg}}}<!--                                         The project and repository names, with '.git' appended.
        -->.git<!--
    -->&#58;{{{repo|flightgear}}}<!--
      -->&#59;a={{#if: {{{view|}}} <!--                             The repository view mode. -->
    -->.git<!--
              | {{#switch: {{{view|}}}
    -->&#59;a={{#if: {{{view|}}} <!--                               The repository view mode. -->
                  | raw = blob_plain
                | {{#switch: {{{view|}}}
                  | #default = {{{view|summary}}}
                    | raw = blob_plain
                }}
                    | #default = {{{view|summary}}}
              | {{#if: {{{path|}}} | blob
                  }}
                  | {{#if: {{{commit|{{{mr|}}}}}}
                | {{#if: {{{path|}}} | blob
                      | commit
                    | {{#if: {{{commit|{{{mr|}}}}}}
                      | {{#if: {{{branch|{{{tag|}}}}}}
                        | commit
                          | shortlog
                        | {{#if: {{{branch|{{{tag|}}}}}}
                          | summary
                            | shortlog
                        }}
                            | summary
                    }}
                          }}
                }}
                      }}
            }}<!--
                  }}
      -->{{#if: {{{path|}}} | &#59;f={{{path|}}}}}<!--             The file or directory path.
              }}<!--
      -->{{#if: {{{commit|{{{branch|{{{mr|}}}}}}}}} <!--           The commit, branch, or merge request query string. -->
    -->{{#if: {{{path|}}} | &#59;f={{{path|}}}}}<!--               The file or directory path.
          | {{#if: {{{view|}}}
    -->{{#if: {{{commit|{{{branch|{{{mr|}}}}}}}}} <!--             The commit, branch, or merge request query string. -->
              | {{#switch: {{{view|}}}
        | {{#if: {{{view|}}}
                  | blob | raw | tree = &#59;hb=
            | {{#switch: {{{view|}}}
                  | #default = &#59;h=
                | blob | raw | tree = &#59;hb=
                }}
                | #default = &#59;h=
              | {{#if: {{{path|}}}
              }}
                  | &#59;hb=
            | {{#if: {{{path|}}}
                  | &#59;h=
                | &#59;hb=
                }}
                | &#59;h=
            }}
              }}
        }}<!--
          }}
      -->{{#if: {{{mr|}}}
      }}<!--
          | refs/merge-requests/{{{mr}}} <!--                     The internal git reference for the merge request. -->
    -->{{#if: {{{mr|}}}
          | {{#if: {{{commit|}}}
        | refs/merge-requests/{{{mr}}} <!--                       The internal git reference for the merge request. -->
              | {{{commit}}} <!--                                 The commit hash. -->
        | {{#if: {{{commit|}}}
              | {{#if: {{{branch|}}}<!--                           The internal git reference for the branch. -->
            | {{{commit}}} <!--                                   The commit hash. -->
                  | refs/heads/{{{branch}}}
            | {{#if: {{{branch|}}}<!--                             The internal git reference for the branch. -->
                }}
                | refs/heads/{{{branch}}}
            }}
              }}
        }}<!--
          }}
      -->{{#if: {{{line|}}}  |&#35;l{{{line}}}}} <!--               The optional line number.
      }}<!--
      -->{{#if: {{{text|}}}
    -->{{#if: {{{line|}}}  |&#35;l{{{line}}}}} <!--                 The optional line number. -->
          | {{{text}}}<!--                                         The text description for the link. -->
    }}
          | {{#ifeq: {{{full|}}} | 1
  }}}} <!--
              | <!--                                               No text. -->
-->{{#if: {{{text|}}}
              | {{#if: {{{pre|}}}
    | {{{text}}}<!--                                               The text description for the link. -->
                  | {{{pre}}}<!--                                 A prefix to the link label. -->
    | {{#ifeq: {{{full|}}} | 1
                  | {{#if: {{{simplepath|}}}
        | <!--                                                     No text. -->
                      | <!--                                       No project, repository or branch. -->
        | {{#if: {{{pre|}}}
                      | {{{proj|fg}}}/<!--                         The project name.
            | {{{pre}}}<!--                                       A prefix to the link label. -->
                      -->{{{repo|flightgear}}}/<!--                 The repository name.
            | {{#if: {{{simplepath|}}}
                      -->{{#if: {{{mr|}}}
                | <!--                                             No project, repository or branch. -->
                          | merge-requests/{{{mr}}}<!--           The merge request.-->
                | {{{proj|fg}}}/<!--                               The project name.
                          | {{{commit|{{{branch|HEAD}}}}}}<!--     Or the commit or branch.-->
                -->{{{repo|flightgear}}}/<!--                       The repository name.
                        }}
                -->{{#if: {{{mr|}}}
                    }}
                    | merge-requests/{{{mr}}}<!--                 The merge request.-->
                }}<!--
                    | {{{commit|{{{branch|HEAD}}}}}}<!--           Or the commit or branch.-->
              -->{{#if: {{{path|}}} | /{{{path}}}}}<!--             The file or directory path.
                  }}
              -->{{#if: {{{line|}}} | &#35;l{{{line}}}}} <!--       The optional line number. -->
              }}
            }}
          }}<!--
        }}
        -->{{#if: {{{path|}}} | /{{{path}}}}}<!--                   The file or directory path.
        -->{{#if: {{{line|}}} | &#35;l{{{line}}}}} <!--             The optional line number. -->
      }}
   }}
   }}
| #default = <!--
| #default = <!--

Navigation menu