Parser is much better now and there's a better demo in sample/about-bezos.md

master
Zed A. Shaw 1 week ago
parent 494b0197db
commit a0d3f5202c
  1. 2
      Makefile
  2. BIN
      assets/sample_bg.jpg
  3. 41
      sample/01-a-good-first-program.md
  4. 45
      sample/about-bezos.md
  5. 34
      sample/with_json.md
  6. 619
      src/md_parser.cpp
  7. 20
      src/md_parser.rl
  8. 26
      src/slides_ui.cpp
  9. 1
      src/slides_ui.hpp

@ -1,4 +1,4 @@
SAMPLE=./sample/01-a-good-first-program.md
SAMPLE=./sample/about-bezos.md
ROOT_DIR=$(dir $(firstword $(MAKEFILE_LIST)))
all: build

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB

@ -1,41 +0,0 @@
{
"title": "Test",
"description": "Test"
}
===
# 1: A Good First Program
* The key is this
* That's what we want
---
{
"bg_color": [255, 0, 0, 255]
}
# What You Should See
- Yes, but with more feeling.
---
# Study Drills
!(assets/sample_bg.jpg)
---
{
"bg_image": "assets/sample_bg.jpg"
}
# Common Student Questions
* This again.
* That too.
---
# The Blue Plus
- _You must find it._
---
# The End
- See You Soon!
---
{
"bg_image": "assets/sample_bg.jpg"
}
---

@ -0,0 +1,45 @@
{
"title": "How to use Bezos",
"description": "A short presentation on Bezos."
}
===
# Bezos Slide Format
* Just markdown
separated by ---
* Each slide can
have a json header
---
# Supported Markdown
* Simple lists with *
* Images with !(file)
Spaces Newlines or
Bare content like this
---
# Deck Header
* Right after ===
* Use {} to configure
* "title"
* "description"
* "bg_color": [r,g,b,a]
* "bg_image": "filepath.jpg"
---
{ "bg_color": [55, 20, 10, 255] }
# Slide Color
* { "bg_color": [r,g,b,a] }
* Same as deck header
* Put before the content
---
{ "bg_image": "assets/sample_bg.jpg" }
# Slide Background
* { "bg_image": "file_path" }
* You don't even need text
---
# Images
!(assets/sample_bg.jpg)
* !(assets/sample_bg.jpg)
* Text will go over image
* Image will stretch to fill
---

@ -1,34 +0,0 @@
{
"title": "1: A Good First Program",
"summary": "If you skipped Exercise 0, then you are not doing this book right."
}
===
# 1: A Good First Program
* The key is this
* That's what we want
---
# What You Should See
Yes, but with more feeling.
---
{
"bg_color": [255, 0, 0, 255]
}
# Study Drills
Besos would be proud.
---
# Common Student Questions
- This again.
- That too.
---
# The Blue Plus
_You must find it_.
---
# The End
See You Soon!
---

@ -19,576 +19,104 @@ enum {
static const char _Parser_actions[] = {
0, 1, 0, 1, 1, 1, 2, 1,
3, 1, 4, 1, 5, 1, 6, 1,
7, 1, 8, 1, 9, 2, 0, 6,
2, 1, 4, 2, 2, 4, 2, 3,
4, 2, 4, 0, 2, 4, 2, 2,
4, 3, 2, 5, 8, 3, 5, 8,
4
7, 1, 8, 1, 9, 2, 0, 4,
2, 0, 8, 2, 4, 0, 2, 5,
8, 2, 8, 0, 3, 0, 4, 8,
3, 4, 0, 8, 3, 5, 0, 8,
3, 5, 8, 0, 4, 5, 0, 4,
8
};
static const short _Parser_key_offsets[] = {
static const char _Parser_key_offsets[] = {
0, 0, 1, 2, 3, 4, 5, 6,
7, 8, 17, 21, 29, 30, 31, 32,
35, 40, 42, 44, 46, 51, 59, 62,
65, 68, 77, 82, 84, 85, 89, 95,
101, 110, 114, 117, 122, 127, 132, 137,
145, 148, 151, 154, 159, 164, 169, 174,
182, 185, 188, 191, 196, 201, 203, 204,
207, 212, 215, 220, 221, 222, 230, 233,
236, 239, 242, 245, 248, 254, 260, 266,
275, 281, 285, 288, 294, 300, 306, 312,
321, 327, 331, 334, 340, 346, 352, 355,
357, 361, 367, 371, 377, 379, 381, 390,
395, 397, 399, 408, 412, 418, 421, 424,
427, 435, 440, 446, 455, 459, 463, 467,
477, 483, 486, 488, 493, 500, 507, 517,
522, 526, 532, 538, 544, 550, 559, 562,
565, 568, 576, 582, 586, 590, 594, 600,
606, 612, 618, 624, 633, 636, 639, 642,
650, 655, 661, 665, 669, 673, 679, 685,
691, 697, 700, 702, 706, 712, 716, 722,
726, 730, 739, 745, 748, 752, 756, 765,
771, 777, 783, 786, 790, 794, 803, 809,
815, 822, 829, 836, 846, 853, 858, 862,
869, 876, 883, 890, 900, 907, 912, 916,
923, 930, 937, 941, 944, 949, 956, 961,
968, 972, 979, 986, 990, 996, 999, 1004,
1006, 1009, 1015, 1018, 1023, 1025, 1029, 1030,
1039, 1049, 1059
7, 8, 17, 18, 19, 29, 33, 37,
47, 48, 48, 49, 51, 54, 58, 62,
65, 67, 69, 70, 74, 78, 88, 89,
90, 99
};
static const char _Parser_trans_keys[] = {
123, 125, 125, 10, 61, 61, 61, 10,
10, 32, 33, 35, 42, 45, 123, 9,
10, 32, 33, 35, 42, 123, 125, 9,
13, 10, 10, 10, 32, 33, 35, 42,
45, 123, 125, 9, 13, 10, 32, 9,
13, 10, 32, 9, 13, 10, 32, 33,
35, 42, 45, 9, 13, 40, 41, 41,
32, 9, 13, 10, 32, 45, 9, 13,
10, 45, 10, 45, 10, 45, 10, 32,
45, 9, 13, 10, 32, 33, 35, 42,
45, 9, 13, 10, 40, 45, 10, 41,
45, 10, 41, 45, 10, 32, 33, 35,
41, 42, 45, 9, 13, 10, 32, 41,
9, 13, 40, 41, 41, 32, 41, 9,
13, 10, 32, 41, 45, 9, 13, 10,
32, 41, 45, 9, 13, 10, 32, 33,
35, 41, 42, 45, 9, 13, 10, 40,
41, 45, 10, 41, 45, 10, 33, 35,
42, 45, 10, 32, 45, 9, 13, 10,
32, 45, 9, 13, 10, 32, 45, 9,
13, 10, 32, 33, 35, 42, 45, 9,
13, 10, 40, 45, 10, 41, 45, 10,
41, 45, 10, 33, 35, 42, 45, 10,
32, 45, 9, 13, 10, 32, 45, 9,
13, 10, 32, 45, 9, 13, 10, 32,
33, 35, 42, 45, 9, 13, 10, 40,
45, 10, 41, 45, 10, 41, 45, 10,
33, 35, 42, 45, 10, 32, 45, 9,
13, 10, 45, 10, 32, 9, 13, 10,
32, 45, 9, 13, 32, 9, 13, 10,
32, 45, 9, 13, 125, 125, 10, 32,
33, 35, 42, 45, 9, 13, 10, 41,
45, 10, 41, 45, 10, 41, 45, 10,
41, 45, 10, 41, 45, 10, 41, 45,
10, 32, 41, 45, 9, 13, 10, 32,
41, 45, 9, 13, 10, 32, 41, 45,
9, 13, 10, 32, 33, 35, 41, 42,
45, 9, 13, 10, 32, 41, 45, 9,
13, 10, 40, 41, 45, 10, 41, 45,
10, 32, 41, 45, 9, 13, 10, 32,
41, 45, 9, 13, 10, 32, 41, 45,
9, 13, 10, 32, 41, 45, 9, 13,
10, 32, 33, 35, 41, 42, 45, 9,
13, 10, 32, 41, 45, 9, 13, 10,
40, 41, 45, 10, 41, 45, 10, 32,
41, 45, 9, 13, 10, 32, 41, 45,
9, 13, 10, 32, 41, 45, 9, 13,
10, 41, 45, 10, 41, 32, 41, 9,
13, 10, 32, 41, 45, 9, 13, 32,
41, 9, 13, 10, 32, 41, 45, 9,
13, 41, 125, 41, 125, 10, 32, 33,
35, 42, 45, 125, 9, 13, 10, 32,
125, 9, 13, 40, 125, 41, 125, 10,
32, 33, 35, 41, 42, 45, 9, 13,
32, 125, 9, 13, 10, 32, 45, 125,
9, 13, 10, 45, 125, 10, 45, 125,
10, 45, 125, 10, 32, 33, 35, 42,
45, 9, 13, 10, 32, 45, 9, 13,
10, 32, 45, 125, 9, 13, 10, 32,
33, 35, 42, 45, 125, 9, 13, 10,
40, 45, 125, 10, 41, 45, 125, 10,
41, 45, 125, 10, 32, 33, 35, 41,
42, 45, 125, 9, 13, 10, 32, 41,
125, 9, 13, 40, 41, 125, 41, 125,
32, 41, 125, 9, 13, 10, 32, 41,
45, 125, 9, 13, 10, 32, 41, 45,
125, 9, 13, 10, 32, 33, 35, 41,
42, 45, 125, 9, 13, 10, 40, 41,
45, 125, 10, 41, 45, 125, 10, 33,
35, 42, 45, 125, 10, 32, 45, 125,
9, 13, 10, 32, 45, 125, 9, 13,
10, 32, 45, 125, 9, 13, 10, 32,
33, 35, 42, 45, 125, 9, 13, 10,
45, 125, 10, 45, 125, 10, 45, 125,
10, 32, 33, 35, 42, 45, 9, 13,
10, 32, 45, 125, 9, 13, 10, 40,
45, 125, 10, 41, 45, 125, 10, 41,
45, 125, 10, 33, 35, 42, 45, 125,
10, 32, 45, 125, 9, 13, 10, 32,
45, 125, 9, 13, 10, 32, 45, 125,
9, 13, 10, 32, 45, 125, 9, 13,
10, 32, 33, 35, 42, 45, 125, 9,
13, 10, 45, 125, 10, 45, 125, 10,
45, 125, 10, 32, 33, 35, 42, 45,
9, 13, 10, 32, 45, 9, 13, 10,
32, 45, 125, 9, 13, 10, 40, 45,
125, 10, 41, 45, 125, 10, 41, 45,
125, 10, 33, 35, 42, 45, 125, 10,
32, 45, 125, 9, 13, 10, 32, 45,
125, 9, 13, 10, 32, 45, 125, 9,
13, 10, 45, 125, 10, 125, 32, 125,
9, 13, 10, 32, 45, 125, 9, 13,
32, 125, 9, 13, 10, 32, 45, 125,
9, 13, 10, 41, 45, 125, 10, 41,
45, 125, 10, 32, 33, 35, 41, 42,
45, 9, 13, 10, 32, 41, 45, 9,
13, 10, 45, 125, 10, 41, 45, 125,
10, 41, 45, 125, 10, 32, 33, 35,
41, 42, 45, 9, 13, 10, 32, 41,
45, 9, 13, 10, 32, 45, 125, 9,
13, 10, 32, 45, 125, 9, 13, 10,
45, 125, 10, 41, 45, 125, 10, 41,
45, 125, 10, 32, 33, 35, 41, 42,
45, 9, 13, 10, 32, 41, 45, 9,
13, 10, 32, 41, 45, 9, 13, 10,
32, 41, 45, 125, 9, 13, 10, 32,
41, 45, 125, 9, 13, 10, 32, 41,
45, 125, 9, 13, 10, 32, 33, 35,
41, 42, 45, 125, 9, 13, 10, 32,
41, 45, 125, 9, 13, 10, 40, 41,
45, 125, 10, 41, 45, 125, 10, 32,
41, 45, 125, 9, 13, 10, 32, 41,
45, 125, 9, 13, 10, 32, 41, 45,
125, 9, 13, 10, 32, 41, 45, 125,
9, 13, 10, 32, 33, 35, 41, 42,
45, 125, 9, 13, 10, 32, 41, 45,
125, 9, 13, 10, 40, 41, 45, 125,
10, 41, 45, 125, 10, 32, 41, 45,
125, 9, 13, 10, 32, 41, 45, 125,
9, 13, 10, 32, 41, 45, 125, 9,
13, 10, 41, 45, 125, 10, 41, 125,
32, 41, 125, 9, 13, 10, 32, 41,
45, 125, 9, 13, 32, 41, 125, 9,
13, 10, 32, 41, 45, 125, 9, 13,
10, 41, 45, 125, 10, 32, 41, 45,
125, 9, 13, 10, 32, 41, 45, 125,
9, 13, 10, 41, 45, 125, 32, 41,
45, 125, 9, 13, 41, 45, 125, 32,
45, 125, 9, 13, 45, 125, 10, 41,
45, 10, 32, 41, 45, 9, 13, 10,
41, 45, 32, 41, 45, 9, 13, 41,
45, 32, 45, 9, 13, 45, 10, 32,
33, 35, 42, 45, 123, 9, 13, 10,
32, 33, 35, 41, 42, 45, 123, 9,
13, 10, 32, 33, 35, 42, 45, 123,
125, 9, 13, 10, 32, 33, 35, 41,
42, 45, 123, 125, 9, 13, 0
35, 42, 45, 123, 125, 9, 13, 40,
41, 10, 41, 32, 9, 13, 10, 32,
9, 13, 10, 32, 9, 13, 32, 9,
13, 10, 45, 10, 45, 10, 10, 32,
9, 13, 10, 32, 9, 13, 10, 32,
33, 35, 42, 45, 123, 125, 9, 13,
125, 125, 10, 32, 33, 35, 42, 123,
125, 9, 13, 10, 32, 33, 35, 42,
123, 125, 9, 13, 0
};
static const char _Parser_single_lengths[] = {
0, 1, 1, 1, 1, 1, 1, 1,
1, 7, 2, 6, 1, 1, 1, 1,
3, 2, 2, 2, 3, 6, 3, 3,
3, 7, 3, 2, 1, 2, 4, 4,
7, 4, 3, 5, 3, 3, 3, 6,
3, 3, 3, 5, 3, 3, 3, 6,
3, 3, 3, 5, 3, 2, 1, 1,
3, 1, 3, 1, 1, 6, 3, 3,
3, 3, 3, 3, 4, 4, 4, 7,
4, 4, 3, 4, 4, 4, 4, 7,
4, 4, 3, 4, 4, 4, 3, 2,
2, 4, 2, 4, 2, 2, 7, 3,
2, 2, 7, 2, 4, 3, 3, 3,
6, 3, 4, 7, 4, 4, 4, 8,
4, 3, 2, 3, 5,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1,
0, 1, 1, 0, 1, 0, 1, 0,
0, 1, 0, 1, 0, 1, 0, 1,
1, 1, 1
0, 0, 0, 1, 1, 1, 0, 0,
1, 1
};
static const short _Parser_index_offsets[] = {
static const unsigned char _Parser_index_offsets[] = {
0, 0, 2, 4, 6, 8, 10, 12,
14, 16, 25, 29, 37, 39, 41, 43,
46, 51, 54, 57, 60, 65, 73, 77,
81, 85, 94, 99, 102, 104, 108, 114,
120, 129, 134, 138, 144, 149, 154, 159,
167, 171, 175, 179, 185, 190, 195, 200,
208, 212, 216, 220, 226, 231, 234, 236,
239, 244, 247, 252, 254, 256, 264, 268,
272, 276, 280, 284, 288, 294, 300, 306,
315, 321, 326, 330, 336, 342, 348, 354,
363, 369, 374, 378, 384, 390, 396, 400,
403, 407, 413, 417, 423, 426, 429, 438,
443, 446, 449, 458, 462, 468, 472, 476,
480, 488, 493, 499, 508, 513, 518, 523,
533, 539, 543, 546, 551, 558, 565, 575,
581, 586, 593, 599, 605, 611, 620, 624,
628, 632, 640, 646, 651, 656, 661, 668,
674, 680, 686, 692, 701, 705, 709, 713,
721, 726, 732, 737, 742, 747, 754, 760,
766, 772, 776, 779, 783, 789, 793, 799,
804, 809, 818, 824, 828, 833, 838, 847,
853, 859, 865, 869, 874, 879, 888, 894,
900, 907, 914, 921, 931, 938, 944, 949,
956, 963, 970, 977, 987, 994, 1000, 1005,
1012, 1019, 1026, 1031, 1035, 1040, 1047, 1052,
1059, 1064, 1071, 1078, 1083, 1089, 1093, 1098,
1101, 1105, 1111, 1115, 1120, 1123, 1127, 1129,
1138, 1148, 1158
14, 16, 25, 27, 29, 39, 43, 47,
57, 59, 60, 62, 65, 68, 72, 76,
79, 82, 85, 87, 91, 95, 105, 107,
109, 118
};
static const char _Parser_indicies[] = {
0, 1, 1, 2, 3, 2, 4, 1,
5, 1, 6, 1, 7, 1, 8, 1,
11, 10, 12, 13, 14, 15, 1, 10,
9, 1, 16, 18, 17, 21, 20, 22,
23, 24, 25, 1, 1, 20, 19, 27,
26, 26, 16, 27, 28, 28, 17, 29,
20, 22, 23, 24, 25, 1, 1, 20,
19, 30, 1, 31, 33, 32, 34, 33,
32, 35, 35, 1, 38, 37, 37, 36,
18, 37, 37, 36, 39, 39, 1, 1,
40, 16, 18, 41, 17, 42, 1, 44,
43, 43, 16, 44, 45, 45, 17, 46,
10, 12, 13, 14, 47, 1, 1, 10,
9, 1, 48, 49, 48, 52, 51, 53,
54, 55, 1, 1, 51, 50, 11, 10,
12, 13, 14, 15, 1, 10, 9, 0
};
static const unsigned char _Parser_trans_targs[] = {
2, 0, 0, 3, 4, 3, 5, 0,
6, 0, 7, 0, 8, 0, 9, 0,
11, 10, 12, 15, 55, 57, 59, 10,
0, 11, 10, 10, 0, 11, 10, 12,
15, 55, 213, 10, 0, 13, 0, 0,
14, 11, 14, 16, 16, 0, 16, 20,
18, 20, 17, 11, 18, 17, 11, 19,
17, 11, 0, 17, 21, 20, 18, 20,
17, 21, 20, 22, 36, 37, 45, 20,
17, 11, 23, 18, 17, 25, 17, 66,
24, 25, 35, 66, 24, 25, 26, 27,
29, 11, 88, 211, 26, 14, 25, 26,
11, 26, 14, 28, 11, 14, 11, 14,
30, 11, 30, 14, 30, 31, 35, 66,
31, 24, 32, 31, 35, 66, 31, 24,
32, 31, 33, 68, 35, 69, 209, 31,
24, 25, 34, 35, 66, 24, 25, 35,
66, 24, 11, 22, 36, 37, 45, 17,
21, 20, 18, 20, 17, 39, 38, 18,
38, 17, 39, 38, 18, 38, 17, 39,
38, 40, 36, 44, 45, 38, 17, 11,
41, 18, 17, 25, 17, 64, 42, 25,
43, 64, 42, 11, 40, 36, 44, 45,
17, 39, 38, 18, 38, 17, 47, 46,
53, 46, 17, 47, 46, 18, 46, 17,
47, 46, 48, 36, 44, 52, 46, 17,
11, 49, 18, 17, 25, 17, 62, 50,
25, 51, 62, 50, 11, 48, 36, 44,
52, 17, 47, 46, 53, 46, 17, 11,
54, 17, 215, 0, 56, 56, 0, 56,
38, 18, 38, 17, 58, 58, 0, 58,
46, 18, 46, 17, 0, 60, 61, 60,
11, 10, 12, 15, 55, 57, 10, 0,
25, 51, 63, 50, 25, 51, 14, 50,
25, 43, 65, 42, 25, 43, 14, 42,
25, 35, 67, 24, 25, 35, 14, 24,
32, 31, 35, 66, 31, 24, 71, 70,
35, 66, 70, 24, 71, 70, 35, 66,
70, 24, 71, 72, 73, 75, 43, 76,
77, 72, 42, 71, 72, 43, 64, 72,
42, 25, 74, 43, 64, 42, 25, 43,
64, 42, 32, 31, 43, 64, 31, 42,
71, 72, 43, 64, 72, 42, 79, 78,
43, 208, 78, 42, 79, 78, 43, 64,
78, 42, 79, 80, 81, 83, 51, 84,
85, 80, 50, 79, 80, 51, 62, 80,
50, 25, 82, 51, 62, 50, 25, 51,
62, 50, 32, 31, 51, 62, 31, 50,
71, 72, 51, 62, 72, 50, 79, 80,
51, 86, 80, 50, 25, 51, 87, 50,
216, 11, 14, 89, 11, 89, 14, 89,
72, 43, 64, 72, 42, 91, 11, 91,
14, 91, 80, 51, 62, 80, 50, 94,
14, 93, 94, 98, 93, 94, 95, 96,
99, 155, 206, 61, 95, 60, 94, 95,
61, 95, 60, 97, 61, 60, 60, 98,
93, 25, 26, 27, 29, 11, 88, 90,
26, 14, 100, 61, 100, 60, 100, 106,
102, 104, 106, 101, 94, 102, 104, 101,
94, 103, 104, 101, 94, 60, 104, 101,
11, 17, 22, 36, 37, 105, 17, 17,
47, 46, 19, 46, 17, 107, 106, 102,
104, 106, 101, 107, 106, 108, 122, 123,
168, 104, 106, 101, 94, 109, 102, 104,
101, 111, 101, 171, 173, 110, 111, 121,
171, 173, 110, 111, 112, 113, 115, 94,
196, 204, 98, 112, 93, 111, 112, 94,
98, 112, 93, 114, 94, 98, 93, 94,
98, 93, 116, 94, 98, 116, 93, 116,
117, 121, 171, 173, 117, 110, 118, 117,
121, 171, 173, 117, 110, 118, 117, 119,
176, 121, 177, 201, 173, 117, 110, 111,
120, 121, 171, 173, 110, 111, 121, 171,
173, 110, 94, 108, 122, 123, 168, 104,
101, 107, 106, 102, 104, 106, 101, 125,
124, 102, 104, 124, 101, 125, 124, 102,
104, 124, 101, 125, 130, 131, 135, 136,
137, 129, 130, 126, 94, 127, 129, 126,
94, 128, 129, 126, 94, 60, 129, 126,
11, 17, 40, 36, 44, 105, 17, 17,
125, 130, 127, 129, 130, 126, 94, 132,
127, 129, 126, 111, 126, 164, 166, 133,
111, 134, 164, 166, 133, 94, 131, 135,
136, 137, 129, 126, 107, 106, 127, 129,
106, 126, 125, 130, 127, 129, 130, 126,
139, 138, 163, 129, 138, 126, 139, 138,
127, 129, 138, 126, 139, 145, 146, 150,
151, 152, 143, 145, 140, 94, 141, 143,
140, 94, 142, 143, 140, 94, 60, 143,
140, 11, 17, 48, 36, 44, 144, 17,
17, 47, 46, 19, 46, 17, 139, 145,
141, 143, 145, 140, 94, 147, 141, 143,
140, 111, 140, 159, 161, 148, 111, 149,
159, 161, 148, 94, 146, 150, 151, 152,
143, 140, 107, 106, 141, 143, 106, 140,
125, 130, 141, 143, 130, 140, 139, 145,
153, 143, 145, 140, 94, 154, 143, 140,
217, 61, 60, 156, 61, 156, 60, 156,
130, 127, 129, 130, 126, 158, 61, 158,
60, 158, 145, 141, 143, 145, 140, 111,
149, 160, 161, 148, 111, 149, 93, 161,
148, 25, 50, 81, 83, 51, 84, 162,
50, 50, 79, 80, 51, 63, 80, 50,
94, 154, 129, 126, 111, 134, 165, 166,
133, 111, 134, 93, 166, 133, 25, 42,
73, 75, 43, 76, 167, 42, 42, 79,
78, 43, 65, 78, 42, 139, 169, 170,
104, 169, 101, 139, 169, 102, 104, 169,
101, 94, 154, 104, 101, 111, 121, 172,
173, 110, 111, 121, 93, 173, 110, 25,
24, 33, 68, 35, 69, 174, 24, 24,
79, 175, 35, 67, 175, 24, 79, 175,
35, 66, 175, 24, 118, 117, 121, 171,
173, 117, 110, 179, 178, 121, 171, 173,
178, 110, 179, 178, 121, 171, 173, 178,
110, 179, 180, 181, 183, 134, 184, 185,
166, 180, 133, 179, 180, 134, 164, 166,
180, 133, 111, 182, 134, 164, 166, 133,
111, 134, 164, 166, 133, 118, 117, 134,
164, 166, 117, 133, 179, 180, 134, 164,
166, 180, 133, 187, 186, 134, 200, 166,
186, 133, 187, 186, 134, 164, 166, 186,
133, 187, 188, 189, 191, 149, 192, 193,
161, 188, 148, 187, 188, 149, 159, 161,
188, 148, 111, 190, 149, 159, 161, 148,
111, 149, 159, 161, 148, 118, 117, 149,
159, 161, 117, 148, 179, 180, 149, 159,
161, 180, 148, 187, 188, 149, 194, 161,
188, 148, 111, 149, 195, 161, 148, 218,
94, 98, 93, 197, 94, 98, 197, 93,
197, 180, 134, 164, 166, 180, 133, 199,
94, 98, 199, 93, 199, 188, 149, 159,
161, 188, 148, 111, 134, 195, 166, 133,
187, 202, 121, 203, 173, 202, 110, 187,
202, 121, 171, 173, 202, 110, 111, 121,
195, 173, 110, 199, 94, 205, 98, 199,
93, 94, 195, 98, 93, 158, 207, 61,
158, 60, 154, 61, 60, 25, 43, 87,
42, 79, 175, 35, 210, 175, 24, 25,
35, 87, 24, 91, 11, 212, 91, 14,
11, 87, 14, 58, 214, 58, 0, 54,
0, 11, 10, 12, 15, 55, 57, 59,
10, 0, 25, 26, 27, 29, 11, 88,
90, 92, 26, 14, 94, 95, 96, 99,
155, 157, 60, 61, 95, 60, 111, 112,
113, 115, 94, 196, 198, 93, 98, 112,
93, 0
static const char _Parser_trans_targs[] = {
2, 0, 3, 4, 5, 6, 7, 8,
9, 10, 27, 29, 16, 20, 23, 30,
11, 11, 12, 10, 13, 15, 16, 20,
23, 24, 14, 15, 14, 15, 17, 18,
18, 19, 12, 21, 11, 22, 21, 21,
25, 26, 33, 28, 29, 28, 29, 24,
31, 32, 10, 27, 29, 16, 20, 23
};
static const char _Parser_trans_actions[] = {
1, 0, 0, 0, 0, 0, 11, 0,
0, 0, 0, 0, 0, 0, 15, 0,
17, 17, 17, 17, 17, 17, 1, 17,
0, 0, 0, 0, 0, 0,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 21, 1,
1, 1, 1, 9, 13, 0, 0, 0,
36, 5, 13, 0, 0, 5, 0, 9,
1, 21, 1, 1, 1, 1, 9, 13,
0, 0, 0, 5, 13, 0, 0, 5,
0, 13, 0, 0, 0, 5, 0, 0,
5, 0, 0, 0, 0, 9, 13, 0,
0, 36, 5, 13, 0, 5, 0, 9,
13, 0, 0, 5, 13, 0, 5, 0,
13, 0, 0, 5, 0, 5, 0, 0,
0, 17, 17, 17, 17, 17, 17, 1,
17, 0, 17, 17, 17, 17, 13, 17,
17, 1, 17, 0, 17, 17, 17, 17,
17, 17, 1, 0, 17, 0, 17, 17,
17, 17, 13, 17, 17, 1, 0, 17,
0, 0
1, 0, 0, 0, 11, 0, 0, 0,
15, 33, 24, 36, 17, 17, 17, 1,
5, 0, 9, 1, 1, 21, 0, 0,
0, 1, 5, 9, 0, 27, 0, 1,
0, 13, 0, 3, 1, 1, 0, 7,
5, 0, 19, 5, 9, 0, 40, 33,
0, 0, 48, 44, 52, 30, 30, 30
};
static const int Parser_start = 1;
static const int Parser_first_final = 215;
static const int Parser_first_final = 33;
static const int Parser_error = 0;
static const int Parser_en_main = 1;
@ -610,14 +138,14 @@ bool Parser::parse(const std::string& input) {
last = DECK;
#line 605 "..//src/md_parser.cpp"
#line 133 "..//src/md_parser.cpp"
{
cs = Parser_start;
}
#line 108 "..//src/md_parser.rl"
#line 608 "..//src/md_parser.cpp"
#line 136 "..//src/md_parser.cpp"
{
int _klen;
unsigned int _trans;
@ -679,6 +207,7 @@ _resume:
}
_match:
_trans = _Parser_indicies[_trans];
cs = _Parser_trans_targs[_trans];
if ( _Parser_trans_actions[_trans] == 0 )
@ -767,7 +296,7 @@ _match:
config.clear();
}
break;
#line 747 "..//src/md_parser.cpp"
#line 276 "..//src/md_parser.cpp"
}
}

@ -71,22 +71,22 @@ enum {
end = '---' %end_slide;
pound = '#' %title;
asterisk = '*' %enum;
dash = '-' %plain;
bang = '!';
dash = '-' %enum;
json = ('{'|'}');
other = ^(bang|pound|asterisk|eol|json) %plain;
content = (any+ -- eol) >mark %content;
image = bang '(' (any+ -- ')' ) >mark %image ')';
image = bang '(' (any+) >mark %image ')' :>> eol;
meta = ('{' ( any+ -- '}') '}') >mark %meta;
content = (any+ -- (eol|end)) >mark %content eol;
title = pound space+ content;
enum = asterisk space+ content;
line = dash space+ content;
blank = space* eol;
title = pound space+ content :>> eol;
enum = asterisk space+ content :>> eol;
raw = (other (any+ -- eol)) >mark %content :>> eol;
blank = space* >mark %content eol;
slide = meta? (title | enum | line | blank | image)+ >start_slide end eol;
slide = meta? blank* (title | enum | raw | blank | image)+ >start_slide :>> end eol;
main := meta eol start eol (slide)+;
}%%
%% write data;

@ -27,7 +27,7 @@ void Slide::init(lel::Cell& cell) {
$gui.layout(
"[=*%(300,200)title|_|_]"
"[_|_|_]"
"[=*%(300,600)content|_|_]"
"[*%(300,600)content|_|_]"
"[_|_|_]"
"[_|_|_]"
"[_|_|_]"
@ -61,20 +61,36 @@ SlidesUI::SlidesUI(shared_ptr<SlideDeck> deck) {
dbc::check(deck->slides.size() > 0, "slide deck is empy");
$deck = deck;
$current = 0;
}
void SlidesUI::set_text(const std::string& name) {
if($deck->config.contains(name)) {
auto text = $gui.entity(name);
std::string content = $deck->config[name];
$gui.set<guecs::Text>(text, {
guecs::to_wstring(content),
guecs::THEME.TEXT_SIZE-10,
guecs::THEME.LIGHT_DARK,
});
}
}
void SlidesUI::init() {
$gui.position(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT);
$gui.layout(
"[t_left|t_center|t_right]"
"[*%(300,400)slide|_|_|_|_]"
"[*%(300,500)slide|_|_|_|_]"
"[_|_|_|_|_]"
"[_|_|_|_|_]"
"[_|_|_|_|_]"
"[_|_|_|_|_]"
"[b_left|b_center|b_right]"
"[_]"
"[title|*%(200,100)description|_|_|_]"
);
}
void SlidesUI::init() {
set_text("title");
set_text("description");
guecs::Background bg{$gui.$parser};
bg.set_color(guecs::THEME.BG_COLOR_DARK);
$gui.set<guecs::Background>($gui.MAIN, bg);

@ -41,4 +41,5 @@ struct SlidesUI {
void show_slide();
void render(sf::RenderWindow& window);
void mouse(float x, float y, guecs::Modifiers mods);
void set_text(const std::string& name);
};

Loading…
Cancel
Save