Commit graph

284 commits

Author SHA1 Message Date
Gusted
f537c0bda3
Allow for multiple inline blocks in a paragraph
- Adjust the inlineBlock regex to match until the first `]` and `}`,
this allows for multiple inline blocks to be present on the same line.
- Test added.
2024-07-29 17:49:02 +02:00
Niklas Fasching
f7c2b120f7
Merge pull request #114 from donaldh/noweb-redux
Honour org :noweb strip-export parameter when writing HTML
2024-05-29 19:20:39 +02:00
Donald Hunter
83bde78a85 Add diff to error report when tests fail
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
2024-05-28 23:10:02 +01:00
Donald Hunter
c7595323bc Add test for :noweb strip-export to blocks.org
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
2024-05-28 23:08:58 +01:00
Donald Hunter
5f599b9e66 Honour org :noweb strip-export parameter when writing HTML
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
2024-05-22 19:42:11 +01:00
Donald Hunter
d31a96a3c0 Include file name in parse error message
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
2024-05-22 19:41:33 +01:00
Niklas Fasching
55b85080f0
Merge pull request #113 from fpdotmonkey/file-extensions-arent-case-sensitive
Make media file extensions not be case sensitive
2024-05-15 16:28:03 +02:00
Fletcher Porter
939b1879b3 Make media file extensions not be case sensitive
I had a .PNG file that caused me to spend an hour and a half
troubleshooting...
2024-05-14 23:30:36 +03:00
Niklas Fasching
df7ff0fa3e
Merge pull request #112 from niklasfasching/dependabot/go_modules/golang.org/x/net-0.23.0
build(deps): bump golang.org/x/net from 0.17.0 to 0.23.0
2024-04-19 19:41:34 +02:00
dependabot[bot]
98665b7f13
build(deps): bump golang.org/x/net from 0.17.0 to 0.23.0
Bumps [golang.org/x/net](https://github.com/golang/net) from 0.17.0 to 0.23.0.
- [Commits](https://github.com/golang/net/compare/v0.17.0...v0.23.0)

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

Signed-off-by: dependabot[bot] <support@github.com>
2024-04-19 12:12:54 +00:00
Niklas Fasching
fc916744d4
Merge pull request #111 from facundoolano/footnote_in_footnote
Update HTML writer to support footnotes from footnotes
2024-03-23 18:36:55 +01:00
facundoolano
3f3817ebe2 add test for footnote in footnote 2024-03-13 15:23:38 -03:00
facundoolano
79fd96a2ea track unused footnotes to allow footnote from another one's definition 2024-03-13 15:10:56 -03:00
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