Today, MdqNode is sometimes a block, sometimes a leaf, sometimes an inline. When it's an inline, that's all it can say about it -- it can't say that it's a Link specifically, for example.
This is a bit unaesthetic, but it also makes selectors harder than they need to be. For example, you can't write a selector against a Link; it would have to be against an Inline, and do the "is it a link" checking internally, which would mean expanding the selector interface. Alternatively, I could introduce an MdqNodeRef for links, and another for images, and deal with the fact that that means those elements can be referenced either through MdqNodeRef::Inline or MdqNodeRef::Link (or ::Image). That's pretty ugly, though.
I should:
[x] rename Link -> LinkDefinition (not strictly needed, but it's easy and will be useful as I start writing selectors against links and images separately) — #54
[x] reorganize MdqNode into container blocks, leaf blocks, and inlines (as separate enums) #57
[x] split up Inline into at least Link, Image, and others. Probably Link, Image, Formatting, Text, and Footnote. #60
[x] maybe reorganize MdqNodeRef into each of the selectable elements, and then a single variant for "non-selectable, but still displayable". (I'll have to think a bit harder if I actually want to do this one, and maybe play around with it a bit before I decide) #58
Today,
MdqNode
is sometimes a block, sometimes a leaf, sometimes an inline. When it's an inline, that's all it can say about it -- it can't say that it's a Link specifically, for example.This is a bit unaesthetic, but it also makes selectors harder than they need to be. For example, you can't write a selector against a Link; it would have to be against an Inline, and do the "is it a link" checking internally, which would mean expanding the selector interface. Alternatively, I could introduce an
MdqNodeRef
for links, and another for images, and deal with the fact that that means those elements can be referenced either throughMdqNodeRef::Inline
orMdqNodeRef::Link
(or::Image
). That's pretty ugly, though.I should:
Link
->LinkDefinition
(not strictly needed, but it's easy and will be useful as I start writing selectors against links and images separately) — #54MdqNode
into container blocks, leaf blocks, and inlines (as separate enums) #57MdqNodeRef
into each of the selectable elements, and then a single variant for "non-selectable, but still displayable". (I'll have to think a bit harder if I actually want to do this one, and maybe play around with it a bit before I decide) #58This effectively blocks link and image selectors