Commit graph

271 commits

Author SHA1 Message Date
Niklas Fasching
a32df1461e
Merge pull request #104 from niklasfasching/dependabot/go_modules/golang.org/x/net-0.17.0
build(deps): bump golang.org/x/net from 0.0.0-20201224014010-6772e930b67b to 0.17.0
2023-10-11 23:12:13 +02:00
dependabot[bot]
b42f4b0387
build(deps): bump golang.org/x/net
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.0.0-20201224014010-6772e930b67b to 0.17.0.
- [Commits](https://github.com/golang/net/commits/v0.17.0)

---
updated-dependencies:
- dependency-name: golang.org/x/net
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-10-11 21:08:32 +00:00
Niklas Fasching
016eab10df
Merge pull request #103 from prmadev/master
Making hr tags compatible with xml
2023-10-08 21:02:29 +02:00
prmadev
3d00478629
feat: make hr tags self closing 2023-10-08 16:50:05 +03:30
Niklas Fasching
6eb20dbda9
Merge pull request #102 from FikriRNurhidayat/master
trim leading newline char on blocks for html
2023-06-16 20:07:53 +02:00
Fikri
0de50d60af trim leading newline char on blocks for html 2023-06-16 23:49:33 +07:00
Niklas Fasching
2d45490186
Merge pull request #100 from anthonyfok/refresh-for-chroma-v2.5.0
Refresh test fixtures for chroma v2.5.0
2023-03-13 19:24:13 +01:00
Anthony Fok
bf5c1ea2b9
Refresh test fixtures for chroma v2.5.0
'tabindex="0"' was removed from <pre> elements in chroma v2.5.0;
see alecthomas/chroma#736
2023-03-13 07:01:29 -06:00
Niklas Fasching
c1b428de28 html: Clean up and simplify code
- we can use type casting to check for type instead of adding a dependency on
  reflect
- lint complains about redundant types, so get rid of that for peace of mind
2023-03-12 11:28:55 +01:00
Niklas Fasching
5464ab37d2 Fix race condition surrounding global orgWriter
Since writers are normally only used synchronously (i.e. to write one document
at a time), we don't guard modifications to their internal
state (e.g. temporarily replacing the string.Builder in WriteNodesAsString)
against race conditions.

The package global `orgWriter` and corresponding use cases of it (`org.String`,
`$node.String`) break that pattern - the writer is potentially used from
multiple go routines at the same time. This results in race conditions that
manifest as error messages like e.g.

    could not write output: runtime error: invalid memory address or nil pointer dereference. Using unrendered content.

Additionally, since we catch panics in `Document.Write`, the corresponding
stack trace is lost and dependents of go-org never know what hit them.

As using a writer across simultaneously across go routines is not a standard
pattern, we'll sync the use of the global `orgWriter` instead of trying to make
the actual writer threadsafe; less code noise for the common use case.
2023-03-12 11:28:55 +01:00
Niklas Fasching
18314a9f41
Merge pull request #96 from linchen2chris/master
make it possible to customize style for status/priority/tag
2023-03-03 19:48:33 +01:00
linchen2chris
29e77a0555 update the fixtures 2023-03-02 17:56:27 +08:00
linchen2chris
538fa3b3c5 make classname with priority and lowercase 2023-03-02 17:54:06 +08:00
linchen2chris
1dcadee27e make tag support other language 2023-02-21 19:10:11 +08:00
linchen2chris
acd8b842b6 make it possible to customize style for status/priority/tag 2023-02-21 18:48:17 +08:00
Niklas Fasching
fa3e6f91d9
Merge pull request #95 from glacials/html-toplevel-hlevel
Allow customizing header level offset
2023-02-19 18:55:12 +01:00
glacials
97d5ac5933 Allow customizing header level offset
Allows consumers to specify `TopLevelHLevel` to `HTMLWriter`, which
works identically to Org's official [`:html-toplevel-hlevel` /
`org-html-toplevel-hlevel`](https://orgmode.org/manual/Publishing-options.html) property.

Fixes #94.
2023-02-18 15:08:18 -08:00
Niklas Fasching
1849701ba7 Add support for latex blocks / environments
current support for latex fragments was inline only, i.e. lines containing block
elements (e.g. a line starting with `* `, i.e. a headline) will not be parsed
as part of the latex fragment but the respective block element. Parsing latex
blocks at the block level should fix that. Note that in any case we don't do
any processing and just emit the raw latex (leaving the rendering to e.g. js).
2022-11-02 14:16:57 +01:00
Niklas Fasching
05a2dedbf8 Remove superfluous []string declarations 2022-11-01 12:41:51 +01:00
Niklas Fasching
f27340ed5e Add \ to emphasis post chars to allow immediate explicit line break
Post chars are defined in (nth 1 org-emphasis-regexp-components) in emacs org.
When I initially adapted the list of chars for go, I failed to check how it's
actually used (further down in org.el):
  (string-match (concat "[" (nth 1 erc) "\n]") (char-to-string (char-after (point))))

Due to the surrounding [] the `\\` in
  '("-[:space:]('\"{" "-[:space:].,:!?;'\")}\\[" "[:space:]" "." 1)

is actually a literal backslash, not an escape of the opening bracket I
guess. I'm not in the mood for thinking any harder about this, so let's hope
this is right. yolo.
2022-09-20 17:16:40 +02:00
Niklas Fasching
3082cbe04e
Merge pull request #88 from xjzi/master
Correct link to orgmode docs
2022-08-27 13:47:14 +02:00
xjzi
b54ef128ef Correct link to orgmode docs 2022-08-26 10:50:40 -04:00
Niklas Fasching
351c47cdc9
Merge pull request #87 from xjzi/master
Don't wrap simple titles in <p>
2022-08-22 18:14:20 +02:00
xjzi
81cb0c3735 Don't wrap simple titles in <p>
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.
2022-08-21 12:37:51 -04:00
Niklas Fasching
9a9c046a14
Merge pull request #85 from kisaragi-hiu/hl_lines
highlightCodeBlock: expose params so they can be passed to Chroma by users
2022-07-25 17:26:51 +02:00
Kisaragi Hiu
a7a960c460
highlight: add tests for ParseRanges 2022-07-25 19:27:11 +09:00
Niklas Fasching
980dd2038d make: Allow generating single fixture 2022-07-24 00:28:23 +02:00
Niklas Fasching
9d1e3cf24f make: Only rebuild when necessary 2022-07-24 00:28:23 +02:00
Kisaragi Hiu
ab8d3bc16a
highlight: support highlighting lines in the default writer
The hl_lines key is specifically the same as Hugo's key.
2022-07-18 03:56:15 +09:00
Kisaragi Hiu
9b56fc914c
highlight: Expose node params so we can pass options to Chroma 2022-07-18 03:51:04 +09:00
Niklas Fasching
3c938e7e43
Merge pull request #84 from anthonyfok/refresh-for-chroma-v2.2.0
Refresh test fixtures for chroma v2.2.0
2022-06-28 17:21:16 +02:00
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