Move to namespace specific svg annotations #1

Merged
jgeorgi merged 5 commits from nsannot into main 2026-05-19 22:28:12 +00:00
6 changed files with 189 additions and 193 deletions
Showing only changes of commit 15f77d45ba - Show all commits

View File

@@ -61,13 +61,16 @@ class AnnotationHandler extends CodeContentHandler {
}
protected function fillParserOutput( Content $content, ContentParseParams $cpoParams, ParserOutput &$output ) {
parent::fillParserOutput( $content, $cpoParams, $output );
self::console_log('Parsing the fucking thing', true);
$metadata = toml_decode($content->getNativeData(), true);
self::console_log(var_dump($metadata), true);
$metadata = toml_decode($content->getText(), true);
self::console_log(print_r($metadata, true), true);
if (isset($metadata['baseImage'])) {
$baseImage = MediaWikiServices::getInstance()->getRepoGroup()->findFile('File:' . $metadata['baseImage']);
$imageTitle = Title::makeTitleSafe( NS_FILE, $metadata['baseImage'] );
$baseImage = MediaWikiServices::getInstance()->getRepoGroup()->findFile($imageTitle);
self::console_log($baseImage->getFullUrl(), true);
} else {
$baseImage = false;
}
@@ -82,11 +85,10 @@ class AnnotationHandler extends CodeContentHandler {
* and produces the html string for the svg with base image and annotations.
*
* @param string $metadata The metadata object parsed from the text
* @param string $baseImage The full url pointing to the base image to annotate
* @param File $baseImage The full url pointing to the base image to annotate
* @return string Html string of the complete svg
*/
private function buildSvg($metadata, $baseImage) {
self::console_log(var_dump($baseImage), true);
//Gather basic data
$elBaseImg = '';
$vbHeight = 100;