pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add inline code support.
[smdp.git]
/
parser.c
diff --git
a/parser.c
b/parser.c
index
ec341ab
..
1ff125c
100644
(file)
--- a/
parser.c
+++ b/
parser.c
@@
-39,7
+39,8
@@
deck_t *markdown_load(FILE *input) {
deck_t *deck = new_deck();
slide_t *slide = new_slide();
deck_t *deck = new_deck();
slide_t *slide = new_slide();
- line_t *line;
+ line_t *line = NULL;
+ line_t *tmp = NULL;
cstring_t *text = cstring_init();
// assign first slide to deck
cstring_t *text = cstring_init();
// assign first slide to deck
@@
-52,9
+53,15
@@
deck_t *markdown_load(FILE *input) {
// markdown analyse
bits = markdown_analyse(text);
// markdown analyse
bits = markdown_analyse(text);
+ // if first line in file is markdown hr
+ if(!line && CHECK_BIT(bits, IS_HR)) {
+
+ // clear text
+ (text->reset)(text);
+
// if text is markdown hr
// if text is markdown hr
- if(CHECK_BIT(bits, IS_HR) &&
- CHECK_BIT(line->bits, IS_EMPTY)) {
+
} else
if(CHECK_BIT(bits, IS_HR) &&
+
CHECK_BIT(line->bits, IS_EMPTY)) {
slide->lines = lc;
slide->lines = lc;
@@
-198,7
+205,7
@@
deck_t *markdown_load(FILE *input) {
if(line->next)
line->next->prev = line->prev;
if(line->next)
line->next->prev = line->prev;
- // set bits on revious line
+ // set bits on
p
revious line
if(CHECK_BIT(line->bits, IS_H1)) {
SET_BIT(line->prev->bits, IS_H1);
} else {
if(CHECK_BIT(line->bits, IS_H1)) {
SET_BIT(line->prev->bits, IS_H1);
} else {
@@
-208,9
+215,13
@@
deck_t *markdown_load(FILE *input) {
// adjust line count
slide->lines -= 1;
// adjust line count
slide->lines -= 1;
+ // maintain loop condition
+ tmp = line;
+ line = line->prev;
+
// delete line
// delete line
- (
line->text->delete)(line
->text);
- free(
line
);
+ (
tmp->text->delete)(tmp
->text);
+ free(
tmp
);
}
line = line->next;
}
}
line = line->next;
}