]> git.mxchange.org Git - friendica.git/commitdiff
Update Module\Help to use anchor words for titles
authorHypolite Petovan <hypolite@mrpetovan.com>
Fri, 6 Dec 2019 00:46:59 +0000 (19:46 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Tue, 10 Dec 2019 03:50:37 +0000 (22:50 -0500)
- Previous anchors are kept for links backward compatibility

doc/Account-Basics.md
doc/Install.md
src/Module/Help.php

index da865ad2b5d4dac7b2bc4689464a3d80c6eac7e4..5e22e8a151fed1c85aa16d1ceebad6f293aba585 100644 (file)
@@ -99,7 +99,7 @@ See Also
 
 * [Profiles](help/Profiles)
 
 
 * [Profiles](help/Profiles)
 
-* [Global Directory](help/Making-Friends#1_1
+* [Global Directory](help/Making-Friends#The+Directories
 
 * [Groups and Privacy](help/Groups-and-Privacy)
 
 
 * [Groups and Privacy](help/Groups-and-Privacy)
 
index 0634a5eb99c2927fdb6e785a119883416d264bbf..5fe63adb2ace61b4afaeeb3a43ce5c51d8200c1d 100644 (file)
@@ -12,7 +12,7 @@ This kind of functionality requires a bit more of the host system than the typic
 Not every PHP/MySQL hosting provider will be able to support Friendica.
 Many will.
 
 Not every PHP/MySQL hosting provider will be able to support Friendica.
 Many will.
 
-But **please** review the [requirements](#1_2_1) and confirm these with your hosting provider prior to installation.
+But **please** review the [requirements](#Requirements) and confirm these with your hosting provider prior to installation.
 
 ## Support
 If you encounter installation issues, please let us know via the [helper](http://forum.friendi.ca/profile/helpers) or the [developer](https://forum.friendi.ca/profile/developers) forum or [file an issue](https://github.com/friendica/friendica/issues).
 
 ## Support
 If you encounter installation issues, please let us know via the [helper](http://forum.friendi.ca/profile/helpers) or the [developer](https://forum.friendi.ca/profile/developers) forum or [file an issue](https://github.com/friendica/friendica/issues).
@@ -108,7 +108,7 @@ Create an empty database and note the access details (hostname, username, passwo
 
 Friendica needs the permission to create and delete fields and tables in its own database.
 
 
 Friendica needs the permission to create and delete fields and tables in its own database.
 
-Please check the [troubleshooting](#1_6) section if running on MySQL 5.7.17 or newer.
+Please check the [troubleshooting](#Troubleshooting) section if running on MySQL 5.7.17 or newer.
 
 ### Option A: Run the installer
 
 
 ### Option A: Run the installer
 
index 3b3ce58704663cc6422e5da1284fafe04d5e0224..58cc95affd33c9d070346fab82be155fce2495af 100644 (file)
@@ -65,10 +65,11 @@ class Help extends BaseModule
                        $lastLevel = 1;
                        $idNum = [0, 0, 0, 0, 0, 0, 0];
                        foreach ($lines as &$line) {
                        $lastLevel = 1;
                        $idNum = [0, 0, 0, 0, 0, 0, 0];
                        foreach ($lines as &$line) {
-                               if (substr($line, 0, 2) == "<h") {
-                                       $level = substr($line, 2, 1);
-                                       if ($level != "r") {
-                                               $level = intval($level);
+                               $matches = [];
+                               foreach ($lines as &$line) {
+                                       if (preg_match('#<h([1-6])>([^<]+?)</h\1>#i', $line, $matches)) {
+                                               $level = $matches[1];
+                                               $anchor = urlencode($matches[2]);
                                                if ($level < $lastLevel) {
                                                        for ($k = $level; $k < $lastLevel; $k++) {
                                                                $toc .= "</ul></li>";
                                                if ($level < $lastLevel) {
                                                        for ($k = $level; $k < $lastLevel; $k++) {
                                                                $toc .= "</ul></li>";
@@ -84,10 +85,13 @@ class Help extends BaseModule
                                                }
 
                                                $idNum[$level] ++;
                                                }
 
                                                $idNum[$level] ++;
+
+                                               $href = $a->getBaseURL() . "/help/{$filename}#{$anchor}";
+                                               $toc .= "<li><a href=\"{$href}\">" . strip_tags($line) . "</a></li>";
                                                $id = implode("_", array_slice($idNum, 1, $level));
                                                $id = implode("_", array_slice($idNum, 1, $level));
-                                               $href = $a->getBaseURL() . "/help/{$filename}#{$id}";
-                                               $toc .= "<li><a href='{$href}'>" . strip_tags($line) . "</a></li>";
-                                               $line = "<a name='{$id}'></a>" . $line;
+                                               $line = "<a name=\"{$id}\"></a>" . $line;
+                                               $line = "<a name=\"{$anchor}\"></a>" . $line;
+
                                                $lastLevel = $level;
                                        }
                                }
                                                $lastLevel = $level;
                                        }
                                }