Commit graph

15 commits

Author SHA1 Message Date
Niklas Fasching
f67a251e27 html: Fix html writer footnotes (in headlines)
writer.footnotes must be a pointer as we copy the writer in nodesAsString() and
can thus end up modifying the footnotes.list slice without it being reflected in
the original writer (i.e. when the backing array of the slice changes).
2019-08-24 12:11:23 +02:00
Niklas Fasching
97fe8b7850 html: Fix code block export (superfluous newlines)
I didn't consider that all newlines in the pre block will be printed and we
thus shouldn't wrap html that has it's tags on separate lines (i.e. contains
superfluous newlines) - wrapping in a div less accurately represents
org-html-export but it provides the same information and gives us more freedom
in the return value of HighlightCodeBlock as well as allowing us to keep the
html tags on new lines (consistency).
2019-07-28 16:40:09 +02:00
Niklas Fasching
777899c803 HTML export: Update footnote numbering to start with 1
I went with 0 based numbering because it was easier but after looking at the
results 0 based numbering looks bad to me... let's start with 1 like everyone
else as it's just a few more lines of code.
2019-07-07 21:25:42 +02:00
Niklas Fasching
d154403f06 HTML export: Improve handling of missing footnote definitions 2019-07-07 18:01:22 +02:00
Niklas Fasching
37d33c1206 HTML export: Export src block language as css class
Org mode exports source blocks with the language as a css-class of the exported
source block - it's easy enough to do the same.
2019-07-07 10:19:24 +02:00
Niklas Fasching
6dc04b4b02 Refactor footnote handling
- Remove unused footnote section title option
- Move away from maintaining a list of footnotes in the document (only needed
  for html export, potential maintainance overhead when modifying the document)
  and rather only build it on export when required.
- HTML export: Rename all footnotes to numbers (so we can support anonymous
  footnote references by assigning them a number) and export footnotes in order
  of reference, not definition. The implementation of this makes it natural to
  also stop exporting unused footnote definitions so we do that as well.
2019-07-07 10:01:43 +02:00
Niklas Fasching
cec002db22 Improve NewHTMLWriter() defaults
HTMLWriter uses the document to look up export options and adapt it's
behaviour. The writer.document & log are set in the Before() method during
normal use via document.Write().

Sometimes the writer is used separately and won't have it's Before method
called - in those cases we should use the defaults rather than crashing.
2019-01-07 21:43:50 +01:00
Niklas Fasching
63fef04fb3 Add support for timestamps 2019-01-06 21:01:47 +01:00
Niklas Fasching
3e14771ebf Remove unnecessary type alias for strings.Builder
TIL embedded types can be acessed by their non-namespaced name - so there
actually is no need for a type alias to access .strings.Builder, one can just
use .Builder.
2019-01-05 13:04:21 +01:00
Niklas Fasching
faea88d48e Refactor Writer Interface
The existing approach made it hard to extend existing writers.
With this change, replacing individual methods of a writer is possible by
embedding it.

Sharing the WriteNodes function also removes some unnecesseray duplication, so
win win.
2019-01-04 20:13:42 +01:00
Niklas Fasching
56ecb2d401 Add some documentation & split Document into Configuration+Document 2019-01-02 19:17:17 +01:00
Niklas Fasching
348f697b41 Make Writer interface methods public: Allow other implementations 2019-01-02 18:34:40 +01:00
Niklas Fasching
d3d3b6c593 Fix table of contents for hugo
Hugo has some hardcoded checks that have to be fulfilled in its Table of
Contents extraction workflow (helpers/content ExtractTOC). It's easier this
way...
2018-12-26 18:53:31 +01:00
Niklas Fasching
d036ddea4d Add support for some #+OPTIONS toggles
see https://orgmode.org/manual/Export-settings.html
2018-12-26 16:58:16 +01:00
Niklas Fasching
5c51067b59 Rename files containing org and htm writer
The naming `org.go` is confusing as it's not the main class of the org package
2018-12-26 16:11:40 +01:00
Renamed from org/html.go (Browse further)