Before this commit, if an org document was titled "Title here", the
first line of HTML output would be as follows:
<h1 class="title"><p>Title here\n</p></h1>
This commit changes the HTML writer to instead output the following:
<h1 class="title">Title Here</h1>
I conversatively modified the code, so there might be more cases where
elements should be omitted from the title.
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.
`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
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
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.
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.
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'.
```
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.
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!
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
```
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
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).
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