Fix Java and .NET documentation generators.

GitOrigin-RevId: 22fcce7801c8086b7f104976dfd1817651f8e163
This commit is contained in:
levlam 2019-01-07 04:32:49 +03:00
parent a062fa4f0c
commit 226badc39e
3 changed files with 14 additions and 6 deletions

View File

@ -6,9 +6,13 @@ class DotnetTlDocumentationGenerator extends TlDocumentationGenerator
{ {
protected function escapeDocumentation($doc) protected function escapeDocumentation($doc)
{ {
$doc = preg_replace_callback('/(?<!["A-Za-z_])[A-Za-z]*_[A-Za-z_]*/',
function ($word_matches)
{
return ucfirst(preg_replace_callback('/_([A-Za-z])/', function ($matches) {return strtoupper($matches[1]);}, $word_matches[0]));
}, $doc);
$doc = htmlspecialchars($doc, ENT_XML1); $doc = htmlspecialchars($doc, ENT_XML1);
$doc = str_replace('*/', '*&#47;', $doc); $doc = str_replace('*/', '*&#47;', $doc);
$doc = preg_replace_callback('/(?<!")_([A-Za-z])/', function ($matches) {return strtoupper($matches[1]);}, $doc);
return $doc; return $doc;
} }

View File

@ -10,9 +10,13 @@ class JavadocTlDocumentationGenerator extends TlDocumentationGenerator
protected function escapeDocumentation($doc) protected function escapeDocumentation($doc)
{ {
$doc = preg_replace_callback('/(?<!["A-Za-z_])[A-Za-z]*_[A-Za-z_]*/',
function ($word_matches)
{
return preg_replace_callback('/_([A-Za-z])/', function ($matches) {return strtoupper($matches[1]);}, $word_matches[0]);
}, $doc);
$doc = htmlspecialchars($doc); $doc = htmlspecialchars($doc);
$doc = str_replace('*/', '*&#47;', $doc); $doc = str_replace('*/', '*&#47;', $doc);
$doc = preg_replace_callback('/(?<!")_([A-Za-z])/', function ($matches) {return strtoupper($matches[1]);}, $doc);
return $doc; return $doc;
} }
@ -88,13 +92,13 @@ class JavadocTlDocumentationGenerator extends TlDocumentationGenerator
protected function needSkipLine($line) protected function needSkipLine($line)
{ {
$line = trim($line); $line = $this->fixLine(trim($line));
return strpos($line, 'public') !== 0 && !$this->isHeaderLine($line); return (strpos($line, 'public') !== 0 && !$this->isHeaderLine($line)) || $line === 'public @interface Constructors {}';
} }
protected function isHeaderLine($line) protected function isHeaderLine($line)
{ {
return trim($line) === '@Override'; return trim($line) === '@Override' || trim($line) === '@Constructors';
} }
protected function extractClassName($line) protected function extractClassName($line)

View File

@ -2693,7 +2693,7 @@ sendBotStartMessage bot_user_id:int32 chat_id:int53 parameter:string = Message;
//@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message @chat_id Target chat @reply_to_message_id Identifier of a message to reply to or 0 //@description Sends the result of an inline query as a message. Returns the sent message. Always clears a chat draft message @chat_id Target chat @reply_to_message_id Identifier of a message to reply to or 0
//@disable_notification Pass true to disable notification for the message. Not supported in secret chats @from_background Pass true if the message is sent from background //@disable_notification Pass true to disable notification for the message. Not supported in secret chats @from_background Pass true if the message is sent from background
//@query_id Identifier of the inline query @result_id Identifier of the inline result //@query_id Identifier of the inline query @result_id Identifier of the inline result
//@hide_via_bot If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots getOption('animation_search_bot_username'), getOption('photo_search_bot_username') and getOption('venue_search_bot_username') //@hide_via_bot If true, there will be no mention of a bot, via which the message is sent. Can be used only for bots GetOption("animation_search_bot_username"), GetOption("photo_search_bot_username") and GetOption("venue_search_bot_username")
sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool query_id:int64 result_id:string hide_via_bot:Bool = Message; sendInlineQueryResultMessage chat_id:int53 reply_to_message_id:int53 disable_notification:Bool from_background:Bool query_id:int64 result_id:string hide_via_bot:Bool = Message;
//@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message //@description Forwards previously sent messages. Returns the forwarded messages in the same order as the message identifiers passed in message_ids. If a message can't be forwarded, null will be returned instead of the message