Commit graph

252 commits

Author SHA1 Message Date
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
Niklas Fasching
6de03e0d13 Fix superscript 2018-12-03 19:54:40 +01:00
Niklas Fasching
213da0beff Fix list parsing & ensure line breaks inside lists are handled correctly
- Break list when kind of bullet changes
- Ensure we render multiline list items correctly
2018-12-03 19:30:21 +01:00
Niklas Fasching
043095e672 Add minimal affiliated keyword support. Just captions for now 2018-12-03 19:18:25 +01:00
Niklas Fasching
2399fec2eb Refactor RegularLink image & video handling 2018-12-03 16:59:39 +01:00
Niklas Fasching
f17923047b Refactor RegularLink: Do not fake description if none is given
To more faithfully handle inline images we need to know whether the original
link included a description - being more explicit about that will make it
easier.

see org.el/org-display-inline-images

> An inline image is a link which follows either of these
> conventions:
>
>   1. Its path is a file with an extension matching return value
>      from `image-file-name-regexp' and it has no contents.
>
>   2. Its description consists in a single link of the previous
>      type.
2018-12-03 16:59:01 +01:00
Niklas Fasching
4348505ada HTMLWriter: Improve footnote rendering
- add return link from footnote definitions -> footnote reference
- wrap footnote definition content in div for easier styling
- class rather than id bc idk consistency
2018-12-03 16:59:01 +01:00
Niklas Fasching
8f06883ec5 Allow blocks to contain paragraphs and other top level elements 2018-12-03 16:59:01 +01:00
Niklas Fasching
ed8764940f Fix paragraphs: Empty lines separate paragraphs
Somehow i thought it was 2 empty lines rather than 1 - makes more sense this
way... :D
2018-12-03 01:44:35 +01:00
Niklas Fasching
c759df1efe HTMLWriter: Fix example block newline 2018-12-03 01:24:17 +01:00
Niklas Fasching
09a8437b59 HTMLWriter: Change code block markup to resemble hugo chroma output
The highlight function from hugo already wraps the highlighted source code in
div > pre > code

e.g.

<div class="highlight">
<pre
style="color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4">
<code class="language-sh" data-lang="sh">echo hello world</code>
</pre>
</div>

So now we always delegate all that to the highlight function
2018-12-03 00:50:44 +01:00
Niklas Fasching
d5665fb21c Fix footnotes starting with empty line 2018-12-03 00:35:12 +01:00
Niklas Fasching
3c2e9ed204 Add option to disable AutoLink parsing 2018-12-02 23:53:31 +01:00
Niklas Fasching
592be07cfd Refactor space handling of writers
I went through the issues of goorgeous and picked a few that seemed easy enough
to add (and added some fore as todos for later). That helped a lot and showed
some bugs / edge cases that required changes.

- the org writer wrote a lot of eol spaces and just removed it whenever
  String() was actually called. That worked until now but did not bode with
  rendering an empty headline - by removing ALL eol space we would render "* "
  back as just "*" -> not a headline anymore.
- the html writer had some special handling for line spacing inside paragraphs
  and list items - with the introduction of more blocks we need that handling
  everywhere.
  As browsers / html renderers are nice enough to collapse whitespace (and
  especially collapse "\s*\n" into " ") we can just write out the newlines and
  let the renderer take care of the rest.
2018-12-02 23:34:21 +01:00
Niklas Fasching
0df8bc541b Fix inline footnote definition parsing
footnote definition descriptions are always elements - not just raw inline
markup. we'll just wrap the description in a paragraph
2018-12-02 23:28:01 +01:00
Niklas Fasching
d5bf4317b2 Fix footnote ordering and some other bugs 2018-12-02 20:09:40 +01:00
Niklas Fasching
b1f9bfc9e9 Fix make test: also get test packages 2018-12-02 18:59:03 +01:00
Niklas Fasching
4e2fb02b57 html: Improve block rendering 2018-12-02 18:54:53 +01:00
Niklas Fasching
d2d9dc0fc8 Add auto links: Try to render unmarked urls as links 2018-12-02 18:37:55 +01:00
Niklas Fasching
a570fc736f Add lossless inline-definition-footnote rendering for the OrgWriter 2018-12-02 18:37:55 +01:00
Niklas Fasching
fc982125c9 Restructure directory layout: org subpackage 2018-12-02 18:37:55 +01:00
Niklas Fasching
6c683dfbdb Add basic html rendering 2018-12-02 16:49:44 +01:00
Niklas Fasching
00aa120bf4 Setup basic development environment: make, git hooks & CI 2018-12-02 16:49:44 +01:00