Hi @robinst,
I've been looking this over since last night and I'll have some time on various Saturdays in the next few months that might serve to implement this. In the mean time: talk is cheap! :)
I've reviewed #20, #12 and the appropriate spec. Regarding your notes in #20
Do you think it would make sense to have
[foo]: /url "title"
be its own Node type, like ReferenceDefinition? Something like this maybe:
[foo](/uri "title")
is a Link, which has getDestination, getTitle (not sure about getLabel)
[foo][foo], [foo][] and [foo]
are ReferenceLink extends Link, which have an additional getDefinition which returns the ReferenceDefinition
plus the need for a generic link interface, I was thinking this:
public interface GenericLink {
String getLabel();
String getLinkDestination();
String getTitle();
}
Autolinks only have linkDestinations, which calls into question a functional need for inheritance to Link.
public class Autolink extends Node implements GenericLink {
private String linkDestination;
interface impl just refers to linkDestination...
}
ReferenceDefinitions do break down to exactly the same components as Link, so inheritance is worthwhile from a reduction of code duplication standpoint but I don't know if a ReferenceDefinition is a Link. So straight inheritance, a class just for type purposes:
public class ReferenceDefinition extends Link implements GenericLink {
not much here...
}
or compositional inheritance:
public class ReferenceDefinition extends Node implements GenericLink {
private Link linkReferenced;
methods call through to linkReferenced..
}
^edit: nope. Don't like that idea after I've thought about it.
or a complete duplicate/copy of Link's functionality. An inheritance decision here might also influence Autolink's implementation.
Then, we'll need something that references the ReferenceDefinition. From the spec:
A link reference definition does not correspond to a structural element of a document. Instead, it defines a label which can be used in reference links...
Emphasis mine, because I've thought of this as a ReferenceLabel
public class ReferenceLabel extends Node {
private ReferenceDefinition referenceDefinition;
...
}
It's not a link itself, just a pointer.
Thanks for reading!