diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | doc/serdi.1 | 4 | ||||
-rw-r--r-- | src/serdi.c | 7 |
3 files changed, 12 insertions, 2 deletions
@@ -1,5 +1,6 @@ serd (0.29.3) unstable; + * Add serdi option to write ASCII output * Make serdi guess input syntax from extension if unspecified * Make serdi syntax options case-insensitive * Add basic error tolerant parsing for line-based formats @@ -10,7 +11,7 @@ serd (0.29.3) unstable; * Fix building with MSVC * Clean up testing code - -- David Robillard <d@drobilla.net> Sun, 24 Sep 2017 18:51:27 +0200 + -- David Robillard <d@drobilla.net> Sun, 24 Dec 2017 14:14:15 -0500 serd (0.28.0) stable; diff --git a/doc/serdi.1 b/doc/serdi.1 index c11d2b3b..d5051655 100644 --- a/doc/serdi.1 +++ b/doc/serdi.1 @@ -9,6 +9,10 @@ serdi [OPTION]... INPUT BASE_URI .SH OPTIONS .TP +\fB\-a\fR +Write ASCII output if possible. + +.TP \fB\-b\fR Fast bulk output for large serialisations. diff --git a/src/serdi.c b/src/serdi.c index 59dbaf35..e1a53845 100644 --- a/src/serdi.c +++ b/src/serdi.c @@ -83,6 +83,7 @@ print_usage(const char* name, bool error) fprintf(os, "Usage: %s [OPTION]... INPUT [BASE_URI]\n", name); fprintf(os, "Read and write RDF syntax.\n"); fprintf(os, "Use - for INPUT to read from standard input.\n\n"); + fprintf(os, " -a Write ASCII output if possible.\n"); fprintf(os, " -b Fast bulk output for large serialisations.\n"); fprintf(os, " -c PREFIX Chop PREFIX from matching blank node IDs.\n"); fprintf(os, " -e Eat input one character at a time.\n"); @@ -123,6 +124,7 @@ main(int argc, char** argv) SerdSyntax input_syntax = (SerdSyntax)0; SerdSyntax output_syntax = (SerdSyntax)0; bool from_file = true; + bool ascii = false; bool bulk_read = true; bool bulk_write = false; bool full_uris = false; @@ -138,6 +140,8 @@ main(int argc, char** argv) in_name = (const uint8_t*)"(stdin)"; in_fd = stdin; break; + } else if (argv[a][1] == 'a') { + ascii = true; } else if (argv[a][1] == 'b') { bulk_write = true; } else if (argv[a][1] == 'e') { @@ -230,7 +234,8 @@ main(int argc, char** argv) SerdEnv* env = serd_env_new(&base); int output_style = 0; - if (output_syntax == SERD_NTRIPLES || output_syntax == SERD_NQUADS) { + if (output_syntax == SERD_NTRIPLES || output_syntax == SERD_NQUADS || + ascii) { output_style |= SERD_STYLE_ASCII; } else if (output_syntax == SERD_TURTLE) { output_style |= SERD_STYLE_ABBREVIATED; |