Raku document EDSL

Run Settings
LanguageRaku
Language Version
Run Command
# Write the body in the default style. sub default-style(&body) { my $*text-font-family := ‘Computer Modern’; my $*text-font-size := ‘12pt’; my $*text-color := ‘black’; my $*box-background-color := ‘transparent’; my $*box-border-color := ‘black’; my $*box-border-style := ‘solid’; my $*box-border-width := ‘0’; my $*box-padding-top := ‘0’; my $*box-padding-bottom := ‘0’; my $*box-padding-left := ‘0’; my $*box-padding-right := ‘0’; body; } # Write text in the current text style. sub text(Str() $text --> Nil) { print ‘<span style="’; print “font-family: '$*text-font-family';”; print “ font-size: $*text-font-size;”; print “ color: $*text-color;”; print ‘">’; print $text.trans(‘&’ => ‘&amp;’, ‘<’ => ‘&lt;’); print ‘</span>’; } # Write a block in the current box style around the given body. sub block(&body --> Nil) { print ‘<div style="’; print “background-color: $*box-background-color;”; print “ border-color: $*box-border-color;”; print “ border-style: $*box-border-style;”; print “ border-width: $*box-border-width;”; print “ padding-top: $*box-padding-top;”; print “ padding-bottom: $*box-padding-bottom;”; print “ padding-left: $*box-padding-left;”; print “ padding-right: $*box-padding-right;”; print ‘">’; body; print ‘</div>’; } # Write Latin placeholder text in the current text style. sub lipsum(--> Nil) { text q:to/EOF/.chop.subst(“\n”, ‘ ’, :g); Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec et ante eu lacus lobortis tempor at et orci. Maecenas eu tortor velit. Mauris feugiat nisi eu massa euismod fringilla. Cras vel tristique ante, sit amet porttitor quam. Integer dapibus tempor mi, quis cursus dolor congue non. Aliquam eros urna, scelerisque vel risus ac, eleifend ultrices purus. Suspendisse in imperdiet lorem. Donec auctor turpis ac mollis tincidunt. Fusce eu varius felis. Vivamus vitae mattis purus. Integer vulputate metus semper nibh pharetra sodales. Sed a metus aliquet, elementum tellus et, lobortis nulla. Proin dignissim purus vitae arcu finibus, at aliquam sem rhoncus. EOF } # New document structure. sub document(&body --> Nil) { my $*chapter = 0; body; } sub chapter(Str() $title, &body --> Nil) { ++$*chapter; my $*section = 0; default-style { block { my $*text-font-size := ‘24pt’; text “Chapter $*chapter: $title”; } } body; } sub section(Str() $title, &body --> Nil) { ++$*section; default-style { block { my $*text-font-size := ‘18pt’; text “Section $*section: $title”; } } body; } # Example. default-style { document { chapter ‘Text’, { lipsum; text ‘ ’; for <red green blue> -> $*text-color { lipsum; text ‘ ’; } } chapter ‘Boxes’, { my $*box-background-color := ‘orange’; block { lipsum; } } } }
Editor Settings
Theme
Key bindings
Full width
Lines