go-org-orgwiki/org
Niklas Fasching c9d11e1556 Refactor OrgWriter and HTMLWriter: Remove cloning
Extension of the org & html writers is made possible by creating circular
references between the extending and extended writer - that way the extending
writer can forward all methods it doesn't implement to the extended writer and the
extended writer can use the extending writer as the root for method calls to
make sure methods overridden in the extending writer are used even for nested
method calls.

This circular reference leads to problems when cloning writers - cloning the
extended writer merely copies the pointer to the extending writer - i.e. the
extending writer does not get cloned with an updated reference to the extended
writer. Thus method calls to the extending writer act as if no cloning took
place and things break.

The easiest solution is to just get rid of cloning. We could also clone the
ExtendingWriter and replace it's reference to the extended writer with the just
cloned one but that's harder so we just remove it.

As there are a lot of "extending writer" and "extended writer" in the above
paragraphs and I'm too lazy to write up something better here's another attempt
at a TLDR:

Cloning is broken as ExtendingWriter is a reference to a writer that has
a reference to the writer we are cloning - that writer would have to have it's
reference updated but that's hard. So we solve it it by not cloning at all.
2019-11-02 23:33:34 +01:00
..
testdata Fix ExplicitLineBreak parsing 2019-10-29 01:03:10 +01:00
block.go Add String() method to Node interface 2019-01-06 20:50:02 +01:00
document.go Add support for NAME keyword 2019-10-27 15:12:38 +01:00
drawer.go Handle malformed :PROPERTY: drawers 2019-09-28 15:12:19 +02:00
footnote.go Refactor footnote handling 2019-07-07 10:01:43 +02:00
fuzz.go Fix fuzz 2019-01-02 21:22:13 +01:00
headline.go Fix index out of range in headline priority parsing 2019-10-27 15:24:24 +01:00
html_entity.go Add support for org-entities (e.g. ndash, mdash, \Aacute) 2018-12-11 22:12:51 +01:00
html_writer.go Refactor OrgWriter and HTMLWriter: Remove cloning 2019-11-02 23:33:34 +01:00
html_writer_test.go Add support for extending writers 2019-10-27 16:43:42 +01:00
inline.go Fix ExplicitLineBreak parsing 2019-10-29 01:03:10 +01:00
keyword.go Add support for NAME keyword 2019-10-27 15:12:38 +01:00
list.go Add String() method to Node interface 2019-01-06 20:50:02 +01:00
org_writer.go Refactor OrgWriter and HTMLWriter: Remove cloning 2019-11-02 23:33:34 +01:00
org_writer_test.go Add support for extending writers 2019-10-27 16:43:42 +01:00
paragraph.go Add String() method to Node interface 2019-01-06 20:50:02 +01:00
table.go Add String() method to Node interface 2019-01-06 20:50:02 +01:00
util.go Improve footnote handling 2018-12-26 15:42:12 +01:00
writer.go Add support for extending writers 2019-10-27 16:43:42 +01:00