mirror of
https://gitlab.gnome.org/jwestman/blueprint-compiler.git
synced 2025-05-04 15:59:08 -04:00
Add Gtk.Scale mark syntax
This commit is contained in:
parent
83d11ccb8c
commit
5a782c653b
12 changed files with 242 additions and 5 deletions
|
@ -147,9 +147,11 @@ class XmlOutput(OutputFormat):
|
|||
raise CompilerBugError()
|
||||
|
||||
def _translated_string_attrs(
|
||||
self, translated: T.Union[QuotedLiteral, Translated]
|
||||
self, translated: T.Optional[T.Union[QuotedLiteral, Translated]]
|
||||
) -> T.Dict[str, T.Optional[str]]:
|
||||
if isinstance(translated, QuotedLiteral):
|
||||
if translated is None:
|
||||
return {}
|
||||
elif isinstance(translated, QuotedLiteral):
|
||||
return {}
|
||||
else:
|
||||
return {"translatable": "true", "context": translated.translate_context}
|
||||
|
@ -350,6 +352,20 @@ class XmlOutput(OutputFormat):
|
|||
xml.end_tag()
|
||||
xml.end_tag()
|
||||
|
||||
elif isinstance(extension, ExtScaleMarks):
|
||||
xml.start_tag("marks")
|
||||
for mark in extension.children:
|
||||
xml.start_tag(
|
||||
"mark",
|
||||
value=mark.value,
|
||||
position=mark.position,
|
||||
**self._translated_string_attrs(mark.label and mark.label.child),
|
||||
)
|
||||
if mark.label is not None:
|
||||
xml.put_text(mark.label.string)
|
||||
xml.end_tag()
|
||||
xml.end_tag()
|
||||
|
||||
elif isinstance(extension, ExtStringListStrings):
|
||||
xml.start_tag("items")
|
||||
for string in extension.children:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue