I think it would be good to have such a writer.
> I know that I can add a new writer for a new language, but how do I
add a new pretty-printed format for an existing language?
At the moment there isn't a simple extension mechanism to alter the layout.
The code is in class TurtleShell.ShellGraph. There is a lot of
preprocessing to identity the items form that be printed as [] and ().
The perprocessing could be abstracted,
The layout is done at
TurtleShell.writeCluster
mostly done within:
TurtleShell.writeClusterPredicateObjectList
Andy
On 20/06/2023 00:35, Shaw, Ryan wrote:
I would like to create a custom Turtle pretty printer that does not try to
align things like the current pretty printer does. I just want a standard
indentation width (e.g. two spaces).
So, instead of:
```
[ a time:ProperInterval ;
time:hasBeginning [ a time:Instant ;
time:inDateTime [ a
time:DateTimeDescription ;
time:day
"---12"^^xsd:gDay ;
time:hour
"23"^^xsd:nonNegativeInteger ;
time:minute
"20"^^xsd:nonNegativeInteger ;
time:month
"--04"^^xsd:gMonth ;
time:second
"30"^^xsd:decimal ;
time:timeZone bipm:UTC ;
time:unitType
time:unitSecond ;
time:year
"1985"^^xsd:gYear
]
] ;
time:hasDurationDescription [ a time:DurationDescription ;
time:hours "04"^^xsd:nonNegativeInteger
] ;
time:hasEnd :when2
] .
```
I would instead like:
```
[
a time:ProperInterval ;
time:hasBeginning :when1 ;
time:hasDurationDescription [
a time:DurationDescription ;
time:hours "04"^^xsd:nonNegativeInteger
] ;
time:hasEnd [
a time:Instant ;
time:inDateTime [
a time:DateTimeDescription ;
time:day "---12"^^xsd:gDay ;
time:hour "23"^^xsd:nonNegativeInteger ;
time:minute "20"^^xsd:nonNegativeInteger ;
time:month "--04"^^xsd:gMonth ;
time:second "30"^^xsd:decimal ;
time:timeZone bipm:UTC ;
time:unitType time:unitSecond ;
time:year "1985"^^xsd:gYear
]
]
] .
```
(Note how much easier the 2nd is to read without a super-wide window!)
I know that I can add a new writer for a new language, but how do I add a new
pretty-printed format for an existing language?
Thanks,
Ryan