dtext_rb 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5adfd263d5081964be5f7c9956e7ff900fdef30
4
- data.tar.gz: 031454f386206e77426633bb05ddb79c65a3eba4
3
+ metadata.gz: c80794b326722789beedec3ed0705c3842d6301b
4
+ data.tar.gz: 6262ab8ed168b9eb1025a6ceb507e5fb91c8863b
5
5
  SHA512:
6
- metadata.gz: b38ef1ccc1b888e49bce86e67cd0a31143a442bd95ad13f58f2916a49904cf5341863117090bbe379bd87b04336b627ec6e988eeafedd682ec5e727eef6ae077
7
- data.tar.gz: 69f53b783551b9ac61443d1847ea35ec6160f1d1332ef7a7f1f9602d30900d597c32b03112ca369602da44bd79d1d4bb02dbe05fbfec262cfbf5992b55537e27
6
+ metadata.gz: c5f380a5f0c327a0681eedcb5038dc92da1896c4f019cc142029ad9ea233789e5f962906af15ae11fdd463c0f24d90bf44ef983ebb63b9aa3b63d6b5c4237c92
7
+ data.tar.gz: 71160a7eb9cc7a363463589e9fa7142fd3921617ac78079e7cbaaef882bbc69939c2834faba0fcd7ae5461495fa86c0d117dc950b8985780f8d43c6735809712
data/Rakefile CHANGED
@@ -69,7 +69,7 @@ task test_file_ragel: %w(ragel compile) do
69
69
  end
70
70
 
71
71
  task test: %w(ragel compile) do
72
- ruby "-Ilib", '-rdtext', "test/dtext_test.rb" #, '--name=test_headers'
72
+ ruby "-Ilib", '-rdtext', "test/dtext_test.rb" #, '--name=test_old_style_links_with_inline_tags'
73
73
  end
74
74
 
75
75
  task default: :test
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.0.10
data/dtext_rb.gemspec CHANGED
@@ -2,17 +2,17 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: dtext_rb 1.0.9 ruby lib
5
+ # stub: dtext_rb 1.0.10 ruby lib
6
6
  # stub: ext/dtext/extconf.rb
7
7
 
8
8
  Gem::Specification.new do |s|
9
9
  s.name = "dtext_rb"
10
- s.version = "1.0.9"
10
+ s.version = "1.0.10"
11
11
 
12
12
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
13
13
  s.require_paths = ["lib"]
14
14
  s.authors = ["r888888888"]
15
- s.date = "2016-08-30"
15
+ s.date = "2016-09-02"
16
16
  s.description = "Compield DText parser"
17
17
  s.email = "r888888888@gmail.com"
18
18
  s.extensions = ["ext/dtext/extconf.rb"]
data/ext/dtext/dtext.c CHANGED
@@ -36,6 +36,7 @@ typedef struct StateMachine {
36
36
  int list_nest;
37
37
  int d;
38
38
  int b;
39
+ int quote;
39
40
  } StateMachine;
40
41
 
41
42
  static const size_t MAX_STACK_DEPTH = 512;
@@ -70,11 +71,11 @@ static const int BLOCK_H5 = 27;
70
71
  static const int BLOCK_H6 = 28;
71
72
 
72
73
 
73
- #line 966 "ext/dtext/dtext.rl"
74
+ #line 970 "ext/dtext/dtext.rl"
74
75
 
75
76
 
76
77
 
77
- #line 78 "ext/dtext/dtext.c"
78
+ #line 79 "ext/dtext/dtext.c"
78
79
  static const unsigned char _dtext_to_state_actions[] = {
79
80
  0, 0, 0, 0, 0, 0, 0, 0,
80
81
  0, 0, 0, 0, 0, 0, 0, 0,
@@ -171,7 +172,7 @@ static const int dtext_en_list = 302;
171
172
  static const int dtext_en_main = 245;
172
173
 
173
174
 
174
- #line 969 "ext/dtext/dtext.rl"
175
+ #line 973 "ext/dtext/dtext.rl"
175
176
 
176
177
  static inline void underscore_string(char * str, size_t len) {
177
178
  for (size_t i=0; i<len; ++i) {
@@ -278,7 +279,7 @@ static inline void append_segment_html_escaped(StateMachine * sm, const char * a
278
279
 
279
280
  static inline void append_block(StateMachine * sm, const char * s) {
280
281
  if (sm->f_inline) {
281
- sm->output = g_string_append_c(sm->output, ' ');
282
+ // sm->output = g_string_append_c(sm->output, ' ');
282
283
  } else if (sm->f_strip) {
283
284
  // do nothing
284
285
  } else {
@@ -450,18 +451,18 @@ static bool print_machine(StateMachine * sm) {
450
451
  return true;
451
452
  }
452
453
 
453
- static void init_machine(StateMachine * sm, VALUE input) {
454
+ static void init_machine(StateMachine * sm, const char * src, size_t len) {
454
455
  size_t output_length = 0;
455
- sm->p = RSTRING_PTR(input);
456
+ sm->p = src;
456
457
  sm->pb = sm->p;
457
- sm->pe = sm->p + RSTRING_LEN(input);
458
+ sm->pe = sm->p + len;
458
459
  sm->eof = sm->pe;
459
460
  sm->ts = NULL;
460
461
  sm->te = NULL;
461
462
  sm->cs = 0;
462
463
  sm->act = 0;
463
464
  sm->top = 0;
464
- output_length = RSTRING_LEN(input);
465
+ output_length = len;
465
466
  if (output_length < (INT16_MAX / 2)) {
466
467
  output_length *= 2;
467
468
  }
@@ -479,6 +480,7 @@ static void init_machine(StateMachine * sm, VALUE input) {
479
480
  sm->header_mode = false;
480
481
  sm->d = 0;
481
482
  sm->b = 0;
483
+ sm->quote = 0;
482
484
  }
483
485
 
484
486
  static void free_machine(StateMachine * sm) {
@@ -488,52 +490,17 @@ static void free_machine(StateMachine * sm) {
488
490
  g_free(sm);
489
491
  }
490
492
 
491
- static VALUE parse(int argc, VALUE * argv, VALUE self) {
492
- VALUE input;
493
- VALUE input0;
494
- VALUE options;
495
- VALUE opt_inline;
496
- VALUE opt_strip;
497
- VALUE ret;
498
- rb_encoding * encoding = NULL;
493
+ static StateMachine * parse_helper(const char * src, size_t len, bool f_strip, bool f_inline) {
499
494
  StateMachine * sm = NULL;
495
+ StateMachine * link_content_sm = NULL;
500
496
 
501
- g_debug("start\n");
502
-
503
- if (argc == 0) {
504
- rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
505
- }
506
-
507
- input = argv[0];
508
-
509
- if (NIL_P(input)) {
510
- return Qnil;
511
- }
512
-
513
- input0 = rb_str_dup(input);
514
-
515
497
  sm = (StateMachine *)g_malloc0(sizeof(StateMachine));
516
- input0 = rb_str_cat(input0, "\0", 1);
517
- init_machine(sm, input0);
518
-
519
- if (argc > 1) {
520
- options = argv[1];
521
-
522
- if (!NIL_P(options)) {
523
- opt_strip = rb_hash_aref(options, ID2SYM(rb_intern("strip")));
524
- if (RTEST(opt_strip)) {
525
- sm->f_strip = true;
526
- }
527
-
528
- opt_inline = rb_hash_aref(options, ID2SYM(rb_intern("inline")));
529
- if (RTEST(opt_inline)) {
530
- sm->f_inline = true;
531
- }
532
- }
533
- }
498
+ init_machine(sm, src, len);
499
+ sm->f_strip = f_strip;
500
+ sm->f_inline = f_inline;
534
501
 
535
502
 
536
- #line 537 "ext/dtext/dtext.c"
503
+ #line 504 "ext/dtext/dtext.c"
537
504
  {
538
505
  sm->cs = dtext_start;
539
506
  ( sm->top) = 0;
@@ -542,9 +509,9 @@ static VALUE parse(int argc, VALUE * argv, VALUE self) {
542
509
  ( sm->act) = 0;
543
510
  }
544
511
 
545
- #line 1330 "ext/dtext/dtext.rl"
512
+ #line 1300 "ext/dtext/dtext.rl"
546
513
 
547
- #line 548 "ext/dtext/dtext.c"
514
+ #line 515 "ext/dtext/dtext.c"
548
515
  {
549
516
  if ( ( sm->p) == ( sm->pe) )
550
517
  goto _test_eof;
@@ -554,7 +521,7 @@ _resume:
554
521
  #line 1 "NONE"
555
522
  {( sm->ts) = ( sm->p);}
556
523
  break;
557
- #line 558 "ext/dtext/dtext.c"
524
+ #line 525 "ext/dtext/dtext.c"
558
525
  }
559
526
 
560
527
  switch ( sm->cs ) {
@@ -2711,25 +2678,25 @@ case 244:
2711
2678
  tr289: sm->cs = 307; goto f3;
2712
2679
 
2713
2680
  f6:
2714
- #line 96 "ext/dtext/dtext.rl"
2681
+ #line 97 "ext/dtext/dtext.rl"
2715
2682
  {
2716
2683
  sm->a1 = sm->p;
2717
2684
  }
2718
2685
  goto _again;
2719
2686
  f4:
2720
- #line 100 "ext/dtext/dtext.rl"
2687
+ #line 101 "ext/dtext/dtext.rl"
2721
2688
  {
2722
2689
  sm->a2 = sm->p;
2723
2690
  }
2724
2691
  goto _again;
2725
2692
  f3:
2726
- #line 104 "ext/dtext/dtext.rl"
2693
+ #line 105 "ext/dtext/dtext.rl"
2727
2694
  {
2728
2695
  sm->b1 = sm->p;
2729
2696
  }
2730
2697
  goto _again;
2731
2698
  f36:
2732
- #line 108 "ext/dtext/dtext.rl"
2699
+ #line 109 "ext/dtext/dtext.rl"
2733
2700
  {
2734
2701
  sm->b2 = sm->p;
2735
2702
  }
@@ -2739,7 +2706,7 @@ f61:
2739
2706
  {( sm->te) = ( sm->p)+1;}
2740
2707
  goto _again;
2741
2708
  f38:
2742
- #line 259 "ext/dtext/dtext.rl"
2709
+ #line 260 "ext/dtext/dtext.rl"
2743
2710
  {( sm->te) = ( sm->p)+1;{
2744
2711
  append(sm, true, "<a rel=\"nofollow\" href=\"/posts?tags=");
2745
2712
  append_segment_uri_escaped(sm, sm->a1, sm->a2 - 1);
@@ -2749,7 +2716,7 @@ f38:
2749
2716
  }}
2750
2717
  goto _again;
2751
2718
  f35:
2752
- #line 267 "ext/dtext/dtext.rl"
2719
+ #line 268 "ext/dtext/dtext.rl"
2753
2720
  {( sm->te) = ( sm->p)+1;{
2754
2721
  GString * segment = g_string_new_len(sm->a1, sm->a2 - sm->a1);
2755
2722
  GString * lowercase_segment = NULL;
@@ -2772,7 +2739,7 @@ f35:
2772
2739
  }}
2773
2740
  goto _again;
2774
2741
  f37:
2775
- #line 288 "ext/dtext/dtext.rl"
2742
+ #line 289 "ext/dtext/dtext.rl"
2776
2743
  {( sm->te) = ( sm->p)+1;{
2777
2744
  GString * segment = g_string_new_len(sm->a1, sm->a2 - sm->a1);
2778
2745
  GString * lowercase_segment = NULL;
@@ -2795,14 +2762,14 @@ f37:
2795
2762
  }}
2796
2763
  goto _again;
2797
2764
  f26:
2798
- #line 402 "ext/dtext/dtext.rl"
2765
+ #line 406 "ext/dtext/dtext.rl"
2799
2766
  {( sm->te) = ( sm->p)+1;{
2800
2767
  dstack_push(sm, &INLINE_B);
2801
2768
  append(sm, true, "<strong>");
2802
2769
  }}
2803
2770
  goto _again;
2804
2771
  f17:
2805
- #line 407 "ext/dtext/dtext.rl"
2772
+ #line 411 "ext/dtext/dtext.rl"
2806
2773
  {( sm->te) = ( sm->p)+1;{
2807
2774
  if (dstack_check(sm, INLINE_B)) {
2808
2775
  dstack_pop(sm);
@@ -2813,14 +2780,14 @@ f17:
2813
2780
  }}
2814
2781
  goto _again;
2815
2782
  f28:
2816
- #line 416 "ext/dtext/dtext.rl"
2783
+ #line 420 "ext/dtext/dtext.rl"
2817
2784
  {( sm->te) = ( sm->p)+1;{
2818
2785
  dstack_push(sm, &INLINE_I);
2819
2786
  append(sm, true, "<em>");
2820
2787
  }}
2821
2788
  goto _again;
2822
2789
  f19:
2823
- #line 421 "ext/dtext/dtext.rl"
2790
+ #line 425 "ext/dtext/dtext.rl"
2824
2791
  {( sm->te) = ( sm->p)+1;{
2825
2792
  if (dstack_check(sm, INLINE_I)) {
2826
2793
  dstack_pop(sm);
@@ -2831,14 +2798,14 @@ f19:
2831
2798
  }}
2832
2799
  goto _again;
2833
2800
  f31:
2834
- #line 430 "ext/dtext/dtext.rl"
2801
+ #line 434 "ext/dtext/dtext.rl"
2835
2802
  {( sm->te) = ( sm->p)+1;{
2836
2803
  dstack_push(sm, &INLINE_S);
2837
2804
  append(sm, true, "<s>");
2838
2805
  }}
2839
2806
  goto _again;
2840
2807
  f20:
2841
- #line 435 "ext/dtext/dtext.rl"
2808
+ #line 439 "ext/dtext/dtext.rl"
2842
2809
  {( sm->te) = ( sm->p)+1;{
2843
2810
  if (dstack_check(sm, INLINE_S)) {
2844
2811
  dstack_pop(sm);
@@ -2849,14 +2816,14 @@ f20:
2849
2816
  }}
2850
2817
  goto _again;
2851
2818
  f34:
2852
- #line 444 "ext/dtext/dtext.rl"
2819
+ #line 448 "ext/dtext/dtext.rl"
2853
2820
  {( sm->te) = ( sm->p)+1;{
2854
2821
  dstack_push(sm, &INLINE_U);
2855
2822
  append(sm, true, "<u>");
2856
2823
  }}
2857
2824
  goto _again;
2858
2825
  f25:
2859
- #line 449 "ext/dtext/dtext.rl"
2826
+ #line 453 "ext/dtext/dtext.rl"
2860
2827
  {( sm->te) = ( sm->p)+1;{
2861
2828
  if (dstack_check(sm, INLINE_U)) {
2862
2829
  dstack_pop(sm);
@@ -2867,14 +2834,14 @@ f25:
2867
2834
  }}
2868
2835
  goto _again;
2869
2836
  f33:
2870
- #line 458 "ext/dtext/dtext.rl"
2837
+ #line 462 "ext/dtext/dtext.rl"
2871
2838
  {( sm->te) = ( sm->p)+1;{
2872
2839
  dstack_push(sm, &INLINE_TN);
2873
2840
  append(sm, true, "<span class=\"tn\">");
2874
2841
  }}
2875
2842
  goto _again;
2876
2843
  f24:
2877
- #line 463 "ext/dtext/dtext.rl"
2844
+ #line 467 "ext/dtext/dtext.rl"
2878
2845
  {( sm->te) = ( sm->p)+1;{
2879
2846
  dstack_close_before_block(sm);
2880
2847
 
@@ -2890,7 +2857,7 @@ f24:
2890
2857
  }}
2891
2858
  goto _again;
2892
2859
  f30:
2893
- #line 485 "ext/dtext/dtext.rl"
2860
+ #line 489 "ext/dtext/dtext.rl"
2894
2861
  {( sm->te) = ( sm->p)+1;{
2895
2862
  g_debug("inline [quote]");
2896
2863
  dstack_close_before_block(sm);
@@ -2899,7 +2866,7 @@ f30:
2899
2866
  }}
2900
2867
  goto _again;
2901
2868
  f32:
2902
- #line 508 "ext/dtext/dtext.rl"
2869
+ #line 512 "ext/dtext/dtext.rl"
2903
2870
  {( sm->te) = ( sm->p)+1;{
2904
2871
  g_debug("inline [spoiler]");
2905
2872
  g_debug(" push <span>");
@@ -2908,7 +2875,7 @@ f32:
2908
2875
  }}
2909
2876
  goto _again;
2910
2877
  f21:
2911
- #line 515 "ext/dtext/dtext.rl"
2878
+ #line 519 "ext/dtext/dtext.rl"
2912
2879
  {( sm->te) = ( sm->p)+1;{
2913
2880
  g_debug("inline [/spoiler]");
2914
2881
  dstack_close_before_block(sm);
@@ -2931,7 +2898,7 @@ f21:
2931
2898
  }}
2932
2899
  goto _again;
2933
2900
  f27:
2934
- #line 536 "ext/dtext/dtext.rl"
2901
+ #line 540 "ext/dtext/dtext.rl"
2935
2902
  {( sm->te) = ( sm->p)+1;{
2936
2903
  g_debug("inline [expand]");
2937
2904
  dstack_rewind(sm);
@@ -2940,7 +2907,7 @@ f27:
2940
2907
  }}
2941
2908
  goto _again;
2942
2909
  f18:
2943
- #line 543 "ext/dtext/dtext.rl"
2910
+ #line 547 "ext/dtext/dtext.rl"
2944
2911
  {( sm->te) = ( sm->p)+1;{
2945
2912
  dstack_close_before_block(sm);
2946
2913
 
@@ -2954,7 +2921,7 @@ f18:
2954
2921
  }}
2955
2922
  goto _again;
2956
2923
  f29:
2957
- #line 555 "ext/dtext/dtext.rl"
2924
+ #line 559 "ext/dtext/dtext.rl"
2958
2925
  {( sm->te) = ( sm->p)+1;{
2959
2926
  dstack_push(sm, &INLINE_NODTEXT);
2960
2927
  {
@@ -2972,7 +2939,7 @@ f29:
2972
2939
  }}
2973
2940
  goto _again;
2974
2941
  f23:
2975
- #line 560 "ext/dtext/dtext.rl"
2942
+ #line 564 "ext/dtext/dtext.rl"
2976
2943
  {( sm->te) = ( sm->p)+1;{
2977
2944
  if (dstack_check(sm, BLOCK_TH)) {
2978
2945
  dstack_pop(sm);
@@ -2984,7 +2951,7 @@ f23:
2984
2951
  }}
2985
2952
  goto _again;
2986
2953
  f22:
2987
- #line 570 "ext/dtext/dtext.rl"
2954
+ #line 574 "ext/dtext/dtext.rl"
2988
2955
  {( sm->te) = ( sm->p)+1;{
2989
2956
  if (dstack_check(sm, BLOCK_TD)) {
2990
2957
  dstack_pop(sm);
@@ -2996,7 +2963,7 @@ f22:
2996
2963
  }}
2997
2964
  goto _again;
2998
2965
  f72:
2999
- #line 580 "ext/dtext/dtext.rl"
2966
+ #line 584 "ext/dtext/dtext.rl"
3000
2967
  {( sm->te) = ( sm->p)+1;{
3001
2968
  g_debug("inline 0");
3002
2969
  g_debug(" return");
@@ -3006,14 +2973,14 @@ f72:
3006
2973
  }}
3007
2974
  goto _again;
3008
2975
  f71:
3009
- #line 616 "ext/dtext/dtext.rl"
2976
+ #line 620 "ext/dtext/dtext.rl"
3010
2977
  {( sm->te) = ( sm->p)+1;{
3011
2978
  g_debug("inline char: %c", (*( sm->p)));
3012
2979
  append_c_html_escaped(sm, (*( sm->p)));
3013
2980
  }}
3014
2981
  goto _again;
3015
2982
  f97:
3016
- #line 337 "ext/dtext/dtext.rl"
2983
+ #line 341 "ext/dtext/dtext.rl"
3017
2984
  {( sm->te) = ( sm->p);( sm->p)--;{
3018
2985
  if (is_boundary_c((*( sm->p)))) {
3019
2986
  sm->b = true;
@@ -3035,7 +3002,7 @@ f97:
3035
3002
  }}
3036
3003
  goto _again;
3037
3004
  f87:
3038
- #line 479 "ext/dtext/dtext.rl"
3005
+ #line 483 "ext/dtext/dtext.rl"
3039
3006
  {( sm->te) = ( sm->p);( sm->p)--;{
3040
3007
  dstack_rewind(sm);
3041
3008
  {( sm->p) = (( sm->a1 - 1))-1;}
@@ -3043,7 +3010,7 @@ f87:
3043
3010
  }}
3044
3011
  goto _again;
3045
3012
  f96:
3046
- #line 492 "ext/dtext/dtext.rl"
3013
+ #line 496 "ext/dtext/dtext.rl"
3047
3014
  {( sm->te) = ( sm->p);( sm->p)--;{
3048
3015
  g_debug("inline [/quote]");
3049
3016
  dstack_close_before_block(sm);
@@ -3061,7 +3028,7 @@ f96:
3061
3028
  }}
3062
3029
  goto _again;
3063
3030
  f75:
3064
- #line 588 "ext/dtext/dtext.rl"
3031
+ #line 592 "ext/dtext/dtext.rl"
3065
3032
  {( sm->te) = ( sm->p);( sm->p)--;{
3066
3033
  g_debug("inline newline2");
3067
3034
  g_debug(" return");
@@ -3075,7 +3042,7 @@ f75:
3075
3042
  }}
3076
3043
  goto _again;
3077
3044
  f74:
3078
- #line 600 "ext/dtext/dtext.rl"
3045
+ #line 604 "ext/dtext/dtext.rl"
3079
3046
  {( sm->te) = ( sm->p);( sm->p)--;{
3080
3047
  g_debug("inline newline");
3081
3048
 
@@ -3089,20 +3056,20 @@ f74:
3089
3056
  }}
3090
3057
  goto _again;
3091
3058
  f77:
3092
- #line 612 "ext/dtext/dtext.rl"
3059
+ #line 616 "ext/dtext/dtext.rl"
3093
3060
  {( sm->te) = ( sm->p);( sm->p)--;{
3094
3061
  append_c(sm, ' ');
3095
3062
  }}
3096
3063
  goto _again;
3097
3064
  f78:
3098
- #line 616 "ext/dtext/dtext.rl"
3065
+ #line 620 "ext/dtext/dtext.rl"
3099
3066
  {( sm->te) = ( sm->p);( sm->p)--;{
3100
3067
  g_debug("inline char: %c", (*( sm->p)));
3101
3068
  append_c_html_escaped(sm, (*( sm->p)));
3102
3069
  }}
3103
3070
  goto _again;
3104
3071
  f16:
3105
- #line 170 "ext/dtext/dtext.rl"
3072
+ #line 171 "ext/dtext/dtext.rl"
3106
3073
  {{( sm->p) = ((( sm->te)))-1;}{
3107
3074
  append(sm, true, "<a href=\"/forum_topics/");
3108
3075
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3113,7 +3080,7 @@ f16:
3113
3080
  }}
3114
3081
  goto _again;
3115
3082
  f15:
3116
- #line 237 "ext/dtext/dtext.rl"
3083
+ #line 238 "ext/dtext/dtext.rl"
3117
3084
  {{( sm->p) = ((( sm->te)))-1;}{
3118
3085
  append(sm, true, "<a href=\"http://www.pixiv.net/member_illust.php?mode=medium&illust_id=");
3119
3086
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3124,7 +3091,7 @@ f15:
3124
3091
  }}
3125
3092
  goto _again;
3126
3093
  f11:
3127
- #line 600 "ext/dtext/dtext.rl"
3094
+ #line 604 "ext/dtext/dtext.rl"
3128
3095
  {{( sm->p) = ((( sm->te)))-1;}{
3129
3096
  g_debug("inline newline");
3130
3097
 
@@ -3138,7 +3105,7 @@ f11:
3138
3105
  }}
3139
3106
  goto _again;
3140
3107
  f12:
3141
- #line 616 "ext/dtext/dtext.rl"
3108
+ #line 620 "ext/dtext/dtext.rl"
3142
3109
  {{( sm->p) = ((( sm->te)))-1;}{
3143
3110
  g_debug("inline char: %c", (*( sm->p)));
3144
3111
  append_c_html_escaped(sm, (*( sm->p)));
@@ -3204,7 +3171,7 @@ f9:
3204
3171
  }
3205
3172
  goto _again;
3206
3173
  f40:
3207
- #line 623 "ext/dtext/dtext.rl"
3174
+ #line 627 "ext/dtext/dtext.rl"
3208
3175
  {( sm->te) = ( sm->p)+1;{
3209
3176
  if (dstack_check(sm, BLOCK_CODE)) {
3210
3177
  dstack_rewind(sm);
@@ -3215,32 +3182,32 @@ f40:
3215
3182
  }}
3216
3183
  goto _again;
3217
3184
  f99:
3218
- #line 632 "ext/dtext/dtext.rl"
3185
+ #line 636 "ext/dtext/dtext.rl"
3219
3186
  {( sm->te) = ( sm->p)+1;{
3220
3187
  ( sm->p)--;
3221
3188
  { sm->cs = ( ((int *)sm->stack->data))[--( sm->top)];goto _again;}
3222
3189
  }}
3223
3190
  goto _again;
3224
3191
  f98:
3225
- #line 637 "ext/dtext/dtext.rl"
3192
+ #line 641 "ext/dtext/dtext.rl"
3226
3193
  {( sm->te) = ( sm->p)+1;{
3227
3194
  append_c_html_escaped(sm, (*( sm->p)));
3228
3195
  }}
3229
3196
  goto _again;
3230
3197
  f100:
3231
- #line 637 "ext/dtext/dtext.rl"
3198
+ #line 641 "ext/dtext/dtext.rl"
3232
3199
  {( sm->te) = ( sm->p);( sm->p)--;{
3233
3200
  append_c_html_escaped(sm, (*( sm->p)));
3234
3201
  }}
3235
3202
  goto _again;
3236
3203
  f39:
3237
- #line 637 "ext/dtext/dtext.rl"
3204
+ #line 641 "ext/dtext/dtext.rl"
3238
3205
  {{( sm->p) = ((( sm->te)))-1;}{
3239
3206
  append_c_html_escaped(sm, (*( sm->p)));
3240
3207
  }}
3241
3208
  goto _again;
3242
3209
  f42:
3243
- #line 643 "ext/dtext/dtext.rl"
3210
+ #line 647 "ext/dtext/dtext.rl"
3244
3211
  {( sm->te) = ( sm->p)+1;{
3245
3212
  if (dstack_check(sm, BLOCK_NODTEXT)) {
3246
3213
  dstack_pop(sm);
@@ -3255,39 +3222,39 @@ f42:
3255
3222
  }}
3256
3223
  goto _again;
3257
3224
  f102:
3258
- #line 656 "ext/dtext/dtext.rl"
3225
+ #line 660 "ext/dtext/dtext.rl"
3259
3226
  {( sm->te) = ( sm->p)+1;{
3260
3227
  ( sm->p)--;
3261
3228
  { sm->cs = ( ((int *)sm->stack->data))[--( sm->top)];goto _again;}
3262
3229
  }}
3263
3230
  goto _again;
3264
3231
  f101:
3265
- #line 661 "ext/dtext/dtext.rl"
3232
+ #line 665 "ext/dtext/dtext.rl"
3266
3233
  {( sm->te) = ( sm->p)+1;{
3267
3234
  append_c_html_escaped(sm, (*( sm->p)));
3268
3235
  }}
3269
3236
  goto _again;
3270
3237
  f103:
3271
- #line 661 "ext/dtext/dtext.rl"
3238
+ #line 665 "ext/dtext/dtext.rl"
3272
3239
  {( sm->te) = ( sm->p);( sm->p)--;{
3273
3240
  append_c_html_escaped(sm, (*( sm->p)));
3274
3241
  }}
3275
3242
  goto _again;
3276
3243
  f41:
3277
- #line 661 "ext/dtext/dtext.rl"
3244
+ #line 665 "ext/dtext/dtext.rl"
3278
3245
  {{( sm->p) = ((( sm->te)))-1;}{
3279
3246
  append_c_html_escaped(sm, (*( sm->p)));
3280
3247
  }}
3281
3248
  goto _again;
3282
3249
  f51:
3283
- #line 667 "ext/dtext/dtext.rl"
3250
+ #line 671 "ext/dtext/dtext.rl"
3284
3251
  {( sm->te) = ( sm->p)+1;{
3285
3252
  dstack_push(sm, &BLOCK_THEAD);
3286
3253
  append_block(sm, "<thead>");
3287
3254
  }}
3288
3255
  goto _again;
3289
3256
  f46:
3290
- #line 672 "ext/dtext/dtext.rl"
3257
+ #line 676 "ext/dtext/dtext.rl"
3291
3258
  {( sm->te) = ( sm->p)+1;{
3292
3259
  if (dstack_check(sm, BLOCK_THEAD)) {
3293
3260
  dstack_pop(sm);
@@ -3298,14 +3265,14 @@ f46:
3298
3265
  }}
3299
3266
  goto _again;
3300
3267
  f48:
3301
- #line 681 "ext/dtext/dtext.rl"
3268
+ #line 685 "ext/dtext/dtext.rl"
3302
3269
  {( sm->te) = ( sm->p)+1;{
3303
3270
  dstack_push(sm, &BLOCK_TBODY);
3304
3271
  append_block(sm, "<tbody>");
3305
3272
  }}
3306
3273
  goto _again;
3307
3274
  f45:
3308
- #line 686 "ext/dtext/dtext.rl"
3275
+ #line 690 "ext/dtext/dtext.rl"
3309
3276
  {( sm->te) = ( sm->p)+1;{
3310
3277
  if (dstack_check(sm, BLOCK_TBODY)) {
3311
3278
  dstack_pop(sm);
@@ -3316,7 +3283,7 @@ f45:
3316
3283
  }}
3317
3284
  goto _again;
3318
3285
  f50:
3319
- #line 695 "ext/dtext/dtext.rl"
3286
+ #line 699 "ext/dtext/dtext.rl"
3320
3287
  {( sm->te) = ( sm->p)+1;{
3321
3288
  dstack_push(sm, &BLOCK_TH);
3322
3289
  append_block(sm, "<th>");
@@ -3335,14 +3302,14 @@ f50:
3335
3302
  }}
3336
3303
  goto _again;
3337
3304
  f52:
3338
- #line 701 "ext/dtext/dtext.rl"
3305
+ #line 705 "ext/dtext/dtext.rl"
3339
3306
  {( sm->te) = ( sm->p)+1;{
3340
3307
  dstack_push(sm, &BLOCK_TR);
3341
3308
  append_block(sm, "<tr>");
3342
3309
  }}
3343
3310
  goto _again;
3344
3311
  f47:
3345
- #line 706 "ext/dtext/dtext.rl"
3312
+ #line 710 "ext/dtext/dtext.rl"
3346
3313
  {( sm->te) = ( sm->p)+1;{
3347
3314
  if (dstack_check(sm, BLOCK_TR)) {
3348
3315
  dstack_pop(sm);
@@ -3353,7 +3320,7 @@ f47:
3353
3320
  }}
3354
3321
  goto _again;
3355
3322
  f49:
3356
- #line 715 "ext/dtext/dtext.rl"
3323
+ #line 719 "ext/dtext/dtext.rl"
3357
3324
  {( sm->te) = ( sm->p)+1;{
3358
3325
  dstack_push(sm, &BLOCK_TD);
3359
3326
  append_block(sm, "<td>");
@@ -3372,7 +3339,7 @@ f49:
3372
3339
  }}
3373
3340
  goto _again;
3374
3341
  f44:
3375
- #line 721 "ext/dtext/dtext.rl"
3342
+ #line 725 "ext/dtext/dtext.rl"
3376
3343
  {( sm->te) = ( sm->p)+1;{
3377
3344
  if (dstack_check(sm, BLOCK_TABLE)) {
3378
3345
  dstack_pop(sm);
@@ -3384,26 +3351,26 @@ f44:
3384
3351
  }}
3385
3352
  goto _again;
3386
3353
  f105:
3387
- #line 731 "ext/dtext/dtext.rl"
3354
+ #line 735 "ext/dtext/dtext.rl"
3388
3355
  {( sm->te) = ( sm->p)+1;{
3389
3356
  ( sm->p)--;
3390
3357
  { sm->cs = ( ((int *)sm->stack->data))[--( sm->top)];goto _again;}
3391
3358
  }}
3392
3359
  goto _again;
3393
3360
  f104:
3394
- #line 736 "ext/dtext/dtext.rl"
3361
+ #line 740 "ext/dtext/dtext.rl"
3395
3362
  {( sm->te) = ( sm->p)+1;}
3396
3363
  goto _again;
3397
3364
  f106:
3398
- #line 736 "ext/dtext/dtext.rl"
3365
+ #line 740 "ext/dtext/dtext.rl"
3399
3366
  {( sm->te) = ( sm->p);( sm->p)--;}
3400
3367
  goto _again;
3401
3368
  f43:
3402
- #line 736 "ext/dtext/dtext.rl"
3369
+ #line 740 "ext/dtext/dtext.rl"
3403
3370
  {{( sm->p) = ((( sm->te)))-1;}}
3404
3371
  goto _again;
3405
3372
  f108:
3406
- #line 779 "ext/dtext/dtext.rl"
3373
+ #line 783 "ext/dtext/dtext.rl"
3407
3374
  {( sm->te) = ( sm->p)+1;{
3408
3375
  dstack_close_list(sm);
3409
3376
  {( sm->p) = (( sm->ts))-1;}
@@ -3411,7 +3378,7 @@ f108:
3411
3378
  }}
3412
3379
  goto _again;
3413
3380
  f107:
3414
- #line 787 "ext/dtext/dtext.rl"
3381
+ #line 791 "ext/dtext/dtext.rl"
3415
3382
  {( sm->te) = ( sm->p)+1;{
3416
3383
  dstack_rewind(sm);
3417
3384
  ( sm->p)--;
@@ -3419,7 +3386,7 @@ f107:
3419
3386
  }}
3420
3387
  goto _again;
3421
3388
  f110:
3422
- #line 787 "ext/dtext/dtext.rl"
3389
+ #line 791 "ext/dtext/dtext.rl"
3423
3390
  {( sm->te) = ( sm->p);( sm->p)--;{
3424
3391
  dstack_rewind(sm);
3425
3392
  ( sm->p)--;
@@ -3427,7 +3394,7 @@ f110:
3427
3394
  }}
3428
3395
  goto _again;
3429
3396
  f55:
3430
- #line 787 "ext/dtext/dtext.rl"
3397
+ #line 791 "ext/dtext/dtext.rl"
3431
3398
  {{( sm->p) = ((( sm->te)))-1;}{
3432
3399
  dstack_rewind(sm);
3433
3400
  ( sm->p)--;
@@ -3451,7 +3418,7 @@ f53:
3451
3418
  }
3452
3419
  goto _again;
3453
3420
  f5:
3454
- #line 858 "ext/dtext/dtext.rl"
3421
+ #line 862 "ext/dtext/dtext.rl"
3455
3422
  {( sm->te) = ( sm->p)+1;{
3456
3423
  g_debug("block [/spoiler]");
3457
3424
  dstack_close_before_block(sm);
@@ -3462,7 +3429,7 @@ f5:
3462
3429
  }}
3463
3430
  goto _again;
3464
3431
  f7:
3465
- #line 905 "ext/dtext/dtext.rl"
3432
+ #line 909 "ext/dtext/dtext.rl"
3466
3433
  {( sm->te) = ( sm->p)+1;{
3467
3434
  dstack_close_before_block(sm);
3468
3435
  dstack_push(sm, &BLOCK_TABLE);
@@ -3482,7 +3449,7 @@ f7:
3482
3449
  }}
3483
3450
  goto _again;
3484
3451
  f8:
3485
- #line 912 "ext/dtext/dtext.rl"
3452
+ #line 916 "ext/dtext/dtext.rl"
3486
3453
  {( sm->te) = ( sm->p)+1;{
3487
3454
  dstack_push(sm, &BLOCK_TN);
3488
3455
  append_block(sm, "<p class=\"tn\">");
@@ -3501,7 +3468,7 @@ f8:
3501
3468
  }}
3502
3469
  goto _again;
3503
3470
  f59:
3504
- #line 928 "ext/dtext/dtext.rl"
3471
+ #line 932 "ext/dtext/dtext.rl"
3505
3472
  {( sm->te) = ( sm->p)+1;{
3506
3473
  g_debug("block 0");
3507
3474
  g_debug(" close dstack");
@@ -3509,7 +3476,7 @@ f59:
3509
3476
  }}
3510
3477
  goto _again;
3511
3478
  f58:
3512
- #line 951 "ext/dtext/dtext.rl"
3479
+ #line 955 "ext/dtext/dtext.rl"
3513
3480
  {( sm->te) = ( sm->p)+1;{
3514
3481
  g_debug("block char: %c", (*( sm->p)));
3515
3482
  ( sm->p)--;
@@ -3536,7 +3503,7 @@ f58:
3536
3503
  }}
3537
3504
  goto _again;
3538
3505
  f64:
3539
- #line 795 "ext/dtext/dtext.rl"
3506
+ #line 799 "ext/dtext/dtext.rl"
3540
3507
  {( sm->te) = ( sm->p);( sm->p)--;{
3541
3508
  char header = *sm->a1;
3542
3509
 
@@ -3594,7 +3561,7 @@ f64:
3594
3561
  }}
3595
3562
  goto _again;
3596
3563
  f69:
3597
- #line 840 "ext/dtext/dtext.rl"
3564
+ #line 844 "ext/dtext/dtext.rl"
3598
3565
  {( sm->te) = ( sm->p);( sm->p)--;{
3599
3566
  g_debug("block [quote]");
3600
3567
  g_debug(" push quote");
@@ -3605,7 +3572,7 @@ f69:
3605
3572
  }}
3606
3573
  goto _again;
3607
3574
  f70:
3608
- #line 849 "ext/dtext/dtext.rl"
3575
+ #line 853 "ext/dtext/dtext.rl"
3609
3576
  {( sm->te) = ( sm->p);( sm->p)--;{
3610
3577
  g_debug("block [spoiler]");
3611
3578
  g_debug(" push spoiler");
@@ -3616,7 +3583,7 @@ f70:
3616
3583
  }}
3617
3584
  goto _again;
3618
3585
  f65:
3619
- #line 867 "ext/dtext/dtext.rl"
3586
+ #line 871 "ext/dtext/dtext.rl"
3620
3587
  {( sm->te) = ( sm->p);( sm->p)--;{
3621
3588
  g_debug("block [code]");
3622
3589
  dstack_close_before_block(sm);
@@ -3637,7 +3604,7 @@ f65:
3637
3604
  }}
3638
3605
  goto _again;
3639
3606
  f67:
3640
- #line 875 "ext/dtext/dtext.rl"
3607
+ #line 879 "ext/dtext/dtext.rl"
3641
3608
  {( sm->te) = ( sm->p);( sm->p)--;{
3642
3609
  g_debug("block [expand]");
3643
3610
  dstack_close_before_block(sm);
@@ -3648,7 +3615,7 @@ f67:
3648
3615
  }}
3649
3616
  goto _again;
3650
3617
  f66:
3651
- #line 884 "ext/dtext/dtext.rl"
3618
+ #line 888 "ext/dtext/dtext.rl"
3652
3619
  {( sm->te) = ( sm->p);( sm->p)--;{
3653
3620
  g_debug("block [expand=]");
3654
3621
  dstack_close_before_block(sm);
@@ -3662,7 +3629,7 @@ f66:
3662
3629
  }}
3663
3630
  goto _again;
3664
3631
  f68:
3665
- #line 896 "ext/dtext/dtext.rl"
3632
+ #line 900 "ext/dtext/dtext.rl"
3666
3633
  {( sm->te) = ( sm->p);( sm->p)--;{
3667
3634
  g_debug("block [nodtext]");
3668
3635
  dstack_close_before_block(sm);
@@ -3684,7 +3651,7 @@ f68:
3684
3651
  }}
3685
3652
  goto _again;
3686
3653
  f62:
3687
- #line 951 "ext/dtext/dtext.rl"
3654
+ #line 955 "ext/dtext/dtext.rl"
3688
3655
  {( sm->te) = ( sm->p);( sm->p)--;{
3689
3656
  g_debug("block char: %c", (*( sm->p)));
3690
3657
  ( sm->p)--;
@@ -3711,7 +3678,7 @@ f62:
3711
3678
  }}
3712
3679
  goto _again;
3713
3680
  f2:
3714
- #line 951 "ext/dtext/dtext.rl"
3681
+ #line 955 "ext/dtext/dtext.rl"
3715
3682
  {{( sm->p) = ((( sm->te)))-1;}{
3716
3683
  g_debug("block char: %c", (*( sm->p)));
3717
3684
  ( sm->p)--;
@@ -3763,11 +3730,11 @@ f0:
3763
3730
  }
3764
3731
  goto _again;
3765
3732
  f92:
3766
- #line 100 "ext/dtext/dtext.rl"
3733
+ #line 101 "ext/dtext/dtext.rl"
3767
3734
  {
3768
3735
  sm->a2 = sm->p;
3769
3736
  }
3770
- #line 152 "ext/dtext/dtext.rl"
3737
+ #line 153 "ext/dtext/dtext.rl"
3771
3738
  {( sm->te) = ( sm->p);( sm->p)--;{
3772
3739
  append(sm, true, "<a href=\"/posts/");
3773
3740
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3778,11 +3745,11 @@ f92:
3778
3745
  }}
3779
3746
  goto _again;
3780
3747
  f86:
3781
- #line 100 "ext/dtext/dtext.rl"
3748
+ #line 101 "ext/dtext/dtext.rl"
3782
3749
  {
3783
3750
  sm->a2 = sm->p;
3784
3751
  }
3785
- #line 161 "ext/dtext/dtext.rl"
3752
+ #line 162 "ext/dtext/dtext.rl"
3786
3753
  {( sm->te) = ( sm->p);( sm->p)--;{
3787
3754
  append(sm, true, "<a href=\"/forum_posts/");
3788
3755
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3793,11 +3760,11 @@ f86:
3793
3760
  }}
3794
3761
  goto _again;
3795
3762
  f93:
3796
- #line 100 "ext/dtext/dtext.rl"
3763
+ #line 101 "ext/dtext/dtext.rl"
3797
3764
  {
3798
3765
  sm->a2 = sm->p;
3799
3766
  }
3800
- #line 170 "ext/dtext/dtext.rl"
3767
+ #line 171 "ext/dtext/dtext.rl"
3801
3768
  {( sm->te) = ( sm->p);( sm->p)--;{
3802
3769
  append(sm, true, "<a href=\"/forum_topics/");
3803
3770
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3808,11 +3775,11 @@ f93:
3808
3775
  }}
3809
3776
  goto _again;
3810
3777
  f85:
3811
- #line 100 "ext/dtext/dtext.rl"
3778
+ #line 101 "ext/dtext/dtext.rl"
3812
3779
  {
3813
3780
  sm->a2 = sm->p;
3814
3781
  }
3815
- #line 192 "ext/dtext/dtext.rl"
3782
+ #line 193 "ext/dtext/dtext.rl"
3816
3783
  {( sm->te) = ( sm->p);( sm->p)--;{
3817
3784
  append(sm, true, "<a href=\"/comments/");
3818
3785
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3823,11 +3790,11 @@ f85:
3823
3790
  }}
3824
3791
  goto _again;
3825
3792
  f91:
3826
- #line 100 "ext/dtext/dtext.rl"
3793
+ #line 101 "ext/dtext/dtext.rl"
3827
3794
  {
3828
3795
  sm->a2 = sm->p;
3829
3796
  }
3830
- #line 201 "ext/dtext/dtext.rl"
3797
+ #line 202 "ext/dtext/dtext.rl"
3831
3798
  {( sm->te) = ( sm->p);( sm->p)--;{
3832
3799
  append(sm, true, "<a href=\"/pools/");
3833
3800
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3838,11 +3805,11 @@ f91:
3838
3805
  }}
3839
3806
  goto _again;
3840
3807
  f95:
3841
- #line 100 "ext/dtext/dtext.rl"
3808
+ #line 101 "ext/dtext/dtext.rl"
3842
3809
  {
3843
3810
  sm->a2 = sm->p;
3844
3811
  }
3845
- #line 210 "ext/dtext/dtext.rl"
3812
+ #line 211 "ext/dtext/dtext.rl"
3846
3813
  {( sm->te) = ( sm->p);( sm->p)--;{
3847
3814
  append(sm, true, "<a href=\"/users/");
3848
3815
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3853,11 +3820,11 @@ f95:
3853
3820
  }}
3854
3821
  goto _again;
3855
3822
  f84:
3856
- #line 100 "ext/dtext/dtext.rl"
3823
+ #line 101 "ext/dtext/dtext.rl"
3857
3824
  {
3858
3825
  sm->a2 = sm->p;
3859
3826
  }
3860
- #line 219 "ext/dtext/dtext.rl"
3827
+ #line 220 "ext/dtext/dtext.rl"
3861
3828
  {( sm->te) = ( sm->p);( sm->p)--;{
3862
3829
  append(sm, true, "<a href=\"/artists/");
3863
3830
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3868,11 +3835,11 @@ f84:
3868
3835
  }}
3869
3836
  goto _again;
3870
3837
  f88:
3871
- #line 100 "ext/dtext/dtext.rl"
3838
+ #line 101 "ext/dtext/dtext.rl"
3872
3839
  {
3873
3840
  sm->a2 = sm->p;
3874
3841
  }
3875
- #line 228 "ext/dtext/dtext.rl"
3842
+ #line 229 "ext/dtext/dtext.rl"
3876
3843
  {( sm->te) = ( sm->p);( sm->p)--;{
3877
3844
  append(sm, true, "<a href=\"https://github.com/r888888888/danbooru/issues/");
3878
3845
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3883,11 +3850,11 @@ f88:
3883
3850
  }}
3884
3851
  goto _again;
3885
3852
  f89:
3886
- #line 100 "ext/dtext/dtext.rl"
3853
+ #line 101 "ext/dtext/dtext.rl"
3887
3854
  {
3888
3855
  sm->a2 = sm->p;
3889
3856
  }
3890
- #line 237 "ext/dtext/dtext.rl"
3857
+ #line 238 "ext/dtext/dtext.rl"
3891
3858
  {( sm->te) = ( sm->p);( sm->p)--;{
3892
3859
  append(sm, true, "<a href=\"http://www.pixiv.net/member_illust.php?mode=medium&illust_id=");
3893
3860
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -3898,11 +3865,11 @@ f89:
3898
3865
  }}
3899
3866
  goto _again;
3900
3867
  f80:
3901
- #line 100 "ext/dtext/dtext.rl"
3868
+ #line 101 "ext/dtext/dtext.rl"
3902
3869
  {
3903
3870
  sm->a2 = sm->p;
3904
3871
  }
3905
- #line 362 "ext/dtext/dtext.rl"
3872
+ #line 366 "ext/dtext/dtext.rl"
3906
3873
  {( sm->te) = ( sm->p);( sm->p)--;{
3907
3874
  if (is_boundary_c((*( sm->p)))) {
3908
3875
  sm->b = true;
@@ -3925,7 +3892,7 @@ f80:
3925
3892
  }}
3926
3893
  goto _again;
3927
3894
  f83:
3928
- #line 100 "ext/dtext/dtext.rl"
3895
+ #line 101 "ext/dtext/dtext.rl"
3929
3896
  {
3930
3897
  sm->a2 = sm->p;
3931
3898
  }
@@ -3988,11 +3955,11 @@ f83:
3988
3955
  }
3989
3956
  goto _again;
3990
3957
  f13:
3991
- #line 108 "ext/dtext/dtext.rl"
3958
+ #line 109 "ext/dtext/dtext.rl"
3992
3959
  {
3993
3960
  sm->b2 = sm->p;
3994
3961
  }
3995
- #line 329 "ext/dtext/dtext.rl"
3962
+ #line 333 "ext/dtext/dtext.rl"
3996
3963
  {( sm->te) = ( sm->p)+1;{
3997
3964
  append(sm, true, "<a href=\"");
3998
3965
  append_segment_html_escaped(sm, sm->b1, sm->b2 - 1);
@@ -4002,11 +3969,11 @@ f13:
4002
3969
  }}
4003
3970
  goto _again;
4004
3971
  f94:
4005
- #line 108 "ext/dtext/dtext.rl"
3972
+ #line 109 "ext/dtext/dtext.rl"
4006
3973
  {
4007
3974
  sm->b2 = sm->p;
4008
3975
  }
4009
- #line 179 "ext/dtext/dtext.rl"
3976
+ #line 180 "ext/dtext/dtext.rl"
4010
3977
  {( sm->te) = ( sm->p);( sm->p)--;{
4011
3978
  append(sm, true, "<a href=\"/forum_topics/");
4012
3979
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -4021,11 +3988,11 @@ f94:
4021
3988
  }}
4022
3989
  goto _again;
4023
3990
  f90:
4024
- #line 108 "ext/dtext/dtext.rl"
3991
+ #line 109 "ext/dtext/dtext.rl"
4025
3992
  {
4026
3993
  sm->b2 = sm->p;
4027
3994
  }
4028
- #line 246 "ext/dtext/dtext.rl"
3995
+ #line 247 "ext/dtext/dtext.rl"
4029
3996
  {( sm->te) = ( sm->p);( sm->p)--;{
4030
3997
  append(sm, true, "<a href=\"http://www.pixiv.net/member_illust.php?mode=manga_big&illust_id=");
4031
3998
  append_segment(sm, true, sm->a1, sm->a2 - 1);
@@ -4040,11 +4007,11 @@ f90:
4040
4007
  }}
4041
4008
  goto _again;
4042
4009
  f79:
4043
- #line 108 "ext/dtext/dtext.rl"
4010
+ #line 109 "ext/dtext/dtext.rl"
4044
4011
  {
4045
4012
  sm->b2 = sm->p;
4046
4013
  }
4047
- #line 309 "ext/dtext/dtext.rl"
4014
+ #line 310 "ext/dtext/dtext.rl"
4048
4015
  {( sm->te) = ( sm->p);( sm->p)--;{
4049
4016
  if (is_boundary_c((*( sm->p)))) {
4050
4017
  sm->d = 2;
@@ -4057,7 +4024,10 @@ f79:
4057
4024
  append(sm, true, "<a href=\"");
4058
4025
  append_segment_html_escaped(sm, sm->b1, sm->b2 - sm->d);
4059
4026
  append(sm, true, "\">");
4060
- append_segment_html_escaped(sm, sm->a1, sm->a2 - 1);
4027
+ link_content_sm = parse_helper(sm->a1, sm->a2 - sm->a1, false, true);
4028
+ append(sm, true, link_content_sm->output->str);
4029
+ free_machine(link_content_sm);
4030
+ link_content_sm = NULL;
4061
4031
  append(sm, true, "</a>");
4062
4032
 
4063
4033
  if (sm->b) {
@@ -4066,11 +4036,11 @@ f79:
4066
4036
  }}
4067
4037
  goto _again;
4068
4038
  f76:
4069
- #line 108 "ext/dtext/dtext.rl"
4039
+ #line 109 "ext/dtext/dtext.rl"
4070
4040
  {
4071
4041
  sm->b2 = sm->p;
4072
4042
  }
4073
- #line 383 "ext/dtext/dtext.rl"
4043
+ #line 387 "ext/dtext/dtext.rl"
4074
4044
  {( sm->te) = ( sm->p);( sm->p)--;{
4075
4045
  g_debug("inline list");
4076
4046
 
@@ -4091,11 +4061,11 @@ f76:
4091
4061
  }}
4092
4062
  goto _again;
4093
4063
  f111:
4094
- #line 108 "ext/dtext/dtext.rl"
4064
+ #line 109 "ext/dtext/dtext.rl"
4095
4065
  {
4096
4066
  sm->b2 = sm->p;
4097
4067
  }
4098
- #line 740 "ext/dtext/dtext.rl"
4068
+ #line 744 "ext/dtext/dtext.rl"
4099
4069
  {( sm->te) = ( sm->p);( sm->p)--;{
4100
4070
  int prev_nest = sm->list_nest;
4101
4071
  append_closing_p_if(sm);
@@ -4146,11 +4116,11 @@ f111:
4146
4116
  }}
4147
4117
  goto _again;
4148
4118
  f63:
4149
- #line 108 "ext/dtext/dtext.rl"
4119
+ #line 109 "ext/dtext/dtext.rl"
4150
4120
  {
4151
4121
  sm->b2 = sm->p;
4152
4122
  }
4153
- #line 918 "ext/dtext/dtext.rl"
4123
+ #line 922 "ext/dtext/dtext.rl"
4154
4124
  {( sm->te) = ( sm->p);( sm->p)--;{
4155
4125
  g_debug("block list");
4156
4126
  g_debug(" call list");
@@ -4175,7 +4145,7 @@ f63:
4175
4145
  f14:
4176
4146
  #line 1 "NONE"
4177
4147
  {( sm->te) = ( sm->p)+1;}
4178
- #line 96 "ext/dtext/dtext.rl"
4148
+ #line 97 "ext/dtext/dtext.rl"
4179
4149
  {
4180
4150
  sm->a1 = sm->p;
4181
4151
  }
@@ -4183,49 +4153,49 @@ f14:
4183
4153
  f82:
4184
4154
  #line 1 "NONE"
4185
4155
  {( sm->te) = ( sm->p)+1;}
4186
- #line 358 "ext/dtext/dtext.rl"
4156
+ #line 362 "ext/dtext/dtext.rl"
4187
4157
  {( sm->act) = 18;}
4188
4158
  goto _again;
4189
4159
  f81:
4190
4160
  #line 1 "NONE"
4191
4161
  {( sm->te) = ( sm->p)+1;}
4192
- #line 362 "ext/dtext/dtext.rl"
4162
+ #line 366 "ext/dtext/dtext.rl"
4193
4163
  {( sm->act) = 19;}
4194
4164
  goto _again;
4195
4165
  f10:
4196
4166
  #line 1 "NONE"
4197
4167
  {( sm->te) = ( sm->p)+1;}
4198
- #line 588 "ext/dtext/dtext.rl"
4168
+ #line 592 "ext/dtext/dtext.rl"
4199
4169
  {( sm->act) = 42;}
4200
4170
  goto _again;
4201
4171
  f73:
4202
4172
  #line 1 "NONE"
4203
4173
  {( sm->te) = ( sm->p)+1;}
4204
- #line 600 "ext/dtext/dtext.rl"
4174
+ #line 604 "ext/dtext/dtext.rl"
4205
4175
  {( sm->act) = 43;}
4206
4176
  goto _again;
4207
4177
  f54:
4208
4178
  #line 1 "NONE"
4209
4179
  {( sm->te) = ( sm->p)+1;}
4210
- #line 779 "ext/dtext/dtext.rl"
4180
+ #line 783 "ext/dtext/dtext.rl"
4211
4181
  {( sm->act) = 64;}
4212
4182
  goto _again;
4213
4183
  f109:
4214
4184
  #line 1 "NONE"
4215
4185
  {( sm->te) = ( sm->p)+1;}
4216
- #line 785 "ext/dtext/dtext.rl"
4186
+ #line 789 "ext/dtext/dtext.rl"
4217
4187
  {( sm->act) = 65;}
4218
4188
  goto _again;
4219
4189
  f1:
4220
4190
  #line 1 "NONE"
4221
4191
  {( sm->te) = ( sm->p)+1;}
4222
- #line 934 "ext/dtext/dtext.rl"
4192
+ #line 938 "ext/dtext/dtext.rl"
4223
4193
  {( sm->act) = 79;}
4224
4194
  goto _again;
4225
4195
  f60:
4226
4196
  #line 1 "NONE"
4227
4197
  {( sm->te) = ( sm->p)+1;}
4228
- #line 947 "ext/dtext/dtext.rl"
4198
+ #line 951 "ext/dtext/dtext.rl"
4229
4199
  {( sm->act) = 80;}
4230
4200
  goto _again;
4231
4201
 
@@ -4235,7 +4205,7 @@ _again:
4235
4205
  #line 1 "NONE"
4236
4206
  {( sm->ts) = 0;}
4237
4207
  break;
4238
- #line 4239 "ext/dtext/dtext.c"
4208
+ #line 4209 "ext/dtext/dtext.c"
4239
4209
  }
4240
4210
 
4241
4211
  if ( ++( sm->p) != ( sm->pe) )
@@ -4551,10 +4521,58 @@ _again:
4551
4521
 
4552
4522
  }
4553
4523
 
4554
- #line 1331 "ext/dtext/dtext.rl"
4524
+ #line 1301 "ext/dtext/dtext.rl"
4555
4525
 
4556
4526
  dstack_close(sm);
4557
4527
 
4528
+ return sm;
4529
+ }
4530
+
4531
+ static VALUE parse(int argc, VALUE * argv, VALUE self) {
4532
+ VALUE input;
4533
+ VALUE input0;
4534
+ VALUE options;
4535
+ VALUE opt_inline;
4536
+ VALUE opt_strip;
4537
+ VALUE ret;
4538
+ rb_encoding * encoding = NULL;
4539
+ StateMachine * sm = NULL;
4540
+ bool f_strip = false;
4541
+ bool f_inline = false;
4542
+
4543
+ g_debug("start\n");
4544
+
4545
+ if (argc == 0) {
4546
+ rb_raise(rb_eArgError, "wrong number of arguments (0 for 1)");
4547
+ }
4548
+
4549
+ input = argv[0];
4550
+
4551
+ if (NIL_P(input)) {
4552
+ return Qnil;
4553
+ }
4554
+
4555
+ input0 = rb_str_dup(input);
4556
+ input0 = rb_str_cat(input0, "\0", 1);
4557
+
4558
+ if (argc > 1) {
4559
+ options = argv[1];
4560
+
4561
+ if (!NIL_P(options)) {
4562
+ opt_strip = rb_hash_aref(options, ID2SYM(rb_intern("strip")));
4563
+ if (RTEST(opt_strip)) {
4564
+ f_strip = true;
4565
+ }
4566
+
4567
+ opt_inline = rb_hash_aref(options, ID2SYM(rb_intern("inline")));
4568
+ if (RTEST(opt_inline)) {
4569
+ f_inline = true;
4570
+ }
4571
+ }
4572
+ }
4573
+
4574
+ sm = parse_helper(RSTRING_PTR(input0), RSTRING_LEN(input0), f_strip, f_inline);
4575
+
4558
4576
  encoding = rb_enc_find("utf-8");
4559
4577
  ret = rb_enc_str_new(sm->output->str, sm->output->len, encoding);
4560
4578