Skip to content

Detect inline style attributes#25

Merged
cpeel merged 1 commit intoDistributedProofreaders:masterfrom
tangledhelix:inline-styles
Apr 5, 2026
Merged

Detect inline style attributes#25
cpeel merged 1 commit intoDistributedProofreaders:masterfrom
tangledhelix:inline-styles

Conversation

@tangledhelix
Copy link
Copy Markdown
Member

Find and report style attributes found on HTML tags (if any). If none are detected, consider it a [pass]; if any are found, it's only [info].

This ports a check from the legacy pptools site.

Example outputs:

No style attributes found:

[pass] no inline styles found

Style attributes found:

[info] inline styles found
         line    99: <div> width: 500px;
         line   120: <div> width: 72px;
         line   122: <div> width: 106px;
         line   132: <div> width: 72px;
         line 12154: <hr> width: 65%;

pphtml.py Outdated
Comment on lines +1129 to +1130
if r[0].startswith("[pass]"):
r[0] = "[info] inline styles found"
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This clearly works but feels weird. It would make more sense to me if:

r = []
# do the for loop that appends to r if the regex matches
r.insert(0, "[info] inline styles found" if r else "[pass] no inline styles found")

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasonable; I made that change. Seems to work the same as before.

Find and report style attributes found on HTML tags (if any). If none are detected, consider it a [pass]; if any are found, it's only [info].

This ports a check from the legacy pptools site.
@cpeel cpeel merged commit d88831a into DistributedProofreaders:master Apr 5, 2026
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.

4 participants