breakout_parser 0.0.12 → 0.0.13

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,6 +96,8 @@ size_t site_url_len = 0;
96
96
 
97
97
  extern VALUE git_url;
98
98
 
99
+ int list_level = 1;
100
+
99
101
  #define CHECK_BUF_SIZE(len) \
100
102
  if( (bufptr - buf + len + 1) >= bufsize ){ \
101
103
  /*printf("[.] REALLOC oldsz=%d, newsz=%d\n",bufsize, (bufsize+((len > 0x1000) ? (len+0x1000) : 0x1000)));*/ \
@@ -135,7 +137,7 @@ void yyerror(const char *msg)
135
137
 
136
138
 
137
139
  /* Line 189 of yacc.c */
138
- #line 139 "parser.tab.c"
140
+ #line 141 "parser.tab.c"
139
141
 
140
142
  /* Enabling traces. */
141
143
  #ifndef YYDEBUG
@@ -167,32 +169,32 @@ void yyerror(const char *msg)
167
169
  ITALIC_START = 260,
168
170
  BOLD_ITALIC_START = 261,
169
171
  ITALIC_BOLD_START = 262,
170
- T_WORD = 263,
171
- TICKET_LINK = 264,
172
- LINK = 265,
173
- SVN_REVISION_LINK = 266,
174
- GIT_REVISION_LINK = 267,
175
- WIKI_LINK = 268,
176
- ANCHOR_LINK = 269,
177
- SVN_N_REVISION_LINK = 270,
178
- GIT_N_REVISION_LINK = 271,
179
- URL_WITH_PROTO_LINK = 272,
180
- URL_WITHOUT_PROTO_LINK = 273,
181
- FILE_LINK = 274,
182
- IMAGE_LINK = 275,
183
- URL = 276,
184
- EMAIL = 277,
185
- UL = 278,
186
- H1 = 279,
187
- H2 = 280,
188
- H3 = 281,
189
- H4 = 282,
190
- H5 = 283,
191
- INLINE_CODE = 284,
192
- SPACE = 285,
193
- BR = 286,
194
- OLI = 287,
195
- ULI = 288,
172
+ ULI = 263,
173
+ OLI = 264,
174
+ T_WORD = 265,
175
+ TICKET_LINK = 266,
176
+ LINK = 267,
177
+ SVN_REVISION_LINK = 268,
178
+ GIT_REVISION_LINK = 269,
179
+ WIKI_LINK = 270,
180
+ ANCHOR_LINK = 271,
181
+ SVN_N_REVISION_LINK = 272,
182
+ GIT_N_REVISION_LINK = 273,
183
+ URL_WITH_PROTO_LINK = 274,
184
+ URL_WITHOUT_PROTO_LINK = 275,
185
+ FILE_LINK = 276,
186
+ IMAGE_LINK = 277,
187
+ URL = 278,
188
+ EMAIL = 279,
189
+ UL = 280,
190
+ H1 = 281,
191
+ H2 = 282,
192
+ H3 = 283,
193
+ H4 = 284,
194
+ H5 = 285,
195
+ INLINE_CODE = 286,
196
+ SPACE = 287,
197
+ BR = 288,
196
198
  PRE_CODE_START = 289,
197
199
  PRE_CODE_END = 290,
198
200
  PRE_START = 291,
@@ -215,7 +217,7 @@ typedef union YYSTYPE
215
217
  {
216
218
 
217
219
  /* Line 214 of yacc.c */
218
- #line 66 "parser.y"
220
+ #line 68 "parser.y"
219
221
 
220
222
  double dvalue;
221
223
  int ivalue;
@@ -224,7 +226,7 @@ typedef union YYSTYPE
224
226
 
225
227
 
226
228
  /* Line 214 of yacc.c */
227
- #line 228 "parser.tab.c"
229
+ #line 230 "parser.tab.c"
228
230
  } YYSTYPE;
229
231
  # define YYSTYPE_IS_TRIVIAL 1
230
232
  # define yystype YYSTYPE /* obsolescent; will be withdrawn */
@@ -236,7 +238,7 @@ typedef union YYSTYPE
236
238
 
237
239
 
238
240
  /* Line 264 of yacc.c */
239
- #line 240 "parser.tab.c"
241
+ #line 242 "parser.tab.c"
240
242
 
241
243
  #ifdef short
242
244
  # undef short
@@ -451,7 +453,7 @@ union yyalloc
451
453
  /* YYFINAL -- State number of the termination state. */
452
454
  #define YYFINAL 55
453
455
  /* YYLAST -- Last index in YYTABLE. */
454
- #define YYLAST 134
456
+ #define YYLAST 131
455
457
 
456
458
  /* YYNTOKENS -- Number of terminals. */
457
459
  #define YYNTOKENS 46
@@ -527,16 +529,16 @@ static const yytype_int8 yyrhs[] =
527
529
  -1, 62, -1, 63, -1, 64, -1, 65, -1, 66,
528
530
  -1, -1, -1, 49, 53, 50, 48, -1, -1, -1,
529
531
  51, 55, 52, 48, -1, 70, -1, 54, -1, 53,
530
- 54, -1, 68, 57, -1, 68, 57, 31, -1, 56,
531
- -1, 55, 56, -1, 67, 57, -1, 67, 57, 31,
532
+ 54, -1, 68, 57, -1, 68, 57, 33, -1, 56,
533
+ -1, 55, 56, -1, 67, 57, -1, 67, 57, 33,
532
534
  -1, 58, -1, 58, 57, -1, 60, -1, 59, -1,
533
- 8, -1, 21, -1, 22, -1, 4, -1, 42, -1,
534
- 5, -1, 43, -1, 6, -1, 7, -1, 29, -1,
535
- 44, -1, 45, -1, 9, -1, 11, -1, 12, -1,
536
- 15, -1, 16, -1, 17, -1, 18, -1, 13, -1,
537
- 14, -1, 19, -1, 20, -1, -1, 61, 60, -1,
538
- 3, -1, 24, -1, 25, -1, 26, -1, 27, -1,
539
- 28, -1, 32, -1, 33, -1, 31, -1, -1, 34,
535
+ 10, -1, 23, -1, 24, -1, 4, -1, 42, -1,
536
+ 5, -1, 43, -1, 6, -1, 7, -1, 31, -1,
537
+ 44, -1, 45, -1, 11, -1, 13, -1, 14, -1,
538
+ 17, -1, 18, -1, 19, -1, 20, -1, 15, -1,
539
+ 16, -1, 21, -1, 22, -1, -1, 61, 60, -1,
540
+ 3, -1, 26, -1, 27, -1, 28, -1, 29, -1,
541
+ 30, -1, 9, -1, 8, -1, 33, -1, -1, 34,
540
542
  71, 60, 35, -1, 40, 60, 41, -1, -1, 36,
541
543
  72, 60, 37, -1, -1, 38, 73, 60, 39, -1
542
544
  };
@@ -544,14 +546,14 @@ static const yytype_int8 yyrhs[] =
544
546
  /* YYRLINE[YYN] -- source line where rule number YYN was defined. */
545
547
  static const yytype_uint8 yyrline[] =
546
548
  {
547
- 0, 93, 93, 94, 97, 98, 99, 100, 101, 102,
548
- 103, 104, 104, 104, 105, 105, 105, 106, 108, 109,
549
- 111, 112, 114, 115, 117, 118, 120, 121, 123, 124,
550
- 125, 126, 127, 128, 129, 130, 131, 132, 133, 134,
551
- 135, 136, 138, 139, 140, 141, 142, 143, 144, 145,
552
- 146, 147, 148, 150, 151, 153, 160, 161, 162, 163,
553
- 164, 166, 167, 168, 171, 171, 172, 173, 173, 174,
554
- 174
549
+ 0, 96, 96, 97, 100, 101, 102, 103, 104, 105,
550
+ 106, 107, 110, 107, 114, 117, 114, 121, 123, 124,
551
+ 126, 127, 129, 130, 132, 133, 135, 136, 138, 139,
552
+ 140, 141, 142, 143, 144, 145, 146, 147, 148, 149,
553
+ 150, 151, 153, 154, 155, 156, 157, 158, 159, 160,
554
+ 161, 162, 163, 165, 166, 168, 175, 176, 177, 178,
555
+ 179, 181, 182, 183, 186, 186, 187, 188, 188, 189,
556
+ 189
555
557
  };
556
558
  #endif
557
559
 
@@ -561,18 +563,18 @@ static const yytype_uint8 yyrline[] =
561
563
  static const char *const yytname[] =
562
564
  {
563
565
  "$end", "error", "$undefined", "T_CHAR", "BOLD_START", "ITALIC_START",
564
- "BOLD_ITALIC_START", "ITALIC_BOLD_START", "T_WORD", "TICKET_LINK",
565
- "LINK", "SVN_REVISION_LINK", "GIT_REVISION_LINK", "WIKI_LINK",
566
- "ANCHOR_LINK", "SVN_N_REVISION_LINK", "GIT_N_REVISION_LINK",
566
+ "BOLD_ITALIC_START", "ITALIC_BOLD_START", "ULI", "OLI", "T_WORD",
567
+ "TICKET_LINK", "LINK", "SVN_REVISION_LINK", "GIT_REVISION_LINK",
568
+ "WIKI_LINK", "ANCHOR_LINK", "SVN_N_REVISION_LINK", "GIT_N_REVISION_LINK",
567
569
  "URL_WITH_PROTO_LINK", "URL_WITHOUT_PROTO_LINK", "FILE_LINK",
568
570
  "IMAGE_LINK", "URL", "EMAIL", "UL", "H1", "H2", "H3", "H4", "H5",
569
- "INLINE_CODE", "SPACE", "BR", "OLI", "ULI", "PRE_CODE_START",
570
- "PRE_CODE_END", "PRE_START", "PRE_END", "CODE_START", "CODE_END",
571
- "NOTEXTILE_START", "NOTEXTILE_END", "BOLD_END", "ITALIC_END",
572
- "REVERT_BOLD", "REVERT_ITALIC", "$accept", "text", "textitem", "$@1",
573
- "$@2", "$@3", "$@4", "ulist", "ulitem", "olist", "olitem", "words",
574
- "word", "link", "chars", "char", "h1", "h2", "h3", "h4", "h5", "oli",
575
- "uli", "br", "code", "$@5", "$@6", "$@7", 0
571
+ "INLINE_CODE", "SPACE", "BR", "PRE_CODE_START", "PRE_CODE_END",
572
+ "PRE_START", "PRE_END", "CODE_START", "CODE_END", "NOTEXTILE_START",
573
+ "NOTEXTILE_END", "BOLD_END", "ITALIC_END", "REVERT_BOLD",
574
+ "REVERT_ITALIC", "$accept", "text", "textitem", "$@1", "$@2", "$@3",
575
+ "$@4", "ulist", "ulitem", "olist", "olitem", "words", "word", "link",
576
+ "chars", "char", "h1", "h2", "h3", "h4", "h5", "oli", "uli", "br",
577
+ "code", "$@5", "$@6", "$@7", 0
576
578
  };
577
579
  #endif
578
580
 
@@ -641,26 +643,26 @@ static const yytype_int8 yydefgoto[] =
641
643
 
642
644
  /* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
643
645
  STATE-NUM. */
644
- #define YYPACT_NINF -42
646
+ #define YYPACT_NINF -40
645
647
  static const yytype_int8 yypact[] =
646
648
  {
647
- 43, -42, -42, -42, -42, -42, -42, -42, -42, -42,
648
- -42, -42, -42, -42, -42, -42, -42, -42, -42, -42,
649
- -42, -42, -42, -42, -42, -42, -42, -42, -42, -42,
650
- -2, -42, -42, -42, -42, 2, 43, -23, -9, -42,
651
- 86, -42, -42, -2, -42, -42, -42, -42, -42, -42,
652
- -42, -2, -2, -2, -6, -42, -42, -42, -23, -42,
653
- 86, -42, -9, -42, 86, -42, -42, 4, 16, 27,
654
- -42, 0, -42, 6, 0, -42, 10, -42, -42, -42,
655
- -42, -42, -42, -42
649
+ 43, -40, -40, -40, -40, -40, -40, -40, -40, -40,
650
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
651
+ -40, -40, -40, -40, -40, -40, -40, -40, -40, -40,
652
+ -2, -40, -40, -40, -40, 2, 43, 4, -1, -40,
653
+ 86, -40, -40, -2, -40, -40, -40, -40, -40, -40,
654
+ -40, -2, -2, -2, -16, -40, -40, -40, 4, -40,
655
+ 86, -40, -1, -40, 86, -40, -40, 6, 18, 29,
656
+ -40, 0, -40, 42, 0, -40, 45, -40, -40, -40,
657
+ -40, -40, -40, -40
656
658
  };
657
659
 
658
660
  /* YYPGOTO[NTERM-NUM]. */
659
661
  static const yytype_int8 yypgoto[] =
660
662
  {
661
- -42, 37, -41, -42, -42, -42, -42, -42, 20, -42,
662
- 18, 56, -42, -42, 81, -42, -42, -42, -42, -42,
663
- -42, -42, -42, -42, -42, -42, -42, -42
663
+ -40, 1, -39, -40, -40, -40, -40, -40, -19, -40,
664
+ 20, 54, -40, -40, 68, -40, -40, -40, -40, -40,
665
+ -40, -40, -40, -40, -40, -40, -40, -40
664
666
  };
665
667
 
666
668
  /* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
@@ -670,53 +672,53 @@ static const yytype_int8 yypgoto[] =
670
672
  #define YYTABLE_NINF -54
671
673
  static const yytype_int8 yytable[] =
672
674
  {
673
- -53, 1, 55, 1, 2, 3, 4, 5, 6, 7,
674
- 57, 8, 9, 10, 11, 12, 13, 14, 15, 16,
675
- 17, 18, 19, 61, 20, 21, 22, 23, 24, 25,
676
- 80, 26, -14, 82, 27, 70, 28, 81, 29, 77,
677
- 30, 83, 31, 32, 33, 34, 1, 2, 3, 4,
678
- 5, 6, 7, 78, 8, 9, 10, 11, 12, 13,
679
- 14, 15, 16, 17, 18, 19, 79, 20, 21, 22,
680
- 23, 24, 25, 56, 26, -14, -11, 27, 72, 28,
681
- 75, 29, 0, 30, 0, 31, 32, 33, 34, 1,
682
- 2, 3, 4, 5, 6, 7, 65, 8, 9, 10,
683
- 11, 12, 13, 14, 15, 16, 17, 18, 19, 0,
684
- 0, 54, 0, 0, 0, 25, 73, 0, 0, 0,
685
- 76, 0, 0, 0, 66, 0, 0, 0, 31, 32,
686
- 33, 34, 67, 68, 69
675
+ -53, 1, 55, 1, 2, 3, 4, 5, 61, -14,
676
+ 6, 7, 57, 8, 9, 10, 11, 12, 13, 14,
677
+ 15, 16, 17, 18, 19, 70, 20, 21, 22, 23,
678
+ 24, 25, 80, 26, 27, 82, 28, 56, 29, 72,
679
+ 30, 77, 31, 32, 33, 34, 1, 2, 3, 4,
680
+ 5, -11, -14, 6, 7, 78, 8, 9, 10, 11,
681
+ 12, 13, 14, 15, 16, 17, 18, 19, 79, 20,
682
+ 21, 22, 23, 24, 25, 81, 26, 27, 83, 28,
683
+ 0, 29, 75, 30, 0, 31, 32, 33, 34, 1,
684
+ 2, 3, 4, 5, 65, 0, 6, 7, 54, 8,
685
+ 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
686
+ 19, 66, 0, 0, 73, 0, 0, 25, 76, 67,
687
+ 68, 69, 0, 0, 0, 0, 0, 0, 31, 32,
688
+ 33, 34
687
689
  };
688
690
 
689
691
  static const yytype_int8 yycheck[] =
690
692
  {
691
- 0, 3, 0, 3, 4, 5, 6, 7, 8, 9,
692
- 33, 11, 12, 13, 14, 15, 16, 17, 18, 19,
693
- 20, 21, 22, 32, 24, 25, 26, 27, 28, 29,
694
- 71, 31, 32, 74, 34, 41, 36, 31, 38, 35,
695
- 40, 31, 42, 43, 44, 45, 3, 4, 5, 6,
696
- 7, 8, 9, 37, 11, 12, 13, 14, 15, 16,
697
- 17, 18, 19, 20, 21, 22, 39, 24, 25, 26,
698
- 27, 28, 29, 36, 31, 32, 33, 34, 58, 36,
699
- 62, 38, -1, 40, -1, 42, 43, 44, 45, 3,
700
- 4, 5, 6, 7, 8, 9, 40, 11, 12, 13,
701
- 14, 15, 16, 17, 18, 19, 20, 21, 22, -1,
702
- -1, 30, -1, -1, -1, 29, 60, -1, -1, -1,
703
- 64, -1, -1, -1, 43, -1, -1, -1, 42, 43,
704
- 44, 45, 51, 52, 53
693
+ 0, 3, 0, 3, 4, 5, 6, 7, 9, 9,
694
+ 10, 11, 8, 13, 14, 15, 16, 17, 18, 19,
695
+ 20, 21, 22, 23, 24, 41, 26, 27, 28, 29,
696
+ 30, 31, 71, 33, 34, 74, 36, 36, 38, 58,
697
+ 40, 35, 42, 43, 44, 45, 3, 4, 5, 6,
698
+ 7, 8, 9, 10, 11, 37, 13, 14, 15, 16,
699
+ 17, 18, 19, 20, 21, 22, 23, 24, 39, 26,
700
+ 27, 28, 29, 30, 31, 33, 33, 34, 33, 36,
701
+ -1, 38, 62, 40, -1, 42, 43, 44, 45, 3,
702
+ 4, 5, 6, 7, 40, -1, 10, 11, 30, 13,
703
+ 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
704
+ 24, 43, -1, -1, 60, -1, -1, 31, 64, 51,
705
+ 52, 53, -1, -1, -1, -1, -1, -1, 42, 43,
706
+ 44, 45
705
707
  };
706
708
 
707
709
  /* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
708
710
  symbol of state STATE-NUM. */
709
711
  static const yytype_uint8 yystos[] =
710
712
  {
711
- 0, 3, 4, 5, 6, 7, 8, 9, 11, 12,
712
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 22,
713
- 24, 25, 26, 27, 28, 29, 31, 34, 36, 38,
713
+ 0, 3, 4, 5, 6, 7, 10, 11, 13, 14,
714
+ 15, 16, 17, 18, 19, 20, 21, 22, 23, 24,
715
+ 26, 27, 28, 29, 30, 31, 33, 34, 36, 38,
714
716
  40, 42, 43, 44, 45, 47, 48, 49, 51, 57,
715
717
  58, 59, 60, 61, 62, 63, 64, 65, 66, 69,
716
- 70, 71, 72, 73, 60, 0, 47, 33, 53, 54,
717
- 68, 32, 55, 56, 67, 57, 60, 60, 60, 60,
718
+ 70, 71, 72, 73, 60, 0, 47, 8, 53, 54,
719
+ 68, 9, 55, 56, 67, 57, 60, 60, 60, 60,
718
720
  41, 50, 54, 57, 52, 56, 57, 35, 37, 39,
719
- 48, 31, 48, 31
721
+ 48, 33, 48, 33
720
722
  };
721
723
 
722
724
  #define yyerrok (yyerrstatus = 0)
@@ -1530,364 +1532,376 @@ yyreduce:
1530
1532
  case 6:
1531
1533
 
1532
1534
  /* Line 1455 of yacc.c */
1533
- #line 99 "parser.y"
1535
+ #line 102 "parser.y"
1534
1536
  {concat("</h1>",5);}
1535
1537
  break;
1536
1538
 
1537
1539
  case 7:
1538
1540
 
1539
1541
  /* Line 1455 of yacc.c */
1540
- #line 100 "parser.y"
1542
+ #line 103 "parser.y"
1541
1543
  {concat("</h2>",5);}
1542
1544
  break;
1543
1545
 
1544
1546
  case 8:
1545
1547
 
1546
1548
  /* Line 1455 of yacc.c */
1547
- #line 101 "parser.y"
1549
+ #line 104 "parser.y"
1548
1550
  {concat("</h3>",5);}
1549
1551
  break;
1550
1552
 
1551
1553
  case 9:
1552
1554
 
1553
1555
  /* Line 1455 of yacc.c */
1554
- #line 102 "parser.y"
1556
+ #line 105 "parser.y"
1555
1557
  {concat("</h4>",5);}
1556
1558
  break;
1557
1559
 
1558
1560
  case 10:
1559
1561
 
1560
1562
  /* Line 1455 of yacc.c */
1561
- #line 103 "parser.y"
1563
+ #line 106 "parser.y"
1562
1564
  {concat("</h5>",5);}
1563
1565
  break;
1564
1566
 
1565
1567
  case 11:
1566
1568
 
1567
1569
  /* Line 1455 of yacc.c */
1568
- #line 104 "parser.y"
1569
- {concat("<ul>",4);}
1570
+ #line 107 "parser.y"
1571
+ {
1572
+ list_level=1;
1573
+ concat("<ul>",4)
1574
+ ;}
1570
1575
  break;
1571
1576
 
1572
1577
  case 12:
1573
1578
 
1574
1579
  /* Line 1455 of yacc.c */
1575
- #line 104 "parser.y"
1576
- {concat("</ul>",5);}
1580
+ #line 110 "parser.y"
1581
+ {
1582
+ concat("</ul>",5);
1583
+ for(; list_level>1 && list_level<4; list_level--) concat("</li></ul>",10);
1584
+ ;}
1577
1585
  break;
1578
1586
 
1579
1587
  case 14:
1580
1588
 
1581
1589
  /* Line 1455 of yacc.c */
1582
- #line 105 "parser.y"
1583
- {concat("<ol>",4);}
1590
+ #line 114 "parser.y"
1591
+ {
1592
+ list_level=1;
1593
+ concat("<ol>",4)
1594
+ ;}
1584
1595
  break;
1585
1596
 
1586
1597
  case 15:
1587
1598
 
1588
1599
  /* Line 1455 of yacc.c */
1589
- #line 105 "parser.y"
1590
- {concat("</ol>",5);}
1600
+ #line 117 "parser.y"
1601
+ {
1602
+ concat("</ol>",5);
1603
+ for(; list_level>1 && list_level<4; list_level--) concat("</li></ol>",10);
1604
+ ;}
1591
1605
  break;
1592
1606
 
1593
1607
  case 18:
1594
1608
 
1595
1609
  /* Line 1455 of yacc.c */
1596
- #line 108 "parser.y"
1610
+ #line 123 "parser.y"
1597
1611
  {concat("</li>",5);}
1598
1612
  break;
1599
1613
 
1600
1614
  case 19:
1601
1615
 
1602
1616
  /* Line 1455 of yacc.c */
1603
- #line 109 "parser.y"
1617
+ #line 124 "parser.y"
1604
1618
  {concat("</li>",5);}
1605
1619
  break;
1606
1620
 
1607
1621
  case 22:
1608
1622
 
1609
1623
  /* Line 1455 of yacc.c */
1610
- #line 114 "parser.y"
1624
+ #line 129 "parser.y"
1611
1625
  {concat("</li>",5);}
1612
1626
  break;
1613
1627
 
1614
1628
  case 23:
1615
1629
 
1616
1630
  /* Line 1455 of yacc.c */
1617
- #line 115 "parser.y"
1631
+ #line 130 "parser.y"
1618
1632
  {concat("</li>",5);}
1619
1633
  break;
1620
1634
 
1621
1635
  case 30:
1622
1636
 
1623
1637
  /* Line 1455 of yacc.c */
1624
- #line 125 "parser.y"
1638
+ #line 140 "parser.y"
1625
1639
  {concat2((yyvsp[(1) - (1)].svalue));}
1626
1640
  break;
1627
1641
 
1628
1642
  case 31:
1629
1643
 
1630
1644
  /* Line 1455 of yacc.c */
1631
- #line 126 "parser.y"
1645
+ #line 141 "parser.y"
1632
1646
  {process_url((yyvsp[(1) - (1)].svalue));}
1633
1647
  break;
1634
1648
 
1635
1649
  case 32:
1636
1650
 
1637
1651
  /* Line 1455 of yacc.c */
1638
- #line 127 "parser.y"
1652
+ #line 142 "parser.y"
1639
1653
  {process_email((yyvsp[(1) - (1)].svalue));}
1640
1654
  break;
1641
1655
 
1642
1656
  case 33:
1643
1657
 
1644
1658
  /* Line 1455 of yacc.c */
1645
- #line 128 "parser.y"
1659
+ #line 143 "parser.y"
1646
1660
  {(yyvsp[(1) - (1)].ivalue) ? concat(" <strong>",9) : concat("<strong>",8);}
1647
1661
  break;
1648
1662
 
1649
1663
  case 34:
1650
1664
 
1651
1665
  /* Line 1455 of yacc.c */
1652
- #line 129 "parser.y"
1666
+ #line 144 "parser.y"
1653
1667
  {concat("</strong>",9);}
1654
1668
  break;
1655
1669
 
1656
1670
  case 35:
1657
1671
 
1658
1672
  /* Line 1455 of yacc.c */
1659
- #line 130 "parser.y"
1673
+ #line 145 "parser.y"
1660
1674
  {(yyvsp[(1) - (1)].ivalue) ? concat(" <em>",5) : concat("<em>",4);}
1661
1675
  break;
1662
1676
 
1663
1677
  case 36:
1664
1678
 
1665
1679
  /* Line 1455 of yacc.c */
1666
- #line 131 "parser.y"
1680
+ #line 146 "parser.y"
1667
1681
  {concat("</em>",5);}
1668
1682
  break;
1669
1683
 
1670
1684
  case 37:
1671
1685
 
1672
1686
  /* Line 1455 of yacc.c */
1673
- #line 132 "parser.y"
1687
+ #line 147 "parser.y"
1674
1688
  {(yyvsp[(1) - (1)].ivalue) ? concat(" <strong><em>",13) : concat("<strong><em>",12);}
1675
1689
  break;
1676
1690
 
1677
1691
  case 38:
1678
1692
 
1679
1693
  /* Line 1455 of yacc.c */
1680
- #line 133 "parser.y"
1694
+ #line 148 "parser.y"
1681
1695
  {(yyvsp[(1) - (1)].ivalue) ? concat(" <em><strong>",13) : concat("<em><strong>",12);}
1682
1696
  break;
1683
1697
 
1684
1698
  case 39:
1685
1699
 
1686
1700
  /* Line 1455 of yacc.c */
1687
- #line 134 "parser.y"
1701
+ #line 149 "parser.y"
1688
1702
  {process_inline_code((yyvsp[(1) - (1)].svalue));}
1689
1703
  break;
1690
1704
 
1691
1705
  case 40:
1692
1706
 
1693
1707
  /* Line 1455 of yacc.c */
1694
- #line 135 "parser.y"
1708
+ #line 150 "parser.y"
1695
1709
  {revert_bold();}
1696
1710
  break;
1697
1711
 
1698
1712
  case 41:
1699
1713
 
1700
1714
  /* Line 1455 of yacc.c */
1701
- #line 136 "parser.y"
1715
+ #line 151 "parser.y"
1702
1716
  {revert_italic();}
1703
1717
  break;
1704
1718
 
1705
1719
  case 42:
1706
1720
 
1707
1721
  /* Line 1455 of yacc.c */
1708
- #line 138 "parser.y"
1722
+ #line 153 "parser.y"
1709
1723
  {process_ticket_link((yyvsp[(1) - (1)].svalue));}
1710
1724
  break;
1711
1725
 
1712
1726
  case 43:
1713
1727
 
1714
1728
  /* Line 1455 of yacc.c */
1715
- #line 139 "parser.y"
1729
+ #line 154 "parser.y"
1716
1730
  {process_svn_link((yyvsp[(1) - (1)].svalue),0);}
1717
1731
  break;
1718
1732
 
1719
1733
  case 44:
1720
1734
 
1721
1735
  /* Line 1455 of yacc.c */
1722
- #line 140 "parser.y"
1736
+ #line 155 "parser.y"
1723
1737
  {process_git_link((yyvsp[(1) - (1)].svalue),0);}
1724
1738
  break;
1725
1739
 
1726
1740
  case 45:
1727
1741
 
1728
1742
  /* Line 1455 of yacc.c */
1729
- #line 141 "parser.y"
1743
+ #line 156 "parser.y"
1730
1744
  {process_svn_link((yyvsp[(1) - (1)].svalue),1);}
1731
1745
  break;
1732
1746
 
1733
1747
  case 46:
1734
1748
 
1735
1749
  /* Line 1455 of yacc.c */
1736
- #line 142 "parser.y"
1750
+ #line 157 "parser.y"
1737
1751
  {process_git_link((yyvsp[(1) - (1)].svalue),1);}
1738
1752
  break;
1739
1753
 
1740
1754
  case 47:
1741
1755
 
1742
1756
  /* Line 1455 of yacc.c */
1743
- #line 143 "parser.y"
1757
+ #line 158 "parser.y"
1744
1758
  {process_url_link((yyvsp[(1) - (1)].svalue),NULL);}
1745
1759
  break;
1746
1760
 
1747
1761
  case 48:
1748
1762
 
1749
1763
  /* Line 1455 of yacc.c */
1750
- #line 144 "parser.y"
1764
+ #line 159 "parser.y"
1751
1765
  {process_url_link((yyvsp[(1) - (1)].svalue),"http://");}
1752
1766
  break;
1753
1767
 
1754
1768
  case 49:
1755
1769
 
1756
1770
  /* Line 1455 of yacc.c */
1757
- #line 145 "parser.y"
1771
+ #line 160 "parser.y"
1758
1772
  {process_wiki_link((yyvsp[(1) - (1)].svalue));}
1759
1773
  break;
1760
1774
 
1761
1775
  case 50:
1762
1776
 
1763
1777
  /* Line 1455 of yacc.c */
1764
- #line 146 "parser.y"
1778
+ #line 161 "parser.y"
1765
1779
  {process_anchor_link((yyvsp[(1) - (1)].svalue));}
1766
1780
  break;
1767
1781
 
1768
1782
  case 51:
1769
1783
 
1770
1784
  /* Line 1455 of yacc.c */
1771
- #line 147 "parser.y"
1785
+ #line 162 "parser.y"
1772
1786
  {process_file_link((yyvsp[(1) - (1)].svalue));}
1773
1787
  break;
1774
1788
 
1775
1789
  case 52:
1776
1790
 
1777
1791
  /* Line 1455 of yacc.c */
1778
- #line 148 "parser.y"
1792
+ #line 163 "parser.y"
1779
1793
  {process_image_link((yyvsp[(1) - (1)].svalue));}
1780
1794
  break;
1781
1795
 
1782
1796
  case 55:
1783
1797
 
1784
1798
  /* Line 1455 of yacc.c */
1785
- #line 153 "parser.y"
1799
+ #line 168 "parser.y"
1786
1800
  {concat_escaped_char((yyvsp[(1) - (1)].ivalue));}
1787
1801
  break;
1788
1802
 
1789
1803
  case 56:
1790
1804
 
1791
1805
  /* Line 1455 of yacc.c */
