Template talk:Repo link: Difference between revisions

Jump to navigation Jump to search
Moving large parts of the more general discussion to http://wiki.flightgear.org/index.php?title=FlightGear_wiki:Village_pump&oldid=87148#Repository_link_templates
(→‎Todo list: Typo; There is a need for a few more parameters in some of the templates.)
(Moving large parts of the more general discussion to http://wiki.flightgear.org/index.php?title=FlightGear_wiki:Village_pump&oldid=87148#Repository_link_templates)
Line 110: Line 110:
**** <nowiki>http://git.code.sf.net/p/flightgear/flightgear</nowiki>
**** <nowiki>http://git.code.sf.net/p/flightgear/flightgear</nowiki>


'''To do'''
* {{tl|Repo link}}
** Protocols (e.g., <code><nowiki>git://</nowiki></code>, see [[#Supporting different protocols|above]])
** Add Mercurial to repo types
** GitLab option
** Standardize label style (when label is not customized).
** Download links


'''Started by''' [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]])
:''The following discussion got more general and was moved to [[FlightGear wiki:Village pump#Repository link templates]] ([http://wiki.flightgear.org/index.php?title=FlightGear_wiki:Village_pump&oldid=87148#Repository_link_templates perm]).''
 
: I think those are all good ideas.  I added {{tl|readme file}} the other day.  As I was just looking at {{tl|repo link}} to add links to relevant source code files related to the [[Conditions]] article I got reminded by the beauty of less typing. ;-)
 
: In addition I was also reminded about that a more specific template is easier to update when a repository move.  Consider for example if {{tl|repo link}} would be used as I mentioned above, linking to a source code file related to an article.  If that repository would be moved again or get another URL structure ''all'' links to that repository would have to be updated.
 
: A more specific link at the other hand, say {{obr}}simgear file{{cbr}} would only require that specific template to be changed.  In addition all links to any of those source files would have the same style, which to some extent will making them more intuitive.
 
: In essence, more specific link templates should:
:* Require less typing
:* Require less maintenance
:* Give a more consistent style
 
: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 17:06, 20 May 2015 (EDT)
 
 
: Some more thoughts on the sub-templates for links to source files in the git repos, and one for the FGAddon svn repo.
:* Source file/directory templates:
:** Should we use one more or an entirely different meta template, say {{obr}}source file{{cbr}}, to give them a consistent style, for example prefix (FlightGear, SimGear, FGData, etc), showing/not showing full path, etc), instead of doing that in each template?
:** Always or often used parameters should probably not be named parameters
:*** I guess always and often used parameters are path and commit
:*** Other parameters?
:** Template names, how about:
:*** {{obr}}flightgear source{{cbr}}
:*** {{obr}}simgear source{{cbr}}
:*** {{obr}}fgdata source{{cbr}}
:** Should default to root directory of repo rather than throw an error.
:* Aircraft repo template(s) (slightly off topic):
:** How about {{obr}}fgaddon aircraft{{cbr}}
:** Should default to <code>..trunk/aircraft/</code> rather than throw an error.
:* Aircraft URL templates:
:** Needed for a completely different purpose than source links, namely URLs in infoboxes.
:** Would lessen maintenance ''considerably'' if a repo/hangar moves.
:** How about {{tlx|fgaddon aircraft url|''aircraft''|''revision''}}
:** I guess in the same way link templates for other common repos/hangars are added, for example:
:*** {{obr}}fgmembers aircraft url{{cbr}}
:*** {{obr}}helijah aircraft url{{cbr}}
:*** {{obr}}fguk aircraft url{{cbr}}
:** Big question:  Download URL or info page URL?
:** When given no params:  Link to root directory/hangar main page or throw an error?
:* A category for the templates say ''Category:Repository link templates'' with templates and meta templates could be a good idea.
 
: Why do I argue for always or often used parameters to be ''unnamed parameters''?  And only ''lowercase names'' for the templates?  ''Quicker typing''.  Simple as that.  At least with these templates.
 
: If you guys think this would be ok I could start adding templates right away, probably starting with aircraft URL templates.
 
: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 06:27, 26 May 2015 (EDT)
 
