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

Analyse with puppeteer #221

Merged
merged 5 commits into from
Dec 4, 2023
Merged

Analyse with puppeteer #221

merged 5 commits into from
Dec 4, 2023

Conversation

HeikoTheissen
Copy link
Contributor

@HeikoTheissen HeikoTheissen commented Dec 1, 2023

A tool that helps with the analysis of the generated HTML documents. For example, syntax errors in code snippets can be detected with

node lib/selector.mjs ".json .er" "self::*[.!='…' and not(starts-with(.,' '))]/text()"

The first argument is a CSS selector, the (optional) second is an XPath expression.

@HeikoTheissen HeikoTheissen marked this pull request as ready for review December 1, 2023 13:14
Copy link
Contributor

@ralfhandl ralfhandl left a comment

Choose a reason for hiding this comment

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

I think this is useful enough to be part of our build process

Comment on lines +99 to +102
- [`npm run select <CSS selector> [<XPath expression>]`](selector.mjs) selects parts of the generated HTML documents by executing a CSS selector and optionally an XPath expression relative to each match. For example, syntax errors in JSON code snippets can be detected with
```sh
npm run select ".json .er" "self::*[.!='…']/text()"
```
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not have a postbuild script that calls this validation?

Copy link
Contributor Author

@HeikoTheissen HeikoTheissen Dec 4, 2023

Choose a reason for hiding this comment

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

Perhaps later if we find a better XPath expression. For now the result still contains too many false positives.

@HeikoTheissen HeikoTheissen merged commit 9c9fd29 into main Dec 4, 2023
1 check passed
@HeikoTheissen HeikoTheissen deleted the tools/selectors branch December 4, 2023 11:31
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