Commit graph

290 commits

Author SHA1 Message Date
Anthony Fok
f7b18ba94e
Refresh test fixtures for chroma v2.2.0
Missing semicolons have been added since chroma v2.0.1
2022-06-28 06:37:06 -06:00
Niklas Fasching
a520664dc7 emphasis: Fix reading of prev/next rune for multibyte characters 2022-06-18 16:10:19 +02:00
Niklas Fasching
0f145082ad Refactor writer tests
Until now we're not using t.Run to create a sub test for each fixture - for the
current bug I want to only run a single file as I'm a print debugger and don't
care for the noise of logs from other tests. While at it, it made sense to
merge the implementations.
2022-06-18 16:10:19 +02:00
Niklas Fasching
10b71b143a
Merge pull request #82 from bep/tidy
Run go mod tidy
2022-05-31 14:33:40 +02:00
Niklas Fasching
338dfae4f1 Remove goorgeous comparison
`go mod tidy` kept including goorgeous and blackfriday for me - turns out go
does not honor gitignore [1] and the correct way of ignoring a subdirectory is to
place an empty `go.mod` file in it [2]. As I haven't looked in that file for
quite some time and goorgeous has been deprecated let's rather just get rid of
the comparison altogether.

[1] the .go file requiring goorgeous was placed into `docs/`
    when running `make generate-gh-pages`. `docs/` is gitignored but not
    ignored by go
[2] https://github.com/golang/go/wiki/Modules#can-an-additional-gomod-exclude-unnecessary-content-do-modules-have-the-equivalent-of-a-gitignore-file
2022-05-31 14:31:31 +02:00
Bjørn Erik Pedersen
57c166a3ad
Run go mod tidy 2022-05-30 18:18:19 +02:00
Niklas Fasching
47f963ec35 gh-pages: Add link to blorg example 2022-05-30 17:35:16 +02:00
Niklas Fasching
f8b8e73722 make: Add serve-gh-pages target
As github pages is served not on root but /go-org/ we need to move everything
into a subdirectory of that name when serving locally
2022-05-30 17:31:54 +02:00
Niklas Fasching
67951ec664 Update chroma: v0.10.0 -> v2 2022-05-30 17:31:54 +02:00
Niklas Fasching
2c87232bd4 generate-fixtures: Fix hashing of rendered blorg testadata 2022-05-30 17:15:04 +02:00
Niklas Fasching
8e11cc3db0 Fix html entities: support \<entity>{} and prevent partial replacements 2022-04-28 18:09:42 +02:00
Niklas Fasching
7344ea2e86 Add version flag
go 1.18 embeds vcs info into binaries by default [1] allowing us to provide a
rudimentary version cmd in just a few lines. (version) vcs tags are not
embedded for now - just the commit hash should be good enough for now though.

[1] https://tip.golang.org/doc/go1.18
2022-03-27 01:20:09 +01:00
Niklas Fasching
fa13957511 README: Remove deprecated install target and check for go in setup
seems like i removed that target at some point and forgot to update the
readme. As installing go is os specific let's just check for go instead and
let the user handle the installing.
2022-03-19 18:39:14 +01:00
Niklas Fasching
3d26e96974
Merge pull request #74 from QuLogic/update-chroma
Update chroma to 0.10.0
2022-03-03 19:12:42 +01:00
Niklas Fasching
bfaba450ec
Merge pull request #73 from QuLogic/blorg-tests
Rewrite blorg tests without external md5sum
2022-03-03 19:12:12 +01:00
Elliott Sales de Andrade
2e821b8b7c Update chroma to 0.10.0
- 0.9.2 added `tabindex="0"` to `pre`:
  https://github.com/alecthomas/chroma/pull/515
- 0.10.0 changed around divs and spans, pre and code
  https://github.com/alecthomas/chroma/pull/571
  https://github.com/alecthomas/chroma/pull/572
