angular/dgeni-packages — pull request #17 by petebacondarwin (2014-03-06 07:45:00+00:00)
Title: Runnable examples

The HTML that was being injected into the docs to display the example on
the page was hard coded into the processor javascript. This has now been
moved out into its own template. This allow us to maintain and evolve
the display of runnable examples more easily.

To achieve this the package makes use of the new inline tags support:

* The `examples-parse` processor now extracts the example information,
storing it in the `examples` injectable object. It replaces the example
information in the docs with an inline tag: `{runnableExample example-id}`.

*BREAKING CHANGE: The `examples` injectable object has changed from being
a flat array to a hash indexed on the id of the example. If you only
iterated over the examples then things like `forEach` should still just
work. But you can no longer access the examples by index, e.g.
`examples[0]` will return undefined rather than the first example.*

* The `examples-generate` now, additionally, generates a runnableExampleDoc
for the each of the examples. This will be rendered the same as other
docs based on the `runnableExample.template.html`.

* A new `runnableExample` inline tag handler will replace its inline tag
with the rendered runnableExampleDoc identified by the id given in the
tag.