Re:Publish – A static site generator for Swift developers
by carapace on Tuesday December 31, 2019 @12:08AM
(#21919104)
What's a good data type for text with hyperlinks?
[ Parent
| on HN ]
Re:Publish – A static site generator for Swift developers
by layoutIfNeeded on Tuesday December 31, 2019 @01:45AM
(#21919403)
A tree?
Re:Publish – A static site generator for Swift developers
by TheAsprngHacker on Tuesday December 31, 2019 @02:35AM
(#21919549)
Since hyperlinks can link to any document, not just children, shouldn't the data structure be a (not necessarily tree-shaped) directed graph?
Re:Publish – A static site generator for Swift developers
by carapace on Tuesday December 31, 2019 @11:21AM
(#21922116)
I can't even decide whether the text (e.g. in a div or p element) should be stored as a unit with links stored as meta-data, or should the stretches of text before/after/between links be "chunks" and the links store their own content (like DOM)?
It's an old question, see the "piece-chain" structure Prof With chose for text-with-"looks" (aka "style") http://www.inf.ethz.ch/personal/wirth/ProjectOberon/PO.Syste... section 5.2, "Text Management".
Re:Publish – A static site generator for Swift developers
by layoutIfNeeded on Wednesday January 01, 2020 @12:52AM
(#21926851)
The former is how NSAttributedString works in the Apple ecosystem. It’s a plain string with attributes attached to certain character ranges.
https://developer.apple.com/documentation/foundation/nsattri...