-
Notifications
You must be signed in to change notification settings - Fork 127
Adding animation directive for injecting animated diagrams #1698
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding animation directive for injecting animated diagrams #1698
Conversation
ac9baed
to
96ff478
Compare
96ff478
to
3a4dae3
Compare
3a4dae3
to
6a1a19d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a suggestion for improved tests
@@ -355,6 +355,37 @@ class Dog implements Cat, E { | |||
/// Don't define this: {@macro ThatDoesNotExist} | |||
void withUndefinedMacro() {} | |||
|
|||
/// Animation method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another interesting case would be a doc comment that has an animation on the first line:
/// Hello animation world: {@animation stuffAnimation 100 100 http://etc}
Basically, to exercise what happens when an animation might appear in a oneLineDoc (the summary of each method displayed on a Class page, for example). It's probably desirable not to have the animation appear in the summary of each method, and I think that's what may happen, but a test should help.
And other cases where @animation
is inlined:
/// A test
/// This is something cool {@animation a 100 200 http://stuff} that I am inlining.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I've added tests for both inlined animations and oneLineDoc substitution. It seems that the oneLineDoc doesn't incorporate the animations in the first place (probably because the animation code is preceded by a blank line), so no problem there, and the inline test found a problem (I was indenting the first line after the animation code, which made markdown think that it was code), which I fixed.
OK, I think this is ready to be committed. I don't have write access, so you'll need to commit. Thanks for the review! |
Merging now. You just missed 0.19.1 but as preview-dart-2 gets closer to switching on by default I'll be rolling dartdoc frequently. You can expect a release with this feature sometime next week I hope. |
Great, I'll look for it! |
This PR adds an animation directive that allows embedding of animations as MPEG 4 videos. The idea is to allow animated diagrams to be placed in documentation.
It places a play button over the video until clicked, at which point it hides the play button and plays the video until clicked again, when it pauses and the play button reappears.
The syntax for adding an animation is:
Where the
name
is a unique name that is used for the id of the video tag, and the numbers are the width and height of the diagram in pixels.