Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove footnotes from og:description #529

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions emanote/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
- Enable auto identifier for org files ([\#502](https://github.com/srid/emanote/pull/502))
- Bug fixes:
- Emanote no longer crashes when run on an empty directory ([\#487](https://github.com/srid/emanote/issues/487))
- Remove footnotes from `og:description` ([\#529](https://github.com/srid/emanote/pull/529))
- Stork search fixes
- Fix empty stork index generation when using more than 1 layer ([\#493](https://github.com/srid/emanote/issues/493))
- Stork search index is now uses note path from their associated layer ([\#495](https://github.com/srid/emanote/pull/495))
Expand Down
2 changes: 1 addition & 1 deletion emanote/emanote.cabal
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cabal-version: 2.4
name: emanote
version: 1.3.16.0
version: 1.3.17.0
license: AGPL-3.0-only
copyright: 2022 Sridhar Ratnakumar
maintainer: [email protected]
Expand Down
8 changes: 7 additions & 1 deletion emanote/src/Emanote/Model/Note.hs
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ applyNoteMetaFilters doc =
)
addDescriptionFromBody =
overrideAesonText ("page" :| ["description"]) $ \case
B.Para is -> [WL.plainify is]
B.Para is -> [WL.plainify (mapMaybe removeInlineNotes is)]
_ -> mempty
-- FIXME this doesn't take splice rendering into account. Specifically,
-- `![[foo.jpeg]]` is not handled at all.
Expand All @@ -406,4 +406,10 @@ applyNoteMetaFilters doc =
pure $ SData.oneAesonText (toList key) val
)

-- TODO: apply this recursively
TristanCacqueray marked this conversation as resolved.
Show resolved Hide resolved
removeInlineNotes :: B.Inline -> Maybe B.Inline
removeInlineNotes = \case
B.Note{} -> Nothing
a -> Just a

makeLenses ''Note
Loading