jgm/pandoc — pull request #1805 by bergey (2014-12-12 14:46:54+00:00)
Title: RST Reader - Improved Role Support

These changes make Roles behave more like the RST definition, and I hope more useful. I've also added warnings when the RST reader ignores syntax.

- use Code constructor for :literal: role
- add custom role name to classes (when possible)
- allow role directive without parent - use Span constructor

Commit e784d4b refactors custom role handling, but shouldn't change behavior (except order of classes). I think it makes the code easier to understand, but feedback is welcome.

@merijn, do you have time to take a look? I think you were the last to work on custom roles. In particular, I've changed the type of `stateRstCustomRoles`. Before my changes, the base role was computed when defining a new custom role, and ignored when rendering the role. I don't see any reason (other than maybe debugging) why we need to store both of these. I also don't see how the parent role could depend on the Attrs. Does this look OK, or am I breaking something?

This differs from rst2xml.py in (at least) the following ways, which I'm willing to fix if they bother people. I suspect they're not issues in practice.
- If a custom role inherits from a custom role, both role names are included in the classes
- The :span: role is recognized as built-in, to implement custom roles with unspecified parent
- For unknown roles, pandoc outputs the quoted text, but not the role markup; rst2xml outputs both