Noah Hellman
e877fdbde8
inline: rm resolved TODO
...
resolved by a846477cea
2023-04-25 18:35:13 +02:00
Noah Hellman
d2d7f5d474
lib: fix url in autolink/email end event
...
was constant ">" instead of actual url
2023-04-10 18:50:22 +02:00
Noah Hellman
1202160a88
inline: resume attr parsing when new lines received
...
instead of starting over for each new line
2023-04-05 21:17:33 +02:00
Noah Hellman
50205573d0
inline: store attributes in vec
2023-04-05 21:17:33 +02:00
Noah Hellman
62d33effc4
inline: parse multiline attributes
...
reimplement after broken by "take str per line instead of full inline
iter" commit
also resolves #18 and #34
2023-04-05 21:17:33 +02:00
Noah Hellman
3d42820001
inline: add ControlFlow enum
...
needed to indicate that more input is needed
this is needed only for multiline attributes that require backtracking
2023-04-05 21:17:33 +02:00
Noah Hellman
7133de94bb
inline: keep track of lines ahead
...
Needed for attributes, as they cannot be parsed without backtracking.
Potentially we have to parse for attributes until the end of the block
before we can know if it is invalid attributes and we should instead
parse for other inline events.
2023-04-05 21:17:33 +02:00
Noah Hellman
2bcc6122ca
inline: store link cowstrs in vec
...
try to reduce size of Event by placing the cowstr in a shared vec, and
just keeping an index in the event itself
seems to have a significant performance benefit on benchmarks
2023-04-05 21:17:33 +02:00
Noah Hellman
a846477cea
inline: parse multi-line link tags/urls
...
reimplement after broken by "take str per line instead of full inline
iter" commit
this also resolves #22
2023-04-05 21:17:33 +02:00
Noah Hellman
86ee4ee520
lex: rm lex::Kind::Whitespace
...
Whitespace tokens do not necessarily create new events but they work as
a delimiter for words with attributes and affect some container
delimiters. Now when we can read the source from inline, we can instead
inspect for whitespace when needed.
Removing the whitespace token allows the lexer to continue a lot longer
without stopping. E.g. a typical line in a paragraph with no special
characters can turn into a single token.
2023-04-05 21:17:33 +02:00
Noah Hellman
9454a2e393
inline: apply word attribute when flushing event buf
...
fixes issue with e.g `[text]({.cls})` where attributes get immediately
applied to `[text](` where link should have priority.
2023-04-05 21:17:33 +02:00
Noah Hellman
08ef15655b
inline: extract merge_str_events
...
decrease size of inline::Parser::next, make more readable
2023-04-05 21:17:33 +02:00
Noah Hellman
1b7bb25519
inline: allow reading src
2023-04-05 21:17:33 +02:00
Noah Hellman
8382fe122f
lib: derive Clone for Parser
...
should now be safe to do
2023-04-05 21:17:33 +02:00
Noah Hellman
3a1a3996e9
inline: take str per line instead of full inline iter
...
gets rid of DiscontinousChars which is large and requires cloning on
peek
resolves #4
2023-04-05 21:17:33 +02:00
Noah Hellman
8169feb1f6
inline: impl links w/o lookahead
...
needed to get rid of DiscontinuousChars
2023-04-05 21:17:33 +02:00
Noah Hellman
66d821f03e
inline: replace Delim by Opener
...
no need to have a delimiter for closer, only opener needs to be stored
in stack
2023-04-05 21:17:33 +02:00
Noah Hellman
ed5aed3759
inline: impl verbatim w/o lookahead
...
avoid lookahead for containers that can cross newline
needed to get rid of DiscontinuousChars iter
2023-04-05 21:17:33 +02:00
Noah Hellman
e8e551fd8b
inline: separate lex, span to separate Input object
...
easier handling of mutable pointers, can borrow self.input instead of
whole self
can e.g. borrow mutable state while still eating new tokens
2023-04-05 21:17:33 +02:00
Noah Hellman
5d6d0e0840
inline: use lex kinds
...
import Sequence and use Delimiter, Symbol consistently
2023-04-05 21:17:33 +02:00
Noah Hellman
f192ea2aa6
inline: use ? to flatten methods
2023-04-05 21:17:33 +02:00
Noah Hellman
491c5f2866
inline: always push events from parse methods
...
in order to more conveniently allow pushing in arbitrary order
parse methods now return an Option<()> that functions kind of like a
std::ops::ControlFlow. Some(()) means the token was parsed, None means
continue parsing.
2023-04-05 21:17:33 +02:00
Noah Hellman
9429f90307
inline: reuse event buffer between blocks
...
make sure not to allocate a new buffer on each block
2023-04-05 21:17:33 +02:00
Noah Hellman
1e5e56c463
only assert in debug builds
...
these are primarily used to detect bugs during e.g. fuzzing.
most of these asserts have negligible impact on performance, but if they
are not debug asserts it is not obvious that they dont affect
performance of release builds
2023-04-05 21:17:33 +02:00
Noah Hellman
d171cbb516
inline: add quote test
2023-04-05 21:17:33 +02:00
Noah Hellman
722f549ffd
clippy: allow blocks_in_if_conditions everywhere
2023-04-05 21:17:33 +02:00
Noah Hellman
a7f5b337a8
inline: fix attrs missing for inline verbatim
...
closes #15
2023-03-11 22:16:56 +01:00
Noah Hellman
418bb38f82
inline: extract ahead_container_attributes
2023-02-21 17:58:05 +01:00
Noah Hellman
413fecfe6a
fix/allow clippy lints
2023-02-12 00:59:18 +01:00
Noah Hellman
0de7776020
impl Clone, Copy on public objects
2023-02-05 20:36:49 +01:00
Noah Hellman
0420aad0a5
implement symbols
...
e.g. :some-sym:
2023-02-05 20:36:49 +01:00
Noah Hellman
924d6c44ac
inline: disallow '<' in autolinks
...
avoid hangs on long <<<<<< sequences
2023-02-05 20:36:49 +01:00
Noah Hellman
cadf49fc53
fix usage of byte vs char count
2023-02-05 20:36:49 +01:00
Noah Hellman
fb6a44283d
inline: do not emit empty events
2023-02-05 20:36:49 +01:00
Noah Hellman
4b52fb0832
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
1135cf7054
fixup! block: parse tables
2023-02-05 20:36:40 +01:00
Noah Hellman
6cf5aca1e3
fixup! stuuoestnhunoestuh
2023-02-05 20:36:40 +01:00
Noah Hellman
a03d46dfaf
inline: impl smart em/endash
2023-02-05 20:36:40 +01:00
Noah Hellman
b10798b778
inline: impl smart ellipsis
2023-02-05 20:36:40 +01:00
Noah Hellman
56718ef887
inline: impl smart quotation
2023-02-05 20:36:40 +01:00
Noah Hellman
8237384077
span: add empty_{before,after}, after, between
2023-02-05 20:36:40 +01:00
Noah Hellman
d8d69b2488
fixup! inline: disallow containers of zero length
2023-02-05 20:36:40 +01:00
Noah Hellman
d0084b0d87
fixup! inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
373567a6dc
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
0605a0d901
fixup! inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
d050c504ae
inline: disallow whitespace after/before emph
2023-02-05 20:36:40 +01:00
Noah Hellman
b78b2866a8
fixup! inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
641e904074
inline: disallow containers of zero length
2023-02-05 20:36:40 +01:00
Noah Hellman
7ee1c7514d
inline fixup
2023-02-05 20:36:40 +01:00
Noah Hellman
79e2eab107
fixup! inline: hide empty attributes from output
2023-02-05 20:36:40 +01:00