From 53fed50c8e37bf873196c2503814cd8b33acd298 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Mon, 24 Jun 2024 10:01:32 -0400 Subject: Write blank lines between graphs and statements in TriG --- NEWS | 3 ++- src/writer.c | 2 +- test/extra/pretty/named-graph.trig | 16 +++++++++++++--- 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 Sun, 23 Jun 2024 19:02:38 +0000 + -- David Robillard 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: . -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 . -- cgit v1.2.1