Skip to content

Escape content with <![CDATA[ xxx ]]> #46

@ThibaudDauce

Description

@ThibaudDauce

Hi,

I've created an item in my feed with

        feed = Atom1Feed(
            _("Latest APIs"), description=None, feed_url=request.url, link=request.url_root
        )

            feed.add_item(
                dataservice.title,
                unique_id=dataservice.id,
                description=dataservice.description,
                content=md(dataservice.description),
                author_name=author_name,
                author_link=author_uri,
                link=dataservice.url_for(),
                updateddate=dataservice.metadata_modified_at,
                pubdate=dataservice.created_at,
            )

but the content is not correctly encoded for HTML. The W3C validator reports:

[line 6](https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fwww.data.gouv.fr%2Ffr%2Fdatasets%2Frecent.atom#l6), column 225: Undefined content element: div (6 occurrences) [[help](https://validator.w3.org/feed/docs/error/UndefinedElement.html)]

    ... ridiques.</summary><content type="html"><div class="markdown"><p>L'arrêt ...
                                                 ^

[line 39](https://validator.w3.org/feed/check.cgi?url=https%3A%2F%2Fwww.data.gouv.fr%2Ffr%2Fdatasets%2Frecent.atom#l39), column 339: XML parsing error: <unknown>:39:339: mismatched tag [[help](https://validator.w3.org/feed/docs/error/SAXError.html)]

    ... -2022-357578" rel="nofollow">23.06</a></h2></div></content></entry><entr ...

Is it possible to escape the content with CDATA?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions