aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2024-06-24 10:01:32 -0400
committerDavid Robillard <d@drobilla.net>2024-06-24 10:01:32 -0400
commit53fed50c8e37bf873196c2503814cd8b33acd298 (patch)
tree34cd5ff9744c320e1b9203ca87d023d8c88e5434
parent570b40e58eed90c5ec747c44e791c5321c2ea604 (diff)
downloadserd-53fed50c8e37bf873196c2503814cd8b33acd298.tar.gz
serd-53fed50c8e37bf873196c2503814cd8b33acd298.tar.bz2
serd-53fed50c8e37bf873196c2503814cd8b33acd298.zip
Write blank lines between graphs and statements in TriG
-rw-r--r--NEWS3
-rw-r--r--src/writer.c2
-rw-r--r--test/extra/pretty/named-graph.trig16
3 files changed, 16 insertions, 5 deletions
diff --git a/NEWS b/NEWS
index fe1cbf83..372e20fe 100644
--- a/NEWS
+++ b/NEWS
@@ -6,8 +6,9 @@ serd (0.32.3) unstable; urgency=medium
* Gracefully handle errors while writing the end of anonymous nodes
* Support reading lone lists in lax mode
* Treat out of range unicode characters as errors
+ * Write blank lines between graphs and statements in TriG
- -- David Robillard <d@drobilla.net> Sun, 23 Jun 2024 19:02:38 +0000
+ -- David Robillard <d@drobilla.net> Mon, 24 Jun 2024 14:01:08 +0000
serd (0.32.2) stable; urgency=medium
diff --git a/src/writer.c b/src/writer.c
index 2b127d04..c0f1a4a7 100644
--- a/src/writer.c
+++ b/src/writer.c
@@ -987,8 +987,8 @@ serd_writer_write_statement(SerdWriter* writer,
(!graph && writer->context.graph.type)) {
TRY(st, terminate_context(writer));
reset_context(writer, RESET_GRAPH | RESET_INDENT);
+ TRY(st, write_newline(writer));
if (graph) {
- TRY(st, write_newline(writer));
TRY(st, write_node(writer, graph, datatype, lang, FIELD_GRAPH, flags));
TRY(st, write_sep(writer, SEP_GRAPH_BEGIN));
copy_node(&writer->context.graph, graph);
diff --git a/test/extra/pretty/named-graph.trig b/test/extra/pretty/named-graph.trig
index 5cd12f3b..29f1d970 100644
--- a/test/extra/pretty/named-graph.trig
+++ b/test/extra/pretty/named-graph.trig
@@ -1,8 +1,18 @@
@prefix eg: <http://example.org/> .
-eg:g {
- eg:s
- eg:p [
+eg:g1 {
+ eg:s1
+ eg:p1 [
a eg:Object
] .
}
+
+eg:g2 {
+ eg:s2
+ eg:p2 [
+ a eg:Object
+ ] .
+}
+
+eg:s3
+ eg:p3 eg:o3 .