python/moz/l10n/formats/dtd/serialize.py [28:54]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    resource: Resource[str] | Resource[Message],
    trim_comments: bool = False,
) -> Iterator[str]:
    """
    Serialize a resource as the contents of a DTD file.

    Section identifiers will be prepended to their constituent message identifiers.
    Multi-part identifiers will be joined with `.` between each part.

    Metadata is not supported.

    Yields each entity, comment, and empty line separately.
    Re-parsing a serialized DTD file is not guaranteed to result in the same Resource,
    as the serialization may lose information about message sections and metadata.
    """

    at_empty_line = True

    def comment(comment: str, meta: Any, standalone: bool) -> Iterator[str]:
        nonlocal at_empty_line
        if trim_comments:
            return
        if meta:
            raise ValueError("Metadata is not supported")
        if comment:
            if standalone and not at_empty_line:
                yield "\n"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



python/moz/l10n/formats/ini/serialize.py [25:53]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    resource: Resource[str] | Resource[Message],
    trim_comments: bool = False,
) -> Iterator[str]:
    """
    Serialize a resource as the contents of an .ini file.

    Anonymous sections are not supported.
    Multi-part section and message identifiers will be joined with `.` between each part.

    Metadata is not supported.

    Comment lines not starting with `#` will be separated from their `#` prefix with a space.

    Yields each entry, continuation line, comment, and empty line separately.
    Re-parsing a serialized .ini file is not guaranteed to result in the same Resource,
    as the serialization may lose information about metadata.
    """

    at_empty_line = True

    def comment(comment: str, meta: Any, standalone: bool) -> Iterator[str]:
        nonlocal at_empty_line
        if trim_comments:
            return
        if meta:
            raise ValueError("Metadata is not supported")
        if comment:
            if standalone and not at_empty_line:
                yield "\n"
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



