[web-php] master: link to documentation source file when possible (#434)
| From: | Peter Cowburn via GitHub | Date: | Fri, 13 Aug 2021 11:12:18 +0000 |
| Subject: | [web-php] master: link to documentation source file when possible (#434) | ||
| Groups: | php.webmaster | ||
| Request: | Send a blank email to php-webmaster+get-29528@lists.php.net to get a copy of this message | ||
Author: Peter Cowburn (salathe)
Committer: GitHub (web-flow)
Pusher: salathe
Date: 2021-08-13T12:12:44+01:00
Commit: https://github.com/php/web-php/commit/491af6f1d6fac0964e0e7d9f85da11b95685d3bd
Raw diff: https://github.com/php/web-php/commit/491af6f1d6fac0964e0e7d9f85da11b95685d3bd.diff
link to documentation source file when possible (#434)
Also direct readers to the language-specific repository to
report issues.
Changed paths:
M include/shared-manual.inc
Diff:
diff --git a/include/shared-manual.inc b/include/shared-manual.inc
index 43dc1dfce..25dc9ce48 100644
--- a/include/shared-manual.inc
+++ b/include/shared-manual.inc
@@ -442,14 +442,25 @@ function manual_setup($setup) {
$id = substr($setup['this'][0], 0, -4);
$language_chooser = 'manual_language_chooser';
$repo = strtolower($config['lang']); // pt_BR etc.
+
+ $edit_url = "https://github.com/php/doc-{$repo}";
+ // If the documentation source information is available (generated using
+ // doc-base/configure.php and PhD) then try and make a source-specific URL.
+ if (isset($setup['source'])) {
+ $source_lang = $setup['source']['lang'];
+ if ($source_lang === $repo || $source_lang === 'base') {
+ $edit_url = "https://github.com/php/doc-{$source_lang}/blob/master/{$setup['source']['path']}";
+ }
+ }
+
echo <<<PAGE_TOOLS
<div class="page-tools">
<div class="change-language">
{$language_chooser($config['lang'], $config['thispage'])}
</div>
<div class="edit-bug">
- <a href="https://github.com/php/doc-{$repo}">Submit
a Pull Request</a>
- <a href="https://github.com/php/doc-en/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report
a Bug</a>
+ <a href="{$edit_url}">Submit a Pull Request</a>
+ <a href="https://github.com/php/doc-{$repo}/issues/new?body=From%20manual%20page:%20https:%2F%2Fphp.net%2F$id%0A%0A---">Report
a Bug</a>
</div>
</div>
PAGE_TOOLS;