Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically configure boolean attributes for non-XML documents #386

Merged
merged 7 commits into from
Sep 22, 2023

Conversation

malthe
Copy link
Owner

@malthe malthe commented Sep 4, 2023

Boolean attributes are now automatically configured for templates in non-XML mode, presuming that we're being used to generate HTML.

This means that the same loading mechanism can be used for both XML and HTML-based templates.

The list of attributes is defined in chameleon.zpt.template:

BOOLEAN_HTML_ATTRIBUTES = [
    # From http://www.w3.org/TR/xhtml1/#guidelines (C.10)
    "compact",
    "nowrap",
    "ismap",
    "declare",
    "noshade",
    "checked",
    "disabled",
    "readonly",
    "multiple",
    "selected",
    "noresize",
    "defer",
]

See #385 for more context.

@malthe malthe force-pushed the issue-385-auto-boolean-attributes branch from f4eb69f to f07b533 Compare September 4, 2023 07:02
@malthe malthe self-assigned this Sep 4, 2023
@github-actions
Copy link

github-actions bot commented Sep 4, 2023

Pull Request Test Coverage Report for Build 6195719017

  • 171 of 171 (100.0%) changed or added relevant lines in 3 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.4%) to 87.422%

Files with Coverage Reduction New Missed Lines %
src/chameleon/zpt/template.py 1 91.3%
Totals Coverage Status
Change from base Build 6013392085: 0.4%
Covered Lines: 4188
Relevant Lines: 4685

💛 - Coveralls

@mcdonc
Copy link
Contributor

mcdonc commented Sep 4, 2023

I'm going to try to take the tests I wrote to demonstrate the bools-plus-XML issue in #385 and maybe get us a little more coverage on this branch, if it's ok with you.

@malthe
Copy link
Owner Author

malthe commented Sep 15, 2023

@mcdonc I took upon me to do this work now, cherry-picking your test cases and fixing some minor expectation issues.

I fixed a minor issue as a result, namely that an XML template (i.e. starting with "<?xml") provided as str did not have its content encoding parsed.

@mcdonc
Copy link
Contributor

mcdonc commented Sep 22, 2023

Thanks Malthe! nice work

@malthe malthe merged commit 8d411b2 into master Sep 22, 2023
10 checks passed
@malthe malthe deleted the issue-385-auto-boolean-attributes branch September 22, 2023 07:58
@malthe
Copy link
Owner Author

malthe commented Sep 25, 2023

This is now released as 4.2.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants