VisualEditor/Node API re-write

Jump to navigation Jump to search


  • Support transparent attribute preservation, like in the annotation API
  • Allow hybrid nodes types that can be branch or content depending on context
    • This is needed for alienBlock/alienInline and metaBlock/metaInline
    • Allow logic to be different: aliens need to preserve their block/inline-ness where possible and adjust the document structure if needed, while meta nodes need to assimilate
    • Approach: have callback function inspect document state and return a node, then adjust document structure to fit that node in. We already do the latter for regular node types anyway
  • Need an integrated approach to both nodes and annotations so as to allow for a mixed specificity order
    • Example: <a> is an annotation, <a typeof="mw:Image"> is a node. Similarly, <span typeof="mw:Entity"> is a node, but other kinds of <span>s are annotations. If we always evaluate annotations before nodes, we can't support these cases. Evaluating nodes before annotations works for all existing cases, but may well break in future cases. Building a flexible system MAY also allow us to define alien nodes in terms of the node API itself. A mixed specificity order means we should be able to support a specificity ranking like 1) <span lang="nl"> (language annotation), 2) <span typeof="mw:Entity"> (entity node), 3) <span typeof="mw:unrecognizedtype"> (alien node), 4) <span> (generic textStyle/span annotation)
  • Alienation of unrecognized nodes should be built in. Alienation of nodes with unrecognized mw: types may be possible to implement with generic mechanisms, or we may have to add a prefix registration feature where nodes with an RDFa type with a given prefix (mw: in our case) that don't match a type-specifying rule are alienated, even if they match some other non-type-specifying rule. Either way, alienation of unrecognized mw: types needs to be in an MW-specific extension, not in the core of the node API (although the core API may have to have support for the feature).
  • Handle about groups properly
    • Somehow expose about group info to the node handlers in a flexible way
    • Don't assume about groups are always aliens
    • Support non-continuous about groups
  • Rewrite the entire converter while I'm at it, it's a mess
  • Full separation of generic and MW-specific behavior