-
Notifications
You must be signed in to change notification settings - Fork 13.5k
[clang-doc] --repository links don't work with github #59814
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing #59814.
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing #59814.
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing #59814.
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing #59814.
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing #59814.
The current check in writeFileDefinition() is incorrect, and prevents us from ever emitting the URL from the clang-doc tool. The unit tests do test this, but call the API directly circumventing the check. This is the first step towards addressing llvm#59814.
@ilovepi Can I be assigned to this issue? Please give me more details about it also. |
As I read in 1a7e79b, we can parse the URL of the repo and detect if it's a host that has a prefix or not, such as GitHub or Gitlab (they also use |
@hulxv So the basic problem seems to be that the current implementation assumes how this will be spelled, which is problematic. To start, I'd suggest adding a configuration option to set this, via command line option, and then follow up with some kind of detection heuristic in a second patch. |
Do you mean adding an argument to change the line anchor manually from the user? like My first idea is doing something like that, and listing prefixes of each host. Is it not better? static std::string getLineAnchor(const llvm::StringRef RepositoryUrl,
int LineNumber) {
const std::unordered_map<std::string, std::string> SpecialRepoAnchorMap = {
{"github.com", "L"},
{"gitlab.com", "L"},
// etc....
};
for (const auto &entry : SpecialRepoAnchorMap) {
if (RepositoryUrl.contains(entry.first))
return "#" + entry.second + std::to_string(LineNumber);
}
return "#" + std::to_string(LineNumber); // default prefixe
} |
The generated links are of the form https://repository/path.h#22
However github requires the URL fragmment to be
L22
not22
, so it should be https://repository/path.h#L22A configuration option to adjust the url fragment would be appreciated.
The text was updated successfully, but these errors were encountered: