Add String() method to Node interface

Being able to very easily get the original [1] Org mode content seems like
something that will come up quite often and is very little code.

[1] it's not really the original content, but rather the pretty printed version
of that - as the semantics don't change it shouldn't matter.
This commit is contained in:
Niklas Fasching 2019-01-06 20:50:02 +01:00
parent 148eef5aeb
commit bd33e8885e
10 changed files with 40 additions and 2 deletions

View file

@ -274,3 +274,11 @@ func (l RegularLink) Kind() string {
}
return "regular"
}
func (n Text) String() string { return orgWriter.nodesAsString(n) }
func (n LineBreak) String() string { return orgWriter.nodesAsString(n) }
func (n ExplicitLineBreak) String() string { return orgWriter.nodesAsString(n) }
func (n StatisticToken) String() string { return orgWriter.nodesAsString(n) }
func (n Emphasis) String() string { return orgWriter.nodesAsString(n) }
func (n FootnoteLink) String() string { return orgWriter.nodesAsString(n) }
func (n RegularLink) String() string { return orgWriter.nodesAsString(n) }