20,741
edits
(→tag) |
|||
Line 49: | Line 49: | ||
xlink:href="https://forum.flightgear.org/styles/flightgear/theme/images/logoF.png" /> | xlink:href="https://forum.flightgear.org/styles/flightgear/theme/images/logoF.png" /> | ||
</svg> | </svg> | ||
</syntaxhighlight> | |||
By default, the svg parser will bail out with a message saying '''Skipping unknown element image'''. Thus, we need to open $FG_ROOT/Nasal/canvas/svg.nas and navigate to the line where that error is triggered: | |||
<syntaxhighlight lang="nasal"> | |||
else | |||
{ | |||
printlog("info", "Skipping unknown element '" ~ name ~ "'"); | |||
skip = level; | |||
return; | |||
} | |||
</syntaxhighlight> | |||
So, the next step is prepending a new conditional block that looks specifically for the new tag that we'd like to see supported, e.g.: | |||
<syntaxhighlight lang="nasal"> | |||
else if (name == "image") | |||
{ | |||
printlog("alert", "image tag encountered (not yet implemented)"); | |||
} | |||
</syntaxhighlight> | |||
Or as a diff/patch: | |||
<syntaxhighlight lang="diff"> | |||
diff --git a/Nasal/canvas/svg.nas b/Nasal/canvas/svg.nas | |||
index d7fe570..c1b4a90 100644 | |||
--- a/Nasal/canvas/svg.nas | |||
+++ b/Nasal/canvas/svg.nas | |||
@@ -578,6 +578,10 @@ var parsesvg = func(group, path, options = nil) | |||
append(defs_stack, "defs"); | |||
return; | |||
} | |||
+ else if (name == "image") | |||
+ { | |||
+ printlog("alert", "image tag encountered (not yet implemented)"); | |||
+ } | |||
else | |||
{ | |||
printlog("info", "Skipping unknown element '" ~ name ~ "'"); | |||
</syntaxhighlight> | </syntaxhighlight> |