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

[pull] master from plantuml:master #92

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
out

#vscode files
/bin
**/bin/

# Ant result file
plantuml.jar
Expand Down
12 changes: 9 additions & 3 deletions src/net/sourceforge/plantuml/preproc/Stdlib.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
import static java.nio.charset.StandardCharsets.UTF_8;

import java.awt.image.BufferedImage;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
Expand Down Expand Up @@ -317,9 +320,12 @@ private InputStream getDataImagePngBase64() throws IOException {
return new BrotliInputStream(raw);
}

private static InputStream getInternalInputStream(String fullname, String extension) {
final String res = "/stdlib/" + fullname + extension;
return Stdlib.class.getResourceAsStream(res);
private static InputStream getInternalInputStream(String fullname, String extension) throws FileNotFoundException {
final String path = "stdlib/" + fullname + extension;
InputStream result = Stdlib.class.getResourceAsStream("/" + path);
if (result == null)
result = new BufferedInputStream(new FileInputStream(path));
return result;
}

public static void extractStdLib() throws IOException {
Expand Down
3 changes: 1 addition & 2 deletions test/net/sourceforge/plantuml/tim/EaterTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class EaterTest {
"'@startuml\n!$a=[1, 2, 3]\ntitle xx $a[2] yy\na -> a\n' , xx 3 yy",
"'@startuml\ntitle\n!foreach $i in [1, 2, 3]\nxx $i yy\n!endfor\nendtitle\na -> a\n' , xx 2 yy",
"'@startuml\ntitle\n!foreach $i in [\"a\", \"b\", \"c\"]\nxx $i yy\n!endfor\nendtitle\na -> a\n' , xx b yy",
// TODO: fix code to allow test to access on stdlib, the corresponding (not working) test is here:
// "'@startuml\nstdlib\n@enduml', archimate",
"'@startuml\nstdlib\n@enduml', archimate",
})
void Test_EaterTest(String input, String expected) throws Exception {
assertRenderExpectedOutput(input, expected);
Expand Down
Loading