-
Notifications
You must be signed in to change notification settings - Fork 8
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
merge 2 prs together #15
Open
srghma
wants to merge
11
commits into
yesodweb:master
Choose a base branch
from
srghma:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
I left out the `@` on media queries. This also adds a "resize" to limit the size of the structures, which can now be nested beyond two levels.
This allows the tests amended by yesodweb#7 and yesodweb#8 to pass again. * Simplified parsing of nested blocks. * Indefinite nesting levels are now allowed. * Some illegal CSS that was allowed by the old parser is now excluded (e.g. `@print { background: red; }`).
E.g. `@font-face`. Closes yesodweb#6.
Testing with GHC 7.10 has its drawbacks!
This is a stopgap measure to enable this library to parse e.g. Bootstrap 4.3.1. The problem can be illustrated by the example: 1 | @media { 2 | foo {} 3 | } 4 | bar {} `nestedParse` parses the first block inside a nested block on its own, (in this case: `foo {}`), then uses `blocksParser` to read the rest. The previous version of `blocksParser` is too greedy and consumes everything until the next '{'. In this case: `} bar` becomes a "selector", the `bar` block becomes the next "subblock" of `@media` and the "absent" '}' for `@media {` fails parsing. This patch uses '}' as a character that is highly unlikely to happen inside a selector (although it's still possible, e.g. `[attr="}"]`) and highly likely to terminate one-block @-blocks. Previously, css-text failed on Bootstrap 4.3.1 at the 94th block, now it can parse all of its >1200 blocks (not completely correctly, but rather fine for CSS and such a tiny library!).
I should tell that #8 does not actually fix the nested blocks test |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pr just contains merged:
NOTE: the changes #14 to Parsing.hs were not needed actually, the #8 already has the same functionality plus handles nested blocks, but I have merged the changes to test files from it anyway
then I have updated the stack version