Improved LensArticle
This involved a bunch of sub goals, which I'm trying to sketch here:
- Improve Document API, so we don't need the didLoad construct.
- We drop support for JSON as a serialisation format
- Move converters out of the document model in favor of independend converts
- we can streamline the substance document model api then
- we don't need all this conversion stuff for our real time operations
- in the case of the clipboard, there will rarely be custom implementations, since we just treat everything unknown as plain text/paragraph-ish
- different converters
- ClipboardConverter (with import and export methods)
- LensXMLConverter
- JATSConverter
- etc.
- Represent contributors (incl. authors) as ORCID entities
- Generic Figure implementation that can exhibit any allowed block node (image, embed, table, etc.)
- Generic Citation implementation. We want to be able to reference anything
- LensArticle tests
- Make Citeproc a fallback (extension that can override default bibitem label generation -> numbered)
- Ability to extend the Lens Article format using Lens Plugins (packages)
Figures
A figure in Lens terms should be a flexible construct that can reference everything. Here's some API ideas.
var figure = {
id: 'figure-1',
type: 'figure',
figureType: 'image', // we could implicitly determine that by inspecting doc.get(fig.content).type
content: 'image-1'
caption: 'Figure caption' // annotated
};
tx.create(figure);
Collections
We could now use collections for this, and also handle stuff like label generation entirely there.
doc.getCollection('figures'); // e.g. enumerates all figures that reference an image or embed
We could do matcher based indexing for collections so we could provide them as a configuration option for lens article schemas.
var articleConfig = {
collections: {
'figures': {
matcher: function(node) {
return node.type ==='figure' && node.figureType === 'image';
},
// order depends on insertion order of matched nodes
order: function(items) {
return items;
},
label: function(node, index) {
return "[" + index "]";
}
},
'bibItems': {
matcher: function(node) {
return node.type === 'bib-item';
},
order: function(items) {
// reorder items based on citation order
},
label: function(node) {
return
}
}
}
}
Citations
Analog to figures we should be able to cite anything without introducing extra node types. Like with figures we could determine the citation type using an explicit property or do it dynamically based on the target.type. If we do the second, we need to ensure that all target id's are present as nodes in the document.