Fixes for pkldoc (#96)

* Add URI encoding to paths and fragments
* Render quotes around identifiers when appropriate
This commit is contained in:
Daniel Chao
2024-02-08 11:28:34 -08:00
committed by GitHub
parent 9dc7eb2938
commit dddae1190f
126 changed files with 3234 additions and 2560 deletions

View File

@@ -365,13 +365,13 @@ public final class IoUtils {
return uri;
}
var basePath = Path.of(base.getRawPath());
var basePath = Path.of(base.getPath());
if (!base.getRawPath().endsWith("/")) basePath = basePath.getParent();
var resultPath = basePath.relativize(Path.of(uri.getRawPath()));
var resultPath = basePath.relativize(Path.of(uri.getPath()));
try {
return new URI(
null, null, null, -1, resultPath.toString(), uri.getRawQuery(), uri.getRawFragment());
null, null, null, -1, resultPath.toString(), uri.getQuery(), uri.getFragment());
} catch (URISyntaxException e) {
throw new IllegalArgumentException(e);
}

View File

@@ -163,7 +163,7 @@
// Arrays.asList("file:///pkl/.*", "https://.*\\.apple\\.com"));
//
// resolver.resolve("file:///pkl/foo.pkl", fileUrlModule, sourceSection);
// resolver.resolve("https://pkl.io/foo.pkl", fileUrlModule, sourceSection);
// resolver.resolve("https://example.com/foo.pkl", fileUrlModule, sourceSection);
// }
//
// @Test(expected = EvalException.class)