Make edit URL pattern configurable
There are far too many git hosts, including enterprise and personal ones, for us to be able to get the edit URL right in all cases. Therefore, the edit URL pattern should be configurable as part of the content source in the playbook via the edit_url_pattern
property.
Adding a edit_url_pattern
property the content source is the easy part. The harder part is figuring out a syntax for the replacements. We need at least two replacements (based on the hosts currently supported):
- ref - the short name of the reference, such as master or v1.0.x
- path - the path from the root of the repository
Although the ref usually comes before the path in the URL, we probably shouldn't make that assumption. Therefore, we probably want named replacements. I propose a simple syntax that resembles AsciiDoc attribute references (since that's our game).
content:
sources:
- url: git@pagure.io:fedora-docs/quick-docs.git
edit_url_pattern: https://pagure.io/fedora-docs/quick-docs/blob/{ref}/f/{path}
In the future, we might be able to offer a replacement for the qualified repository path (e.g., fedora-docs/quick-docs) to save some typing.