Commit graph

74 commits

Author SHA1 Message Date
Niklas Fasching
c26d39284c Improve main.go: log error to stderr, output to stdout 2018-12-18 23:53:32 +01:00
Niklas Fasching
941f3ea520 Inform user if gh-pages wasm demo cannot be instantiated 2018-12-18 19:14:27 +01:00
Niklas Fasching
56d47aeb8f Update README 2018-12-18 15:04:54 +01:00
Niklas Fasching
d6b7424da5 html: Fix headline priority export
when #+OPTIONS: pri:t is set (org-export-with-priority) Org mode exports the
priority as {[A], [B], [C]}, not {A, B, C} - we should do the same
2018-12-18 14:22:45 +01:00
Niklas Fasching
e9d9590d7a Fix drawer parsing
Found thx to trying out
https://github.com/kaushalmodi/ox-hugo/blob/master/test/site/content-org/all-posts.org
- handle properties without value (would normally begin a new drawer)
- handle drawer at eof
2018-12-18 14:17:27 +01:00
Niklas Fasching
7331d24452 Add support for list item checkboxes (e.g. [X])
see https://orgmode.org/manual/Checkboxes.html
We're deviating from Org mode regarding the assigned css classes but the chosen
classes feel better than (on, off, trans) and it's not like the export matches
1:1 otherwise.
2018-12-18 14:15:35 +01:00
Niklas Fasching
a60f844e38 Add basic support for statistic tokens (e.g. [100%] [1/1])
Org mode does not care where those tokens are when it comes to the
export (afaict). We'll do the same.

(They should only be in the first line of a list item or a headline)
2018-12-18 14:14:08 +01:00
Niklas Fasching
dce67eaddf Improve ATTR_HTML keyword parsing
Org mode separates kvs not as initially assumed by whitespace (~ csv) but
rather at keywords (~ :\w+).

This is still not replicating Org mode behaviour though as I decided against
attributes ignoring multi-definitions. Instead we stack their
values (and those existing on the element) for certain attributes (class, style
for now).

e.g.
[[foo]]

would become <foo class="a"> in Org mode but becomes <foo class="a b"> with
go-org.
2018-12-18 00:16:41 +01:00
Niklas Fasching
0e64f9df7f html: Render headline priority 2018-12-17 22:39:29 +01:00
Niklas Fasching
a861437185 Fix naming: org-mode -> Org mode
https://scripter.co/how-do-i-write-org-mode/

Prefer “Org mode” to “Org-mode” or “org-mode”. This is simply because it reflects an existing convention in The Emacs Manual which consistently documents mode names in this form - “Text mode”, “Outline mode”, “Mail mode”, etc.
2018-12-17 22:34:15 +01:00
Niklas Fasching
31a98da991 Update README with suggestions from @kaushalmodi
also see #1 - link official Org mode mirror
2018-12-17 22:33:33 +01:00
Niklas Fasching
c6854a40e1 Improve descriptive list org rendering
- indent to correct lvl
  - term ::
            |<- indent up to here
    |<- not here
2018-12-17 16:02:56 +01:00
Niklas Fasching
652290b857 Update README 2018-12-17 15:06:26 +01:00
Niklas Fasching
5afba92f5f Add (a bad) comparison to goorgeous to github pages
The stylesheet would have to be adapted to get a fair visual comparison - but
this should be enough for comparing behavior
2018-12-17 15:06:26 +01:00
Niklas Fasching
0eb3baf1bb Improve handling of elements containing raw text
While adding another test case from the goorgeous issues it became clear that
inline markup and html entity replacement were erronously applied to raw text
elements like inline code =foo=, src/example/export blocks, example lines,
etc.

To correctly handle those cases in both org and html exports a new
parseRawInline method had to be added.

Also some misc html export whitespace fixes and stuff
2018-12-17 13:40:15 +01:00
Niklas Fasching
ac2597af4c Refactor Footnotes: Exclude footnotes heading during export, not parsing
Until now the footnotes section was parsed but not included in the resulting
AST - his required rebuilding it in the OrgWriter. It feels cleaner to include
it in the AST and only exclude it in the export
2018-12-17 13:40:15 +01:00
Niklas Fasching
ced166dc18 Fix inline parseLineBreak: Handle end of input 2018-12-17 01:38:46 +01:00
Niklas Fasching
ba3cf9f948 Add support for descriptive lists 2018-12-17 01:38:46 +01:00
Niklas Fasching
376bb3652a Update README 2018-12-17 00:02:27 +01:00
Niklas Fasching
0186545123 Add basic support for drawers 2018-12-17 00:01:03 +01:00
Niklas Fasching
c012b0a533 Add support for ": example" elements 2018-12-16 23:23:47 +01:00
Niklas Fasching
24ace5aa0e html: Export headline todo status & tags 2018-12-16 22:45:18 +01:00
Niklas Fasching
6887fb2e02 Add wasm demo to github pages 2018-12-16 19:54:17 +01:00
Niklas Fasching
8a9bc2bead Update README: more todos 2018-12-15 14:50:16 +01:00
Niklas Fasching
ca5dbb0e48 Update README 2018-12-14 17:09:00 +01:00
Niklas Fasching
2947d7632d Support basic #+INCLUDE (src/example/export block only)
including org files is more complex - e.g. footnotes need to be namespaced to
their source file. org does this by prefixing each included files footnotes
with a number - but even that is not enough as it doesn't guarantee
uniqueness.

