This commit is contained in:
Daniil Gentili 2017-08-25 15:06:04 +02:00
commit 691426ae3a
4 changed files with 35 additions and 34 deletions

View File

@ -30,7 +30,7 @@ $docs = [
'description' => 'MadelineProto API documentation (td-lib)',
'output_dir' => __DIR__.'/docs/TD_docs',
'readme' => false,
'td' => true
'td' => true,
],
[
'tl_schema' => ['mtproto' => __DIR__.'/src/danog/MadelineProto/TL_mtproto_v1.json'],

View File

@ -126,9 +126,8 @@ description: constructors and methods of type '.$type.'
$header .= isset($this->td_descriptions['types'][$otype]) ? $this->td_descriptions['types'][$otype].PHP_EOL.PHP_EOL : '';
if (!isset($this->settings['td'])) {
if (in_array($type, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])) {
$header .= 'The following syntaxes can also be used:
if (in_array($type, ['User', 'InputUser', 'Chat', 'InputChannel', 'Peer', 'InputPeer'])) {
$header .= 'The following syntaxes can also be used:
```
$'.$type." = '@username'; // Username
@ -146,9 +145,9 @@ A [Chat](Chat.md), a [User](User.md), an [InputPeer](InputPeer.md), an [InputUse
";
}
if (in_array($type, ['InputEncryptedChat'])) {
$header .= 'The following syntax can also be used:
}
if (in_array($type, ['InputEncryptedChat'])) {
$header .= 'The following syntax can also be used:
```
$'.$type.' = -147286699; // Numeric chat id returned by request_secret_chat, can be positive or negative
@ -156,9 +155,9 @@ $'.$type.' = -147286699; // Numeric chat id returned by request_secret_chat, can
';
}
if (in_array($type, ['KeyboardButton'])) {
$header .= 'Clicking these buttons:
}
if (in_array($type, ['KeyboardButton'])) {
$header .= 'Clicking these buttons:
To click these buttons simply run the `click` method:
@ -179,7 +178,7 @@ $result = $'.$type.'->click();
';
}
}
}
$constructors = '### Possible values (constructors):
@ -192,10 +191,10 @@ $result = $'.$type.'->click();
';
if (!isset($this->settings['td'])) {
if (in_array($type, ['PhoneCall'])) {
$methods = '';
$constructors = '';
$header .= 'This is an object of type `\danog\MadelineProto\VoIP`.
if (in_array($type, ['PhoneCall'])) {
$methods = '';
$constructors = '';
$header .= 'This is an object of type `\danog\MadelineProto\VoIP`.
It will only be available if the [php-libtgvoip](https://github.com/danog/php-libtgvoip) extension is installed, see [the main docs](https://daniil.it/MadelineProto#calls) for an easy installation script.
@ -373,7 +372,8 @@ Note: when modifying this property, *never* overwrite the previous values. Alway
After modifying it, you must always parse the new configuration with a call to `parseConfig`.
';
}}
}
}
if (file_exists('types/'.$type.'.md')) {
\danog\MadelineProto\Logger::log([$type]);
}

View File

@ -157,8 +157,7 @@ description: '.$description.'
';
$example = '';
if (!isset($this->settings['td'])) {
$example = '### Example:
$example = '### Example:
```
$'.$constructor.$layer.' = '.$params.';
@ -182,17 +181,17 @@ Or, if you\'re into Lua:
';
if ($hasreplymarkup) {
$example .= '
if ($hasreplymarkup) {
$example .= '
## Usage of reply_markup
You can provide bot API reply_markup objects here.
';
}
if ($hasentities) {
$example .= '
}
if ($hasentities) {
$example .= '
## Usage of parse_mode:
Set parse_mode to html to enable HTML parsing of the message.
@ -224,7 +223,8 @@ You can also use normal markdown, note that to create mentions you must use the
MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php).
';
}}
}
}
file_put_contents('constructors/'.$constructor.$layer.'.md', $header.$table.$type.$example);
}
\danog\MadelineProto\Logger::log(['Generating constructors index...'], \danog\MadelineProto\Logger::NOTICE);

View File

@ -166,7 +166,7 @@ description: '.$description.'
';
$example = '';
if (!isset($this->settings['td'])) {
$example = str_replace('[]', '', '### Example:
$example = str_replace('[]', '', '### Example:
```
@ -216,26 +216,26 @@ Or, if you\'re into Lua:
```
');
if ($hasreplymarkup) {
$example .= '
if ($hasreplymarkup) {
$example .= '
## Usage of reply_markup
You can provide bot API reply_markup objects here.
';
}
if ($hasmessage) {
$example .= '
}
if ($hasmessage) {
$example .= '
## Return value
If the length of the provided message is bigger than 4096, the message will be split in chunks and the method will be called multiple times, with the same parameters (except for the message), and an array of ['.str_replace('_', '\_', $type).'](../types/'.$php_type.'.md) will be returned instead.
';
}
if ($hasentities) {
$example .= '
}
if ($hasentities) {
$example .= '
## Usage of parse_mode:
Set parse_mode to html to enable HTML parsing of the message.
@ -267,7 +267,8 @@ You can also use normal markdown, note that to create mentions you must use the
MadelineProto supports all html entities supported by [html_entity_decode](http://php.net/manual/en/function.html-entity-decode.php).
';
}}
}
}
file_put_contents('methods/'.$method.'.md', $header.$table.$return.$example);
}