Skip to content

Commit bf03648

Browse files
committed
Add bulleted lists
1 parent eda98f2 commit bf03648

4 files changed

Lines changed: 15 additions & 13 deletions

File tree

src/md2ms.l

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ typedef enum {
1717
PRE_SH3,
1818
PRE_SH4,
1919
PRE_SH5,
20-
PRE_IP,
20+
PRE_IP_BULLET,
21+
PRE_IP_DASH,
2122
SUR_BI,
2223
SUR_B,
2324
SUR_I,
@@ -80,8 +81,8 @@ SPACE [ \t]+
8081
"### "{STRING}+"\n" { do_pre(yytext, PRE_SH3); }
8182
"#### "{STRING}+"\n" { do_pre(yytext, PRE_SH4); }
8283
"##### "{STRING}+"\n" { do_pre(yytext, PRE_SH5); }
83-
"\n* " { do_pre(yytext, PRE_IP); }
84-
"\n- " { do_pre(yytext, PRE_IP); }
84+
"\n* " { do_pre(yytext, PRE_IP_BULLET); }
85+
"\n- " { do_pre(yytext, PRE_IP_DASH); }
8586
"***"{STRING}+"***" { do_surround(yytext, SUR_BI); }
8687
"**"{STRING}+"**" { do_surround(yytext, SUR_B); }
8788
"*"{STRING}+"*" { do_surround(yytext, SUR_I); }
@@ -136,7 +137,8 @@ void do_pre(char *text, MSTag type) {
136137
case PRE_SH3: fprintf(args.output, "\n.NH 3\n%s\n.PP", strip_whitespace(&text[4])); break;
137138
case PRE_SH4: fprintf(args.output, "\n.NH 4\n%s\n.PP", strip_whitespace(&text[5])); break;
138139
case PRE_SH5: fprintf(args.output, "\n.NH 5\n%s\n.PP", strip_whitespace(&text[6])); break;
139-
case PRE_IP: fprintf(args.output, "\n.IP - \n"); break;
140+
case PRE_IP_BULLET: fprintf(args.output, "\n.IP \\(bu \n"); break;
141+
case PRE_IP_DASH: fprintf(args.output, "\n.IP - \n"); break;
140142
}
141143
}
142144

test/input/list.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Lists
22

3-
## List 1
3+
## Bullet list
44

55
* List item 1
66
* List item 2
77
* List item 3
88

9-
## List 2
9+
## Dash list
1010

1111
- List item 1
1212
- List item 2

test/output/list.man

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55

6-
.SH List 1
6+
.SH Bullet list
77

88

99
.TP
@@ -14,7 +14,7 @@ List item 2
1414
List item 3
1515

1616

17-
.SH List 2
17+
.SH Dash list
1818

1919

2020
.TP

test/output/list.ms

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@ Lists
66
.PP
77

88
.NH 2
9-
List 1
9+
Bullet list
1010

1111
.PP
12-
.IP -
12+
.IP \(bu
1313
List item 1
14-
.IP -
14+
.IP \(bu
1515
List item 2
16-
.IP -
16+
.IP \(bu
1717
List item 3
1818
.PP
1919

2020
.NH 2
21-
List 2
21+
Dash list
2222

2323
.PP
2424
.IP -

0 commit comments

Comments
 (0)