As I don't have a usecase for it, I'll avoid the additional complexity for
now.
2018-12-14 17:09:00 +01:00
Niklas Fasching
04df30a7b5 Convert panics to errors for public interface 2018-12-14 16:37:32 +01:00
Niklas Fasching
f28f400d7e Add table pretty printing & alignment
Also dismissed implementing colgroups for now - had it but didn't like the
added complexity for a very questionable benefit - i've actually never used
that feature of org tables...
2018-12-14 15:49:40 +01:00
Niklas Fasching
c08119bbc8 Improve table parsing: support separator before header 2018-12-13 17:48:38 +01:00
Niklas Fasching
cb81eb94de Update README 2018-12-13 17:47:25 +01:00
Niklas Fasching
a0e87057d6 Fix BufferSettings append & add ParseFrontMatter
until now buffersettings were always appended using \n which means the first
value would already be written as "\nVALUE". Not anymore.

Also we finally add an option to parse just the front matter. Still not
efficient as we tokenize the whole org file but i don't think saving a few
milliseconds would be worth making the code uglier.
2018-12-13 17:44:26 +01:00
Niklas Fasching
0255a129e2 Improve html entities replacement
No need to replace html entities in the result - we can just do it when we
write a text node - the only thing that actually contains text and thus
entities!
2018-12-13 17:43:31 +01:00
Niklas Fasching
a55ed30e3d Add support for org-entities (e.g. ndash, mdash, \Aacute) 2018-12-11 22:12:51 +01:00
Niklas Fasching
7c082fc627 Change img url http -> https where possible for cleaner gh-pages console 2018-12-11 22:12:51 +01:00
Niklas Fasching
8a30adf1f2 Add naive html escaping to generate-gh-pages
without this the raw html from the org source (e.g. from a #+HTML: ... keyword)
is not visible as text but rendered as html
2018-12-11 22:12:51 +01:00
Niklas Fasching
ffe06b50f2 Add support for #+HTML 2018-12-11 22:12:51 +01:00
Niklas Fasching
0a905ca172 Fix HTML_ATTR rendering (naive)
- was missing spaces between attributes when rendering to org
- was duplicating attributes when rendering to html - now we join / replace
  attributes depending on the name - for now only class & style are appended
2018-12-11 20:38:24 +01:00
Niklas Fasching
08ff3ac22e Add monospace hack to example css
relative font sizes inside pre tags are not honored by default. this is the
industry standard way of fixing that. go figure...

https://github.com/necolas/normalize.css#extended-details-and-known-issues
2018-12-11 20:38:07 +01:00
Niklas Fasching
07d90c960c Add travis-ci badge to README 2018-12-11 18:03:19 +01:00
Niklas Fasching
81f74f4ad9 Refactor keyword parsing/rendering & add support for ATTR_HTML 2018-12-11 18:03:19 +01:00
Niklas Fasching
a859264420 Fix default HighlightCodeBlock fn: Write tags on separate lines 2018-12-11 17:30:20 +01:00
Niklas Fasching
486720c1b1 Update blocks.org fixture 2018-12-11 16:11:07 +01:00
Niklas Fasching
b1a03e2d27 Make highlightCodeBlock render enclosing div tags on separate lines 2018-12-11 16:09:39 +01:00
Niklas Fasching
53b61abfd0 Support html export blocks 2018-12-11 16:05:36 +01:00
Niklas Fasching
04db858934 Support keywords without a value like "#+RESULTS:" 2018-12-11 16:05:36 +01:00
Niklas Fasching
9826aa2143 Add make target to automatically regenerate html fixtures
After changing something the fixtures need to be updated to reflect the new
output. This just moves those steps from my bash history to make.
2018-12-11 15:42:41 +01:00
Niklas Fasching
8cefd9fabc Set up github pages 2018-12-11 15:42:41 +01:00
Niklas Fasching
fb6bc2d7de Split example.org into separate files
... hopefully correctly

This will hopefully improve ease of developing (more granular test results) and
prepares us for adding example org->html renders for gh-pages
2018-12-11 14:43:44 +01:00
Niklas Fasching
6adad92e8b Update main.go: Log to stdout & support both html and html-chroma
Could be moved into a flag but I'll significantly refactor the main.go later on
anyways - for now this works TM
2018-12-11 14:42:05 +01:00
Niklas Fasching
6637e63892 Fix multiline emphasis
I didn't have a test case for this and broke it when i introduced Line nodes to
support printing back to org mode. Oops
2018-12-10 17:53:12 +01:00