minor convenience improvements

This commit is contained in:
Daniella 2022-07-04 02:28:37 +02:00
parent c183565d4b
commit b4dc4bc910
4 changed files with 14 additions and 4 deletions

1
.gitignore vendored
View file

@ -2,3 +2,4 @@
/build/
/javadoc/
/run.sh
/*.jar

View file

@ -13,8 +13,9 @@ import de.tudbut.tryumph.err.ProjectException;
public class TryConfig {
private TCN configHolder;
private String[] arguments;
private static TCN configHolder;
private static String[] arguments;
public static boolean nocache;
public TryConfig(String[] appArguments, InputStream config) throws IOException, ProjectException {
String file = "";
@ -33,6 +34,10 @@ public class TryConfig {
throw new ProjectException("Error reading config: Config formatting is invalid", e);
}
arguments = appArguments;
for(String arg : arguments) {
if(arg.equals("--nocache"))
nocache = true;
}
}
public Task<RequestCatcherConfig[]> getCatchers() {

View file

@ -13,6 +13,7 @@ import org.w3c.dom.Node;
import de.tudbut.async.Task;
import de.tudbut.tryumph.config.IRequestCatcher;
import de.tudbut.tryumph.config.TryConfig;
import tudbut.parsing.AsyncJSON;
import tudbut.parsing.TCN;
@ -123,7 +124,7 @@ public class BrowserContext {
needsChange = true;
}
private final HashMap<String, String> cache = new HashMap<>();
private static final HashMap<String, String> cache = new HashMap<>();
public String file(String file) {
if(cache.containsKey(file))
return cache.get(file);
@ -137,7 +138,8 @@ public class BrowserContext {
}
stream.close();
cache.put(file, builder.toString());
if(!TryConfig.nocache)
cache.put(file, builder.toString());
} catch (IOException e) {
builder.append("\n<br/><h1>---CUT---</h1><br/>\n");
builder.append("Error reading rest of file! Sorry.");

View file

@ -32,6 +32,8 @@ public class HTMLParsing {
// do nothing. we dont want output!
}
}));
tidy.setDropEmptyParas(false);
tidy.setTrimEmptyElements(false);
}