We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Is it possible to output multiline string in triple-quotes to preserve visible line breaks?
@prefix : <http://example.org/stuff/1.0/> . -:a :b "The first line\nThe second line\n more" . +:a :b """The first line +The second line + more""" .
The text was updated successfully, but these errors were encountered:
You can use coercions; something like this (altho you'd need to modify further if you wanted datatypes):
class LongLiteral { constructor(contents) { this.contents = contents; } toTerm() { const raw = `"""${this.contents.replace(/"""/g, '""\\"')}""""`; return { terse: (prefixes) => raw, verbose: (prefixes) => raw, }; } } const writer = graphy.ttl.write({ prefixes: { // ... }, coercions: new Map([ [LongLiteral, literal => literal.toTerm()], ]) }); writer.write({ '>https://about.me/': { ':quote': new LongLiteral('...'), }, });
Sorry, something went wrong.
No branches or pull requests
Is it possible to output multiline string in triple-quotes to preserve visible line breaks?
The text was updated successfully, but these errors were encountered: