pinosaur
/
smdp.git
/ blobdiff
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
add color to CODE, H1 and H2
[smdp.git]
/
parser.c
diff --git
a/parser.c
b/parser.c
index
29dbf83
..
3346634
100644
(file)
--- a/
parser.c
+++ b/
parser.c
@@
-81,7
+81,7
@@
deck_t *markdown_load(FILE *input) {
} else if(c == '\t') {
// expand tab to spaces
} else if(c == '\t') {
// expand tab to spaces
- for (i = 0; i <
=
EXPAND_TABS; i++) {
+ for (i = 0; i < EXPAND_TABS; i++) {
(text->expand)(text, ' ');
l++;
}
(text->expand)(text, ' ');
l++;
}
@@
-172,7
+172,8
@@
deck_t *markdown_load(FILE *input) {
// remove line from linked list
line->prev->next = line->next;
// remove line from linked list
line->prev->next = line->next;
- line->next->prev = line->prev;
+ if(line->next)
+ line->next->prev = line->prev;
// set bits on revious line
if(CHECK_BIT(line->bits, IS_H1)) {
// set bits on revious line
if(CHECK_BIT(line->bits, IS_H1)) {
@@
-360,12
+361,16
@@
int next_nonblank(cstring_t *text, int i) {
++i;
return i;
++i;
return i;
-}
;
+}
int next_blank(cstring_t *text, int i) {
while ((i < text->size) && !isspace((text->text)[i]))
++i;
return i;
int next_blank(cstring_t *text, int i) {
while ((i < text->size) && !isspace((text->text)[i]))
++i;
return i;
-};
+}
+
+int next_word(cstring_t *text, int i) {
+ return next_nonblank(text, next_blank(text, i));
+}