This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class Page { | |
| has Str $.style = 'fill: #333333'; | |
| class Book { | |
| has Str $.abbreviation; | |
| has Str $.name; | |
| has Str $.author; | |
| has Str $.year; | |
| has Page @.pages; | |
| } | |
| diagram BookLayouts { | |
| element LAYOUT { <booktable> on <attribution> } | |
| element booktable { table(<book> from .books, :4columns) } | |
| element book { .abbreviation on table(<page> from .pages, :10columns) } | |
| element page { <rect width="1" height="2" style="{.style}"> } | |
| element attribution { | |
| vline on "SOURCE BOOKS" | |
| on table(<source> from .books, :2columns, :down) | |
| } | |
| element source { .name on "by $_.author, $_.year" } | |
| } | |
| my Book @books = ...; | |
| BookLayouts.render(:@books); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment