Bugfixes to documentation builders
This commit is contained in:
parent
8aae939d7d
commit
8a04c809f8
@ -13,6 +13,8 @@ If not, see <http://www.gnu.org/licenses/>.
|
|||||||
require 'vendor/autoload.php';
|
require 'vendor/autoload.php';
|
||||||
$param = 1;
|
$param = 1;
|
||||||
\danog\MadelineProto\Logger::constructor($param);
|
\danog\MadelineProto\Logger::constructor($param);
|
||||||
|
$logger = \danog\MadelineProto\Logger::$default;
|
||||||
|
|
||||||
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
set_error_handler(['\danog\MadelineProto\Exception', 'ExceptionErrorHandler']);
|
||||||
|
|
||||||
\danog\MadelineProto\Logger::log('Copying readme...', \danog\MadelineProto\Logger::NOTICE);
|
\danog\MadelineProto\Logger::log('Copying readme...', \danog\MadelineProto\Logger::NOTICE);
|
||||||
@ -71,10 +73,10 @@ description: Documentation of old mtproto layers
|
|||||||
|
|
||||||
'.$layer_list);
|
'.$layer_list);
|
||||||
|
|
||||||
$doc = new \danog\MadelineProto\AnnotationsBuilder($docs[2]);
|
$doc = new \danog\MadelineProto\AnnotationsBuilder($logger, $docs[2]);
|
||||||
$doc->mk_annotations();
|
$doc->mk_annotations();
|
||||||
|
|
||||||
foreach ($docs as $settings) {
|
foreach ($docs as $settings) {
|
||||||
$doc = new \danog\MadelineProto\DocsBuilder($settings);
|
$doc = new \danog\MadelineProto\DocsBuilder($logger, $settings);
|
||||||
$doc->mk_docs();
|
$doc->mk_docs();
|
||||||
}
|
}
|
||||||
|
2
docs
2
docs
@ -1 +1 @@
|
|||||||
Subproject commit 3a5b18f742fa7f2898562aa3e9d7d20a2634bf69
|
Subproject commit 06370b82769bf4182fe5919e2f3f5f37efc8b5a0
|
@ -20,8 +20,9 @@ class AnnotationsBuilder
|
|||||||
use \danog\MadelineProto\TL\TL;
|
use \danog\MadelineProto\TL\TL;
|
||||||
use Tools;
|
use Tools;
|
||||||
|
|
||||||
public function __construct($settings)
|
public function __construct($logger, $settings)
|
||||||
{
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
$this->construct_TL($settings['tl_schema']);
|
$this->construct_TL($settings['tl_schema']);
|
||||||
$this->settings = $settings;
|
$this->settings = $settings;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,9 @@ class DocsBuilder
|
|||||||
use Tools;
|
use Tools;
|
||||||
public $td = false;
|
public $td = false;
|
||||||
|
|
||||||
public function __construct($settings)
|
public function __construct($logger, $settings)
|
||||||
{
|
{
|
||||||
|
$this->logger = $logger;
|
||||||
set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
|
set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
|
||||||
$this->construct_TL($settings['tl_schema']);
|
$this->construct_TL($settings['tl_schema']);
|
||||||
if (isset($settings['tl_schema']['td']) && !isset($settings['tl_schema']['telegram'])) {
|
if (isset($settings['tl_schema']['td']) && !isset($settings['tl_schema']['telegram'])) {
|
||||||
@ -446,7 +447,15 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
|||||||
## Type: bytes
|
## Type: bytes
|
||||||
[Back to constructor index](index.md)
|
[Back to constructor index](index.md)
|
||||||
|
|
||||||
A string of bytes of variable length, with length smaller than or equal to 16777215.
|
An object of type `\danog\MadelineProto\TL\Types\Bytes`.
|
||||||
|
When casted to string, turns into a string of bytes of variable length, with length smaller than or equal to 16777215.
|
||||||
|
When JSON-serialized, turns into an array of the following format:
|
||||||
|
```
|
||||||
|
[
|
||||||
|
\'_\' => \'bytes\',
|
||||||
|
\'bytes\' => base64_encode($contents)
|
||||||
|
];
|
||||||
|
```
|
||||||
');
|
');
|
||||||
file_put_contents('types/int.md', '---
|
file_put_contents('types/int.md', '---
|
||||||
title: integer
|
title: integer
|
||||||
|
@ -161,7 +161,8 @@ trait Constructors
|
|||||||
}
|
}
|
||||||
$table .= PHP_EOL;
|
$table .= PHP_EOL;
|
||||||
$pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
|
$pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
|
||||||
$ppptype = in_array($ptype, ['string', 'bytes']) ? '"'.$ptype.'"' : $ptype;
|
$ppptype = in_array($ptype, ['string']) ? '"'.$ptype.'"' : $ptype;
|
||||||
|
$ppptype = in_array($ptype, ['bytes']) ? '{"_": "bytes", "bytes":"base64 encoded '.$ptype.'"}' : $ppptype;
|
||||||
$params .= ", '".$param['name']."' => ";
|
$params .= ", '".$param['name']."' => ";
|
||||||
$params .= isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype;
|
$params .= isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype;
|
||||||
$lua_params .= ', '.$param['name'].'=';
|
$lua_params .= ', '.$param['name'].'=';
|
||||||
|
@ -144,7 +144,9 @@ trait Methods
|
|||||||
}
|
}
|
||||||
$table .= PHP_EOL;
|
$table .= PHP_EOL;
|
||||||
$pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
|
$pptype = in_array($ptype, ['string', 'bytes']) ? "'".$ptype."'" : $ptype;
|
||||||
$ppptype = in_array($ptype, ['string', 'bytes']) ? '"'.$ptype.'"' : $ptype;
|
$ppptype = in_array($ptype, ['string']) ? '"'.$ptype.'"' : $ptype;
|
||||||
|
$ppptype = in_array($ptype, ['bytes']) ? '{"_": "bytes", "bytes":"base64 encoded '.$ptype.'"}' : $ppptype;
|
||||||
|
|
||||||
$params .= "'".$param['name']."' => ";
|
$params .= "'".$param['name']."' => ";
|
||||||
$params .= (isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype).', ';
|
$params .= (isset($param['subtype']) ? '['.$pptype.', '.$pptype.']' : $pptype).', ';
|
||||||
$json_params .= '"'.$param['name'].'": '.(isset($param['subtype']) ? '['.$ppptype.']' : $ppptype).', ';
|
$json_params .= '"'.$param['name'].'": '.(isset($param['subtype']) ? '['.$ppptype.']' : $ppptype).', ';
|
||||||
|
Loading…
x
Reference in New Issue
Block a user