1792
- #line 160 "parser.y"
1793
- {concat("<h1 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1806
+ #line 175 "parser.y"
1807
+ {concat("<h1 id=\"h-",10); process_header((yyvsp[(1) - (1)].svalue));}
1794
1808
  break;
1795
1809
 
1796
1810
  case 57:
1797
1811
 
1798
1812
  /* Line 1455 of yacc.c */
1799
- #line 161 "parser.y"
1800
- {concat("<h2 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1813
+ #line 176 "parser.y"
1814
+ {concat("<h2 id=\"h-",10); process_header((yyvsp[(1) - (1)].svalue));}
1801
1815
  break;
1802
1816
 
1803
1817
  case 58:
1804
1818
 
1805
1819
  /* Line 1455 of yacc.c */
1806
- #line 162 "parser.y"
1807
- {concat("<h3 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1820
+ #line 177 "parser.y"
1821
+ {concat("<h3 id=\"h-",10); process_header((yyvsp[(1) - (1)].svalue));}
1808
1822
  break;
1809
1823
 
1810
1824
  case 59:
1811
1825
 
1812
1826
  /* Line 1455 of yacc.c */
1813
- #line 163 "parser.y"
1814
- {concat("<h4 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1827
+ #line 178 "parser.y"
1828
+ {concat("<h4 id=\"h-",10); process_header((yyvsp[(1) - (1)].svalue));}
1815
1829
  break;
1816
1830
 
1817
1831
  case 60:
1818
1832
 
1819
1833
  /* Line 1455 of yacc.c */
1820
- #line 164 "parser.y"
1821
- {concat("<h5 id=\"",8); process_header((yyvsp[(1) - (1)].svalue));}
1834
+ #line 179 "parser.y"
1835
+ {concat("<h5 id=\"h-",10); process_header((yyvsp[(1) - (1)].svalue));}
1822
1836
  break;
1823
1837
 
1824
1838
  case 61:
1825
1839
 
1826
1840
  /* Line 1455 of yacc.c */
1827
- #line 166 "parser.y"
1828
- {concat("<li>",4);}
1841
+ #line 181 "parser.y"
1842
+ {process_oli((yyvsp[(1) - (1)].ivalue));}
1829
1843
  break;
1830
1844
 
1831
1845
  case 62:
1832
1846
 
1833
1847
  /* Line 1455 of yacc.c */
1834
- #line 167 "parser.y"
1835
- {concat("<li>",4);}
1848
+ #line 182 "parser.y"
1849
+ {process_uli((yyvsp[(1) - (1)].ivalue));}
1836
1850
  break;
1837
1851
 
1838
1852
  case 63:
1839
1853
 
1840
1854
  /* Line 1455 of yacc.c */
1841
- #line 168 "parser.y"
1855
+ #line 183 "parser.y"
1842
1856
  {concat("<br />",6);}
1843
1857
  break;
1844
1858
 
1845
1859
  case 64:
1846
1860
 
1847
1861
  /* Line 1455 of yacc.c */
1848
- #line 171 "parser.y"
1862
+ #line 186 "parser.y"
1849
1863
  {concat("<pre><code>",11);}
1850
1864
  break;
1851
1865
 
1852
1866
  case 65:
1853
1867
 
1854
1868
  /* Line 1455 of yacc.c */
1855
- #line 171 "parser.y"
1869
+ #line 186 "parser.y"
1856
1870
  {concat("</code></pre>",13);}
1857
1871
  break;
1858
1872
 
1859
1873
  case 67:
1860
1874
 
1861
1875
  /* Line 1455 of yacc.c */
1862
- #line 173 "parser.y"
1876
+ #line 188 "parser.y"
1863
1877
  {concat("<pre>",5);}
1864
1878
  break;
1865
1879
 
1866
1880
  case 68:
1867
1881
 
1868
1882
  /* Line 1455 of yacc.c */
1869
- #line 173 "parser.y"
1883
+ #line 188 "parser.y"
1870
1884
  {concat("</pre>",6);}
1871
1885
  break;
1872
1886
 
1873
1887
  case 69:
1874
1888
 
1875
1889
  /* Line 1455 of yacc.c */
1876
- #line 174 "parser.y"
1890
+ #line 189 "parser.y"
1877
1891
  {concat("<code>",6);}
1878
1892
  break;
1879
1893
 
1880
1894
  case 70:
1881
1895
 
1882
1896
  /* Line 1455 of yacc.c */
1883
- #line 174 "parser.y"
1897
+ #line 189 "parser.y"
1884
1898
  {concat("</code>",7);}
1885
1899
  break;
1886
1900
 
1887
1901
 
1888
1902
 
1889
1903
  /* Line 1455 of yacc.c */
1890
- #line 1891 "parser.tab.c"
1904
+ #line 1905 "parser.tab.c"
1891
1905
  default: break;
1892
1906
  }
1893
1907
  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
@@ -2099,8 +2113,38 @@ yyreturn:
2099
2113
 
2100
2114
 
2101
2115
  /* Line 1675 of yacc.c */
2102
- #line 178 "parser.y"
2116
+ #line 193 "parser.y"
2117
+
2118
+
2119
+ process_uli(int level){
2120
+ if( level == list_level ){
2121
+ concat("<li>",4);
2122
+ } else if( level < list_level ){
2123
+ list_level = level;
2124
+ //unconcat("</li>");
2125
+ concat("</ul></li><li>",14);
2126
+ } else {
2127
+ // if(level > list_level)
2128
+ list_level = level;
2129
+ unconcat("</li>");
2130
+ concat("<ul><li>",8);
2131
+ }
2132
+ }
2103
2133
 
2134
+ process_oli(int level){
2135
+ if( level == list_level ){
2136
+ concat("<li>",4);
2137
+ } else if( level < list_level ){
2138
+ list_level = level;
2139
+ //unconcat("</li>");
2140
+ concat("</ol></li><li>",14);
2141
+ } else {
2142
+ // if(level > list_level)
2143
+ list_level = level;
2144
+ unconcat("</li>");
2145
+ concat("<ol><li>",8);
2146
+ }
2147
+ }
2104
2148
 
2105
2149
  concat_hex_char(char c){
2106
2150
  unsigned char d;
@@ -2199,7 +2243,7 @@ process_anchor_link(const char*target){
2199
2243
 
2200
2244
  if((p = strchr(target,'|')) && (p<pend) && (p>target)) pend = p-1;
2201
2245
 
2202
- concat("<a href=\"#",10);
2246
+ concat("<a href=\"#h-",12);
2203
2247
  if( need_hex_convert(target,pend) ){
2204
2248
  for(p = target; *p && p<=pend; p++) concat_hex_char( *p );
2205
2249
  } else {
@@ -2287,7 +2331,16 @@ process_wiki_link(const char*target){
2287
2331
  concat("/wiki/show/",11);
2288
2332
  concat(space_name,space_name_len);
2289
2333
  concat_raw_char('/');
2290
- for(c=target; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2334
+ for(c=target; *c && *c!=']' && *c!='|' && *c!='#'; c++) concat_raw_char(*c);
2335
+ if( *c == '#' ){
2336
+ concat_raw_char('#');
2337
+ //if(memcmp(c, "#h-", 3) != 0){
2338
+ // anchor w/o "h-" prefix, we need to add it
2339
+ concat_raw_char('h');
2340
+ concat_raw_char('-');
2341
+ //}
2342
+ for(c++; *c && *c!=']' && *c!='|'; c++) concat_raw_char(*c);
2343
+ }
2291
2344
  process_link_tail(target,NULL,NULL);
2292
2345
  }
2293
2346
 
@@ -2382,6 +2435,11 @@ process_email(const char*url){
2382
2435
  process_link_tail(url,NULL,NULL);
2383
2436
  }
2384
2437
 
2438
+ unconcat(const char*what){
2439
+ int l = strlen(what);
2440
+ if( bufptr-buf > l && strncmp(bufptr-l,what,l) == 0 ) bufptr -= l;
2441
+ }
2442
+
2385
2443
  revert_bold(){
2386
2444
  char *p;
2387
2445
  for( p=bufptr-1; p >= (buf+7) ; p--){