def comment()

in python/moz/l10n/formats/inc/serialize.py [0:0]


    def comment(comment: str, meta: Any, standalone: bool) -> Iterator[str]:
        if meta:
            raise ValueError("Metadata is not supported")
        if comment:
            for line in comment.strip("\n").split("\n"):
                if line.startswith("#"):
                    if not trim_comments or not line.startswith("# "):
                        yield f"{line}\n"
                elif not trim_comments:
                    line = line.strip()
                    yield f"# {line}\n" if line else "#\n"
            if standalone:
                yield "\n"