2022-02-28 00:37:53 -05:00
Elliott Sales de Andrade
65699c036b Rewrite blorg tests without external md5sum
It's a little bit longer, but avoids the need for external tools like
find and md5sum.
2022-02-27 19:15:48 -05:00
Elliott Sales de Andrade
1122a3dfbc Make blorg tests more verbose
By not combining all files into one md5sum.
2022-02-27 15:44:52 -05:00
Elliott Sales de Andrade
2a85f587d3 Fix a typo in blorg test 2022-02-27 15:44:18 -05:00
Niklas Fasching
19409dd62d
Merge pull request #68 from Juneezee/go1.17
build: update to Go 1.17
2022-01-07 19:25:55 +01:00
Eng Zer Jun
568df2c38d
build: update go directive in go.mod to 1.17
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2022-01-07 09:08:56 +08:00
Niklas Fasching
f2286d48ff cli: Fix support for reading input from stdin - prefer file input
Apparently that way of detecting data on stdin is not really fool
proof. Instead of improving that let's just swap the order and look for a file
first. yolo.
2021-12-26 23:25:30 +01:00
Niklas Fasching
c82b26b540 cli: Support reading input from stdin 2021-12-26 23:17:19 +01:00
Niklas Fasching
df89d27a4e
Merge pull request #65 from josephburnett/trim-fast-tags
Support fast tags by trimming the key binding.
2021-10-28 22:10:58 +02:00
Joseph Burnett
aff78bc23d Support fast tags by trimming the key binding. 2021-10-28 17:23:19 +02:00
Niklas Fasching
9995b3cdad html: Improve link abbreviation (#+LINK) resolution
Handle `%s`/`%h` interpolation and add support for shorthand of prefix only
links / links with empty tag (i.e. `[example]` instead of [example:]). See
[1] and [2]. As so often we don't match org mode output completely but our
output looks sane enough to me so let's move along for now.

[1] https://orgmode.org/manual/Link-Abbreviations.html
[2] https://github.com/bzg/org-mode/blob/main/lisp/ol.el#L1011
2021-10-25 16:50:15 +02:00
Niklas Fasching
34dfe32024 Document ealb in options.org fixture 2021-07-25 21:54:15 +02:00
Niklas Fasching
c901c00166 Add non-standard ealb (east asian line break) option
See pandoc: https://pandoc.org/MANUAL.html#extension-east_asian_line_breaks
2021-07-20 22:33:28 +02:00
Niklas Fasching
0e68f1db40 Update stylesheet to handle unwrapped list items 2021-07-20 22:24:29 +02:00
Ori
4d3a099922 For simple list items, don't wrap in <p> tags
This also removes extra newlines for simple list items, see changes to
tests for details.

Closes #57
2021-07-13 23:41:32 +02:00
Niklas Fasching
429602aba7 make: fix preview command 2021-07-13 22:13:58 +02:00
Niklas Fasching
abb81851be html: Hide excluded headlines from TOC
emacs org mode did it first
2021-07-13 20:54:23 +02:00
Niklas Fasching
e5ae608865 Improve Makefile: Only install dependencies and rebuild when required
By getting rid of the PHONY install and bundling the go get with its uses we
can prevent unnecessary go gets in `make build` - this speeds up development as
I run `make generate-fixtures` a lot and fetching dependencies takes
comparatively long.

We also add the `-d` flag to go get to get rid of the deprecation warning
```
go get: installing executables with 'go get' in module mode is deprecated.
	To adjust and download dependencies of the current module, use 'go get -d'.
	To install using requirements of the current module, use 'go install'.
	To install ignoring the current module, use 'go install' with a version,
	like 'go install example.com/cmd@latest'.
	For more information, see https://golang.org/doc/go-get-install-deprecation
	or run 'go help get' or 'go help install'.
```
2021-04-17 15:48:41 +02:00
Niklas Fasching
21f1af7d48 Add support for custom numbering of ordered list using [@\d+]
org mode supports [1] setting the value attribute [2] of ordered list items to
change the numbering for the current and following items. Let's do the same. As
the attribute has no meaning for other types of lists [2] we'll just not
support it for those cases [3].

[1] https://orgmode.org/manual/Plain-Lists.html#Plain-Lists
[2] https://developer.mozilla.org/en-US/docs/Web/HTML/Element/li#attributes
[3]
Org mode seems to instead set the id attribute for e.g. unordered lists
starting with `[@\d+]\s` - but I don't really see the value in that and will
skip that for now.
2021-04-17 15:43:19 +02:00
Niklas Fasching
b3edd6c182 Improve block parameter parsing
The actual parameter parsing logic in emacs org mode is quite complex [1]. All
we want for now is to handle parameter values containing spaces [2]. Splitting
on ` :` gets us close enough for now. As I'm very opposed to copying 100 lines
of parameter parsing logic just to get exports right let's wait for use cases -
no hurt in gathering requirements as we go.

[1] https://github.com/bzg/org-mode/blob/master/lisp/ob-core.el#L1481
[2] I never ran into such parameters before and wrongly assumed that splitting
on spaces would be enough. boy was i wrong - just look at that massive
function [1]! that's why we can't have nice things!
2021-04-11 21:52:12 +02:00
Niklas Fasching
b9f05878fa Revert "Manually install go 1.16 until github actions updates image"
This reverts commit bf7f957af2.

We still have to manually install it for now but we don't have to fuck around
with env vars anymore. github actions still defaults to go 1.15 [1]. Whatever.

[1]
```
ls -lisah $(which go)
108022 0 lrwxrwxrwx 1 root root 42 Mar 18 22:15 /usr/bin/go ->
/opt/hostedtoolcache/go/1.15.10/x64/bin/go
```
2021-03-28 17:23:05 +02:00
Niklas Fasching
7c239a7aeb html: Add support for #+TOC keyword
org mode allows rendering the toc anywhere in the html document using the `TOC`
keyword [1]. There's more options but `#+TOC: headlines $n` should be enough
for starters. Note that org mode still requires setting `#+OPTIONS: toc:nil` to
disable the default toc

[1] https://orgmode.org/manual/Table-of-Contents.html
2021-03-28 17:12:25 +02:00
Niklas Fasching
bf7f957af2 Revert Me: Manually install go 1.16 until github actions updates image 2021-03-01 14:19:14 +01:00
Niklas Fasching
703066682e Update to go v1.16 and embed more extensive default blorg.org
Instead of the bare bones default config we embedded as a string until now we
can use go 1.16 embed to embed the test blorg.org which makes a much better
starting config (if only to see what's possible).
2021-03-01 14:10:34 +01:00
Niklas Fasching
02df432d76 Refactor main cmd: Improve error messages and code layout 2021-01-23 20:50:57 +01:00
Niklas Fasching
5dadf8c4c2 html: Support pretty relative links
Hugo defaults to serving files with pretty urls [1] - this means
`/posts/foo.org` is served at `/posts/foo/`. This works because servers
default to serving index.html when a directory is specified and hugo renders
the post to `/posts/foo/index.html` instead of `/posts/foo.html`. To make
relative links work we need to (1) remove the fake `foo/` subdirectory from
unrooted links and (2) replace any `.org` suffix with `/`.

[1] https://gohugo.io/content-management/urls/#pretty-urls
2021-01-02 20:48:28 +01:00
Niklas Fasching
84d56e9562 html: Rewrite local links to .org files to .html
emacs rewrites links to `.org` files to corresponding links with `.html`
extension in the html export.
2021-01-02 20:47:55 +01:00
Niklas Fasching
1b68e209ac Migrate from travisci to github actions
because all my other repos use it and hackernews told me travisci free tier is
dead.
2021-01-02 20:42:59 +01:00
Niklas Fasching
cdc54f17b1 Setup go.mod 2021-01-02 20:42:16 +01:00
Niklas Fasching
a8e74684a5
Merge pull request #43 from pjkundert/fix-drawer-end
Make ORG-mode drawer "🔚" case-insensitivie
2020-11-27 23:37:21 +01:00
Perry Kundert
4cf9dff010 Add a lower-case org-mode drawer 🔚 test 2020-11-20 11:41:24 -08:00
Perry Kundert
04fec98ffd Make ORG-mode drawer "🔚" case-insensitivie 2020-11-16 12:37:37 -08:00
Niklas Fasching
1cd3791386 Add helper script to simplify creating hugo pull requests
For hugo to pull in changes we need to create a pull request. Creating the
branch for that is repetitive and can be easily automated, so let's do
that. Creating the pull request itself is not as easily automated as it might
be necessary to provide a little context for the changes - so let's keep it
manual.
2020-07-28 20:39:06 +02:00
Niklas Fasching
c025db7bdd Fix comments: comments must start with #\s not just # 2020-07-28 19:28:30 +02:00
Niklas Fasching
16ccafe8a3 blorg: ignore draft pages 2020-07-24 18:45:22 +02:00