diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | src/writer.c | 5 | ||||
-rw-r--r-- | test/extra/pretty/repeated-directives.ttl | 7 | ||||
-rw-r--r-- | test/test_reader_writer.c | 2 |
4 files changed, 15 insertions, 2 deletions
@@ -7,8 +7,9 @@ serd (0.32.5) unstable; urgency=medium * Fix reading prefix names that start with "true." or "false." * Refuse to write incoherent statements * Remove project and version number from man page OS field + * Write a blank line between statements and Turtle/TriG directives - -- David Robillard <d@drobilla.net> Sun, 16 Mar 2025 22:02:00 +0000 + -- David Robillard <d@drobilla.net> Fri, 11 Apr 2025 16:16:54 +0000 serd (0.32.4) stable; urgency=medium diff --git a/src/writer.c b/src/writer.c index 7e4a1060..aa7fd980 100644 --- a/src/writer.c +++ b/src/writer.c @@ -1212,7 +1212,12 @@ serd_writer_set_prefix(SerdWriter* const writer, TRY(st, serd_env_set_prefix(writer->env, name, uri)); if (writer->syntax == SERD_TURTLE || writer->syntax == SERD_TRIG) { + const bool had_subject = writer->context.subject.type; TRY(st, terminate_context(writer)); + if (had_subject) { + TRY(st, esink("\n", 1, writer)); + } + TRY(st, esink("@prefix ", 8, writer)); TRY(st, esink(name->buf, name->n_bytes, writer)); TRY(st, esink(": <", 3, writer)); diff --git a/test/extra/pretty/repeated-directives.ttl b/test/extra/pretty/repeated-directives.ttl index 68c3e6cf..c7875c31 100644 --- a/test/extra/pretty/repeated-directives.ttl +++ b/test/extra/pretty/repeated-directives.ttl @@ -8,3 +8,10 @@ eg:s eg:p eg:o , eg:o . + +@prefix eg: <eg#> . +@prefix eg: <http://example.org/eg#> . +@prefix eg: <http://example.org/eg#> . +@base <base> . +@base <http://example.org/base> . +@base <http://example.org/base> . diff --git a/test/test_reader_writer.c b/test/test_reader_writer.c index ceaae30f..78123110 100644 --- a/test/test_reader_writer.c +++ b/test/test_reader_writer.c @@ -144,7 +144,7 @@ static void test_write_errors(void) { // Syntax-keyed array of output document sizes - static const size_t max_offsets[] = {0, 451, 1911, 2003, 465}; + static const size_t max_offsets[] = {0, 452, 1911, 2003, 466}; for (unsigned s = 1; s <= (unsigned)SERD_TRIG; ++s) { const SerdSyntax syntax = (SerdSyntax)s; |