mirror of
https://github.com/danog/MadelineProto.git
synced 2024-11-30 07:58:58 +01:00
Improve documentation builder
This commit is contained in:
parent
d088f5e009
commit
6dd180542e
@ -60,7 +60,6 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
|
|||||||
* [Simple (manual)](https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple-manual)
|
* [Simple (manual)](https://docs.madelineproto.xyz/docs/INSTALLATION.html#simple-manual)
|
||||||
* [Composer from scratch](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-scratch)
|
* [Composer from scratch](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-scratch)
|
||||||
* [Composer from existing project](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-existing-project)
|
* [Composer from existing project](https://docs.madelineproto.xyz/docs/INSTALLATION.html#composer-from-existing-project)
|
||||||
* [Git](https://docs.madelineproto.xyz/docs/INSTALLATION.html#git)
|
|
||||||
* [Handling updates](https://docs.madelineproto.xyz/docs/UPDATES.html)
|
* [Handling updates](https://docs.madelineproto.xyz/docs/UPDATES.html)
|
||||||
* [Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#event-driven)
|
* [Event driven](https://docs.madelineproto.xyz/docs/UPDATES.html#event-driven)
|
||||||
* [Event driven multithreaded](https://docs.madelineproto.xyz/docs/UPDATES.html#event-driven-multithreaded)
|
* [Event driven multithreaded](https://docs.madelineproto.xyz/docs/UPDATES.html#event-driven-multithreaded)
|
||||||
@ -78,7 +77,9 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
|
|||||||
* [Avoiding FLOOD_WAITs](https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html)
|
* [Avoiding FLOOD_WAITs](https://docs.madelineproto.xyz/docs/FLOOD_WAIT.html)
|
||||||
* [Logging](https://docs.madelineproto.xyz/docs/LOGGING.html)
|
* [Logging](https://docs.madelineproto.xyz/docs/LOGGING.html)
|
||||||
* [Using methods](https://docs.madelineproto.xyz/docs/USING_METHODS.html)
|
* [Using methods](https://docs.madelineproto.xyz/docs/USING_METHODS.html)
|
||||||
|
* [FULL API Documentation with descriptions](https://docs.madelineproto.xyz/API_docs/methods)
|
||||||
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
* [Peers](https://docs.madelineproto.xyz/docs/USING_METHODS.html#peers)
|
||||||
|
* [Files](https://docs.madelineproto.xyz/docs/FILES.html)
|
||||||
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
|
* [Secret chats](https://docs.madelineproto.xyz/docs/USING_METHODS.html#secret-chats)
|
||||||
* [Entities (Markdown & HTML)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#entities)
|
* [Entities (Markdown & HTML)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#entities)
|
||||||
* [reply_markup (keyboards & inline keyboards)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#reply_markup)
|
* [reply_markup (keyboards & inline keyboards)](https://docs.madelineproto.xyz/docs/USING_METHODS.html#reply_markup)
|
||||||
@ -132,7 +133,6 @@ Tip: if you receive an error (or nothing), [send us](https://t.me/pwrtelegramgro
|
|||||||
* [Credits](https://docs.madelineproto.xyz/docs/CONTRIB.html#credits)
|
* [Credits](https://docs.madelineproto.xyz/docs/CONTRIB.html#credits)
|
||||||
* [Web templates for `$MadelineProto->start()`](https://docs.madelineproto.xyz/docs/TEMPLATES.html)
|
* [Web templates for `$MadelineProto->start()`](https://docs.madelineproto.xyz/docs/TEMPLATES.html)
|
||||||
|
|
||||||
|
|
||||||
## Very complex and complete examples
|
## Very complex and complete examples
|
||||||
|
|
||||||
You can find examples for nearly every MadelineProto function in
|
You can find examples for nearly every MadelineProto function in
|
||||||
|
@ -57,6 +57,19 @@ foreach ($orderedfiles as $key => $filename) {
|
|||||||
while (end($lines) === '' || strpos(end($lines), 'Next')) {
|
while (end($lines) === '' || strpos(end($lines), 'Next')) {
|
||||||
unset($lines[count($lines) - 1]);
|
unset($lines[count($lines) - 1]);
|
||||||
}
|
}
|
||||||
|
if ($lines[0] === '---') {
|
||||||
|
array_shift($lines);
|
||||||
|
while ($lines[0] !== '---') {
|
||||||
|
array_shift($lines);
|
||||||
|
}
|
||||||
|
array_shift($lines);
|
||||||
|
}
|
||||||
|
preg_match('|^# (.*)|', $lines[0], $matches);
|
||||||
|
$title = $matches[1];
|
||||||
|
$description = $lines[2];
|
||||||
|
|
||||||
|
array_unshift($lines, '---', 'title: '.$title, 'description: '.$description, 'image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png', '---');
|
||||||
|
|
||||||
if (isset($orderedfiles[$key + 1])) {
|
if (isset($orderedfiles[$key + 1])) {
|
||||||
$nextfile = 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key + 1], '.md').'.html';
|
$nextfile = 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key + 1], '.md').'.html';
|
||||||
$prevfile = $key === 0 ? 'https://docs.madelineproto.xyz' : 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key - 1], '.md').'.html';
|
$prevfile = $key === 0 ? 'https://docs.madelineproto.xyz' : 'https://docs.madelineproto.xyz/docs/'.basename($orderedfiles[$key - 1], '.md').'.html';
|
||||||
@ -66,18 +79,33 @@ foreach ($orderedfiles as $key => $filename) {
|
|||||||
}
|
}
|
||||||
file_put_contents($filename, implode("\n", $lines));
|
file_put_contents($filename, implode("\n", $lines));
|
||||||
|
|
||||||
preg_match('|^# (.*)|', $file = file_get_contents($filename), $matches);
|
$file = file_get_contents($filename);
|
||||||
$title = $matches[1];
|
|
||||||
preg_match_all('|( *)\* \[(.*)\]\(#(.*)\)|', $file, $matches);
|
preg_match_all('|( *)\* \[(.*)\]\((.*)\)|', $file, $matches);
|
||||||
$file = 'https://docs.madelineproto.xyz/docs/'.basename($filename, '.md').'.html';
|
$file = 'https://docs.madelineproto.xyz/docs/'.basename($filename, '.md').'.html';
|
||||||
$index .= "* [$title]($file)\n";
|
$index .= "* [$title]($file)\n";
|
||||||
if (basename($filename) !== 'FEATURES.md') {
|
if (basename($filename) !== 'FEATURES.md') {
|
||||||
foreach ($matches[1] as $key => $match) {
|
foreach ($matches[1] as $key => $match) {
|
||||||
$spaces = " $match";
|
$spaces = " $match";
|
||||||
$name = $matches[2][$key];
|
$name = $matches[2][$key];
|
||||||
$url = $file.'#'.$matches[3][$key];
|
$url = $matches[3][$key][0] === '#' ? $file.$matches[3][$key] : $matches[3][$key];
|
||||||
$index .= "$spaces* [$name]($url)\n";
|
$index .= "$spaces* [$name]($url)\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
echo $index;
|
|
||||||
|
$readme = explode("## ", file_get_contents('README.md'));
|
||||||
|
foreach ($readme as &$section) {
|
||||||
|
if (explode("\n", $section)[0] === 'Documentation') {
|
||||||
|
$section = "Documentation\n\n".$index."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$readme = implode("## ", $readme);
|
||||||
|
|
||||||
|
file_put_contents('README.md', $readme);
|
||||||
|
file_put_contents('docs/docs/index.md', "---
|
||||||
|
title: MadelineProto documentation
|
||||||
|
description: PHP client/server for the telegram MTProto protocol (a better tg-cli)
|
||||||
|
image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
||||||
|
---
|
||||||
|
".$readme);
|
||||||
|
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit d7fb09c3cae7e41d66d4ce86e0cfc48255b27122
|
Subproject commit b6152298e377fe696e67971d889833fa1f36da8e
|
Loading…
Reference in New Issue
Block a user