Skip to content

Allow preprocessing of the input stream to be skipped #382

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

Merged
merged 1 commit into from
Oct 30, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions org/w3c/css/css/StyleSheetParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ public final class StyleSheetParser
implements CssValidatorListener, CssParser {

private static Constructor co = null;
private static boolean isPreprocessed;

static {
try {
Expand All @@ -64,10 +65,15 @@ public final class StyleSheetParser
CssFouffa cssFouffa;
StyleSheet style = new StyleSheet();

public StyleSheetParser(ApplContext ac) {
public StyleSheetParser(ApplContext ac, boolean isPreprocessed) {
this.isPreprocessed = isPreprocessed;
ac.setStyleSheet(getStyleSheet());
}

public StyleSheetParser(ApplContext ac) {
new StyleSheetParser(ac, false);
}

public void reInit() {
style = new StyleSheet();
}
Expand Down Expand Up @@ -293,7 +299,8 @@ public void parseStyleElement(ApplContext ac, Reader reader,

// if (cssFouffa == null) {
String charset = ac.getCharsetForURL(url);
if (ac.getCssVersion().compareTo(CssVersion.CSS2) >=0 ) {
if (ac.getCssVersion().compareTo(CssVersion.CSS2) >=0
&& !isPreprocessed) {
cssFouffa = new CssFouffa(ac, new UnescapeFilterReader(new BufferedReader(reader)), url, lineno);
} else {
cssFouffa = new CssFouffa(ac, reader, url, lineno);
Expand Down