mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-27 18:20:08 +02:00
[ticket/16752] Add methods for exporting events to rst by script
PHPBB3-16752
This commit is contained in:
@@ -243,7 +243,7 @@ class md_exporter
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the php events as a wiki table
|
||||
* Format the md events as a wiki table
|
||||
*
|
||||
* @param string $action
|
||||
* @return string Number of events found
|
||||
@@ -298,6 +298,71 @@ class md_exporter
|
||||
return $wiki_page;
|
||||
}
|
||||
|
||||
/**
|
||||
* Format the md events as a rst table
|
||||
*
|
||||
* @param string $action
|
||||
* @return string Number of events found
|
||||
*/
|
||||
public function export_events_for_rst(string $action = ''): string
|
||||
{
|
||||
$rst_exporter = new rst_exporter();
|
||||
|
||||
if ($this->filter === 'adm')
|
||||
{
|
||||
if ($action === 'diff')
|
||||
{
|
||||
$rst_exporter->add_section_header('h3', 'ACP Template Events');
|
||||
}
|
||||
else
|
||||
{
|
||||
$rst_exporter->add_section_header('h2', 'ACP Template Events');
|
||||
}
|
||||
|
||||
$rst_exporter->set_columns([
|
||||
'event' => 'Identifier',
|
||||
'files' => 'Placement',
|
||||
'since' => 'Added in Release',
|
||||
'description' => 'Explanation',
|
||||
]);
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($action === 'diff')
|
||||
{
|
||||
$rst_exporter->add_section_header('h3', 'Template Events');
|
||||
}
|
||||
else
|
||||
{
|
||||
$rst_exporter->add_section_header('h2', 'Template Events');
|
||||
}
|
||||
|
||||
$rst_exporter->set_columns([
|
||||
'event' => 'Identifier',
|
||||
'files' => 'Prosilver Placement (If applicable)',
|
||||
'since' => 'Added in Release',
|
||||
'description' => 'Explanation',
|
||||
]);
|
||||
}
|
||||
|
||||
$events = [];
|
||||
foreach ($this->events as $event_name => $event)
|
||||
{
|
||||
$files = $this->filter === 'adm' ? implode(', ', $event['files']['adm']) : implode(', ', $event['files']['prosilver']);
|
||||
|
||||
$events[] = [
|
||||
'event' => $event_name,
|
||||
'files' => $files,
|
||||
'since' => $event['since'],
|
||||
'description' => str_replace("\n", '<br>', rtrim($event['description'])),
|
||||
];
|
||||
}
|
||||
|
||||
$rst_exporter->generate_events_table($events);
|
||||
|
||||
return $rst_exporter->get_rst_output();
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates a template event name
|
||||
*
|
||||
|
Reference in New Issue
Block a user