diff options
author | Sergei Kozelko <KozelkoS@yandex.ru> | 2022-10-08 06:25:02 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-08 06:25:02 +0000 |
commit | 540ba6e74ef83925817b80c7e4dfd60ff0ad6e92 (patch) | |
tree | 66b0d545086a964d891c203a44d3a60cfa6b440d /app/src/main/res/mipmap-xxxhdpi | |
parent | 40c61eb3827e53da3f57e2c8d1eca0992a88c5b8 (diff) | |
download | infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar.gz infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar.bz2 infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar.lz infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar.xz infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.tar.zst infinity-for-reddit-540ba6e74ef83925817b80c7e4dfd60ff0ad6e92.zip |
Parse spoilers into nodes (#1150)
Implementation is inspired by already existing in Markwon image and link processing
but has to work around some limitations of writing an external plugin.
The first one is storing brackets ourselves. Stored brackets need to be cleared
when a new block starts. Markwon does it in MarkwonInlineProcessor but there is
no callback that we could use. Clearing storage from our own block parser is
unreliable as it is not guaranteed to be called. Instead, every time we need to
access the storage we compare current block with the last used block and clear
storage if necessary.
The second problem is actually a feature of Markwon that it applies spans in
reverse order of calls to MarkwonVisitor#setSpansForNode. This causes other spans
like links and code to be drawn over spoilers making them visible. Adding spans
with a different priority doesn't help as it would require negative priority.
Instead we just remove all the SpoilerSpans from the final string and add them
again, so they are applied last as we want.
Diffstat (limited to 'app/src/main/res/mipmap-xxxhdpi')
0 files changed, 0 insertions, 0 deletions