:: Hi Johan,
:: Sorry for the delayed reply.
:: Just checking, am I right in saying that you're suggesting that there should be a template for Git repos and a separate one for FGAddon (an SVN repo)?  It's just a bit hard to read what you mean above.  Anyway, apart from that, here's my feedback:
::* '''Oft used parameters:''' Using unnamed parameters is good idea.  The parameters that would commonly be used would be <code>site</code>, <code>proj</code>, and <code>path</code>. I don't think <code>commit</code> is used as much, though.
::* '''Defaulting:''' Where possible, it's probably best to use defaulting, rather than throwing errors.
::* '''Aircraft URL templates:''' Another good idea.
::** We should probably link to info page URL.  Linking directly to download may catch users out when it automatically starts downloading.
::** http://forum.flightgear.org/viewtopic.php?f=42&t=26167 ;)
::* '''New category:''' Agree.
::* '''Upper/lowercase names:''' Yeah, we should use lowercase names, especially in the documentation.
::* '''Name suggestions''' I think ''repo'' instead of ''source'' should be used.  It's less typing and a bit more descriptive.  Also, {{obr}}fgaddon repo{{cbr}}?  URL template names are fine to me, though.
 
:: Also, do you have any suggestions for link styling above?
 
:: Regards,
:: [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 06:03, 31 May 2015 (EDT)
 
::: Sorry for the even later reply.
 
:::; Often used parameters and name suggestions
:::: I think that ''site'' and ''path'' parameters would be superfluous, also how about using ''file'' instead of ''repo''.  Instead of pointing to the whole of the repo usually will point to a specific file or directory within a repo.  As you say the ''commit'' parameter would only be used sparsely, though I think it might be good to have at times.
 
::::In essence I am suggesting {{obr}}'''flightgear file'''{{!}}''path''{{!}}''commit''{{cbr}}, {{obr}}'''simgear file'''{{!}}''path''{{!}}''commit''{{cbr}} and {{obr}}'''fgdata file'''{{!}}''path''{{!}}''commit''{{cbr}} for links to source files (and directories).  The ''path'' parameter would be what follow after <code>flightgear/src/</code>, <code>simgear/simgear/</code> or <code>fgdata/</code>.
 
:::; Defaulting
:::: Yep, it is definitively better to default than trow an error.
 
:::; Aircraft URL templates
:::: Good point about automatic downloading.  I did not think of that.  Better link to the info pages.
 
:::; Link styling
:::: Interesting problem.  I have considered both something resembling the path in a local file system or some abbreviated variant, like <code>flightgear/src/Time/TimeManager.cxx</code>, <code>simgear/simgear/magvar/coremag.cxx</code> and <code>fgdata/Nasal/view.nas</code>, or <code>flightgear/Time/TimeManager.cxx</code>, <code>simgear/magvar/coremag.cxx</code> and <code>fgdata/Nasal/view.nas</code>.  The advantage with having them look like a file path is to help those using Git to find the file in their local clone faster.  Then there is also the issues of whether only the ''path'' parameter should be used for the link to the file while there could be an explanatory link preceding it, for example like [[SimGear]]/[http://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/magvar/coremag.cxx magvar/coremag.cxx], and whether or not to use mostly lowercase the file path like label or the case used sometimes otherwise, in essence flightgear, fgdata and simgear, or FlightGear, FGData and SimGear.
 
:::: I am going to suggest abbreviated paths but camel case repo names, like [http://sourceforge.net/p/flightgear/simgear/ci/next/tree/simgear/magvar/coremag.cxx SimGear/magvar/coremag.cxx], though I am not convinced it is the best way.
 
::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 17:34, 10 September 2015 (EDT)
 
:::: Personally, I would prefer all-lowercase, abbreviated links. Camel-case repo names doesn't look quite right in the context to me. However, I agree with everything else you've said. I think that having a central template ({{tl|repo link}}) is not required now. If ever the location of fgdata, FGAddon, etc. changes again, it still wouldn't be too hard to change the location in a handful of templates instead of one central template. Separate templates would also be much simpler than a central one and therefore easier to maintain.
 
:::: So, apart from link styling, I think we can start implementing these new templates:
::::* {{obr}}'''flightgear file'''{{cbr}}
::::* {{obr}}'''simgear file'''{{cbr}}
::::* {{obr}}'''fgdata file'''{{cbr}}
::::* {{obr}}'''fgaddon aircraft'''{{cbr}} (right name?)
 
:::: Regards,
 
:::: [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 08:45, 11 September 2015 (EDT)
 
:::::* Good point about lowercase vs. camel-case.  That was one of the things I was more hesitant about.
:::::* In retrospect I think {{obr}}'''fgaddon aircraft url'''{{cbr}} may be a better name, as it renders only an url. (Though it is an awfully long name, as well as the other aircraft repo URL templates.  I wonder if "aircraft" is needed?)
:::::* While the repo link template might not be needed (at least for official repos), a styling template will help keep the styling consistent and may help related maintenance.
:::::: How about something like {{obr}}'''source file'''{{!}}base-url={{!}}base-label={{!}}''commit=''{{!}}''commit-label=''{{!}}''path=''{{cbr}}? (I suggest named parameters in that one to aid maintenance.  It will rarely if ever be used in any other place that those three templates.)
:::::: It does not have to be there from the beginning and can be added at a later point (I guess that is the wiki equivalent of refactoring ;-) ).
::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 15:33, 11 September 2015 (EDT)
 
::::: Went ahead and added {{tl|flightgear file}}.
::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 16:51, 11 September 2015 (EDT)
 
:::::: I noted that {{tl|readme file}} have a '''nopath=''' parameter stripping off the path in that template if empty.  A similar effect can be added to {{tl|flightgear file}} using the <code><nowiki>{{#tileparts: }}</nowiki></code> parser function without having to introduce a '''file''' parameter.  An elegant solution if needed.
:::::: An even more elegant way could be to use <code><nowiki>{{#tileparts: }}</nowiki></code> to only show the last ''n'' elements.
:::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 17:12, 11 September 2015 (EDT)
 
:::::::* I think {{obr}}'''fgaddon url'''{{cbr}} should be fine as it is about aircraft anyway. However, what if we want to link a certain file in the aircraft's directory, e.g., [[Scripted AI Objects#Aircraft]] (this would probably also go for an FGMEMBERS template)?
:::::::* A styling template would be a good idea in future. I have one query though: what would be the difference between '''base-url=''' and '''base-label=''', and between '''commit=''' and '''commit-label='''?
:::::::* '''nopath=''' is also a good idea.
::::::: Regards,
::::::: [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 16:03, 13 September 2015 (EDT)
 
::::::::* What about doing something similar to the new templates, in essence {{obr}}'''fgaddon url'''{{!}}''aircraft''{{!}}''path''{{!}}''<s>commit</s>revision''{{cbr}}.  Of course for example FGUK's and Helijah's hangars will not handle '''path''' and '''commit''' as those are not repos.
::::::::: The aircraft repo/hangar templates will probably differ somewhat in implementation, but hopefully for a wiki editor they will be rather "orthogonal" (in the sense that they would be usable in a way consistent with similar templates).
::::::::: I guess for aircraft repos, as opposed to hangars, the template with only the '''aircraft''' parameter given should point to that aircraft directory or submodule.  It would also seem reasonable that a template with no parameters given should point to the repo or hangar top directory, info page or something similar.
::::::::* The way I recall having the '''base-url=''' thought up would be as the part of the URL preceding the path given in '''path='''.  Similarly '''base-label=''' would be the part of the label preceding the path.
::::::::: I am not really sure how (and why) I imagined that the commit reference would be different in URL and label.  That would probably not (ever) be needed and only confusing if used.
:::::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 15:50, 15 September 2015 (EDT)
 
:::::::: I have noted that there is a need to be able to link to the tarballs.  I suggest adding a '''tarball=''' property that when not empty will link to the tarball download. (Also mentioned on Template talk:Fgaddon url).
:::::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 07:01, 16 September 2015 (EDT)
 
::::::: {{tl|simgear file}} done. {{done}}
::::::: [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 08:04, 14 September 2015 (EDT)
 
::::::: {{tl|fgdata file}} done. {{done}}
::::::: [[User:Red_Leader|<span style="color:red">'''''Red Leader'''''</span>]] ([[User_talk:Red_Leader|Talk]], [[Special:Contributions/Red_Leader|contribs]]) 09:13, 14 September 2015 (EDT)
 
:::::::: Just remembered a somewhat useful tool when looking for external links to repos to replace with these templates: [[Special:LinkSearch]].  Its main drawback is a large one though:  It only look for domain names, not paths on a web site.  *sigh*  At least there is less than 2000 links to SourceForge, which by far have most links (though most of them developer mailing list posts).
:::::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 16:35, 15 September 2015 (EDT)
 
:::::::: I have noted that the repository templates also may need a '''line=''' and probably also a '''label=''' parameter.  Many articles have links to particular line in a source file and some have links where even a '''nopath=1''' would currently take up too much space (in particular [[Canvas MapStructure Layers]]).
:::::::: In summary there seem to be a few things we have not thought of yet.
:::::::: —[[User:Johan G|Johan G]] ([[User_talk:Johan_G|Talk]] | [[Special:Contributions/Johan_G|contribs]]) 07:01, 16 September 2015 (EDT)

Navigation menu