From 14c998b253489b88bc4da904409e32c86bbe92c0 Mon Sep 17 00:00:00 2001 From: Thomas White Date: Sat, 23 Feb 2019 16:45:15 +0100 Subject: Everything needed for demo doc --- data/demo.sc | 31 +++++++++++++++++++++++++------ libstorycode/storycode.l | 3 ++- libstorycode/storycode.y | 44 +++++++++++++++++++++++++++++--------------- 3 files changed, 56 insertions(+), 22 deletions(-) diff --git a/data/demo.sc b/data/demo.sc index 413a1e9..ab0baf8 100644 --- a/data/demo.sc +++ b/data/demo.sc @@ -1,17 +1,36 @@ STYLES { NARRATIVE { - PRESTITLE { - FONT: Cantarell Bold 16 - } + FONT: Cantarell Regular 16 + FGCOL: #222222 + BGCOL: #ffffff + PARASPACE: 0u,0u,10u,10u + PAD: 10u,10u,10u,10u + PRESTITLE { + FONT: Cantarell Bold 20 + } } SLIDE { - SIZE 1820u x 720u + SIZE 1024u x 768u + TEXT { + FONT: Cantarell Regular 14 + PAD: 0u,0u,0u,0u + PARASPACE: 5u,5u,5u,5u + FGCOL: #c5c5c5 + BGCOL: rgba(0,0,0,0) + } PRESTITLE { - TYPE: TEXT[1fx90u+0+0] + GEOMETRY: 1f x 140u +0 +0 FONT: Cantarell Regular 64 - PAD: 20,20,20,20 + PAD: 20u,20u,20u,20u FGCOL: #eeeeee + BGCOL: rgba(0,0,0,0) ALIGN: center + } + SLIDETITLE { + GEOMETRY: 1f x 90u +0 +0 + FONT: Cantarell Regular 36 + PAD: 20u,20u,20u,20u + FGCOL: #eeeeee BGCOL: rgba(0,0,0,0) } } diff --git a/libstorycode/storycode.l b/libstorycode/storycode.l index 98f8f6a..0406ee3 100644 --- a/libstorycode/storycode.l +++ b/libstorycode/storycode.l @@ -45,12 +45,13 @@ SLIDETITLE { return SC_SLIDETITLE; } NARRATIVE { return SC_NARRATIVE; } SLIDE { return SC_SLIDE; } BP { return SC_BP; } -TYPE { return SC_TYPE; } +GEOMETRY { return SC_GEOMETRY; } TEXT { return SC_TEXTFRAME; } IMAGE { return SC_IMAGEFRAME; } FOOTER { return SC_FOOTER; } FONT { return SC_FONT; } PAD { return SC_PAD; } +PARASPACE { return SC_PARASPACE; } ALIGN { return SC_ALIGN; } FGCOL { return SC_FGCOL; } BGCOL { return SC_BGCOL; } diff --git a/libstorycode/storycode.y b/libstorycode/storycode.y index b2b2afa..9d1e74f 100644 --- a/libstorycode/storycode.y +++ b/libstorycode/storycode.y @@ -65,14 +65,14 @@ %token IMAGEFRAME %token BP -%token FONT TYPE PAD ALIGN FGCOL BGCOL +%token FONT GEOMETRY PAD ALIGN FGCOL BGCOL PARASPACE %token LEFT CENTER RIGHT %token STRING %token OPENBRACE CLOSEBRACE %token SQOPEN SQCLOSE -%token PLUS TIMES +%token PLUS TIMES COLON %token UNIT VALUE SIZE %type

presentation @@ -267,27 +267,40 @@ style_narrative: style_narrative_def: %empty -| style_narrative_def style_prestitle +| style_narrative_def style_narrative_prestitle | style_narrative_def styledef ; +style_narrative_prestitle: + PRESTITLE OPENBRACE styledefs CLOSEBRACE { printf("narrative prestitle style\n"); } +; + style_slide: SLIDE OPENBRACE style_slide_def CLOSEBRACE { printf("slide style\n"); } ; style_slide_def: %empty -| style_slide_def style_prestitle -| style_slide_def style_slidesize -| style_slide_def styledef +| style_slide_def style_slide_prestitle { printf("slide prestitle\n"); } +| style_slide_def style_slide_text { printf("slide text\n"); } +| style_slide_def style_slide_title { printf("slide title\n"); } +| style_slide_def style_slidesize { printf("slide size\n"); } ; style_slidesize: - SIZE length TIMES length { $$.w = $2; $$.h = $4; $$.x.len = 0.0; $$.y.len = 0.0; } + SIZE length TIMES length { $$.w = $2; $$.h = $4; $$.x.len = 0.0; $$.y.len = 0.0; printf("size\n");} +; + +style_slide_prestitle: + PRESTITLE OPENBRACE styledefs CLOSEBRACE { printf("slide prestitle style\n"); } +; + +style_slide_title: + SLIDETITLE OPENBRACE styledefs CLOSEBRACE { printf("slide title style\n"); } ; -style_prestitle: - PRESTITLE OPENBRACE styledefs CLOSEBRACE { printf("prestitle style\n"); } +style_slide_text: + TEXTFRAME OPENBRACE styledefs CLOSEBRACE { printf("slide text style\n"); } ; styledefs: @@ -296,12 +309,13 @@ styledefs: ; styledef: - FONT STRING { printf("font def: '%s'\n", $2); } -| TYPE STRING { printf("type def: '%s'\n", $2); } -| PAD STRING { printf("pad def: '%s'\n", $2); } -| FGCOL STRING { printf("fgcol def: '%s'\n", $2); } -| BGCOL STRING { printf("bgcol def: '%s'\n", $2); } -| ALIGN STRING { printf("align def: '%s'\n", $2); } + FONT STRING { printf("font def: '%s'\n", $2); } +| GEOMETRY STRING { printf("type def: '%s'\n", $2); } +| PAD STRING { printf("pad def: '%s'\n", $2); } +| PARASPACE STRING { printf("align def: '%s'\n", $2); } +| FGCOL STRING { printf("fgcol def: '%s'\n", $2); } +| BGCOL STRING { printf("bgcol def: '%s'\n", $2); } +| ALIGN STRING { printf("align def: '%s'\n", $2); } ; %% -- cgit v1.2.3