Class: Dyndoc::DevTagScanner

Inherits:
Scanner
  • Object
show all
Defined in:
lib/dyndoc/base/scanner.rb

Constant Summary collapse

TXT_DTAG =
[:txt,:code,:>,:<,:<<]
@@tagblck_set =
[:<<,:<,:do,:>>,:>,:">!",:out,:nl,:"\\n",:"r<",:"R<",:"rb<",:"m<",:"M<",:"jl<",:"sh<",:"r>>",:"R>>",:rverb,:"rb>>",:rbverb,:"jl>>",:jlverb,:rout,:"r>",:"R>",:"rb>",:"m>",:"M>",:"jl>",:"_<",:"_>",:"__>",:"html>",:"tex>",:"txtl>",:"ttm>",:"md>",:"adoc>",:tag,:"??",:"?",:yield,:"=",:"-",:+,:"%",:"tex=",:"tex+",:"md=",:"md+",:"adoc=",:"adoc+",:"html=",:"html+",:"rb=",:"rb+",:"R=",:"R+",:"jl=",:"jl+",:"txtl=",:"txtl+"]
@@tagblck_dyndoc_set =

Rmk: when a symbol is included in another one, you have to place it before! Ex: :>> before :> and also :<< before :<

[:main,:content,:before,:after,:require,:helpers,:preamble,:postamble,:style,:title,:path,:first,:last,:default,:cfg]
@@tagblck_tex_set =
[:class,:optclass,:package,:texinputs]
@@tagblck_html_set =
[:js,:css,:header,:footer]
@@dtag =
{
  :dtag => {
    :instr=>["newBlck","input","require","hide","format","txt",">","<","<<",">>","code","verb","if","unless","for","loop","case","var","set","def","func","meth","new","super","do","out","blck","blckAnyTag","saved","b>","call","R","r","m","M","jl","renv","rverb","rbverb","jlverb","rout","rb","eval","ifndef","tags","keys","opt","document","yield","get","part"],
    :alias=>{
      :vars=>:var,
      :dyn=>:eval,
     :rmk=>:hide,
      :static => :saved,
      :comment=>:hide,
      :>> => [:blck,:>],
      #:"b>" => [:blck, :>],
      :"rb>" => [:blck, :"rb>"],
      :"R>" =>  [:blck, :"R>"],
      :"jl>" => [:blck, :"jl>"],
      :"jl>>" => [:blck, :"jl>>"],
      :"rb<" => [:blck, :"rb<"],
      :"R<" =>  [:blck, :"R<"],
      :"jl<" => [:blck, :"jl<"],
      :"sh<" => [:blck, :"sh<"],
      :"r>>" => [:blck, :"r>>"],
      :"R>>" => [:blck, :"r>>"],
      :"*<" =>  [:blck, :"*<"],
      :"*>" =>  [:blck, :"*>"],
      :"_>" =>  [:blck, :"_>"],
      :"tex>" =>  [:blck, :"tex>"],
      :"html>" =>  [:blck, :"html>"],
      :"txtl>" =>  [:blck, :"txtl>"],
      :"md>" =>  [:blck, :"md>"],
      :"adoc>" =>  [:blck, :"adoc>"],
      :"ttm>" =>  [:blck, :"ttm>"]
    },
    :empty_keyword=>["?","empty"],
    :keyword=>{
     :document => @@tagblck_dyndoc_set + @@tagblck_tex_set + @@tagblck_html_set,
      :if=> [:else,:elsif,:if,:unless],
      :unless=> [:else,:elsif,:if,:unless],
     :for=>[],
      :loop=>[:break],
      :case=>[:when,:else],
      :var=>[:","],
      :set=>[],
      :def=>[:",",:binding],
      :meth=>[:","],
      :new=>[:",",:of,:in,:blck],
      :super=>[:",",:parent,:blck],
      :do=>[],
      :out=>[],
      :blck=>[],
      :saved=>[],
      :call=>  [:",",:blck,:"->"],
     :style=> [:of,:",",:blck,:default],
      :input=>[:","],
      :r=>[:in],
      :rverb=>[:in,:mode],
      :rbverb=>[:mode],
      :jlverb=>[:mode],
     :rout=>[:in,:mode],
      :eval=>[:to],
      :ifndef=>[:<<],
      :tags=>[:when],
  	  :keys=> [],
  	  :part=>[],
  	  :get=>[:blck]
    },
  	:keyword_reg=>{ #to overpass :keyword
  	  :new=> '[%.\w,><?=+:-]+',
  	  :call=> '[%.\w,><?=+:-]+(?:\@|\$)?',
  	  :style=>'[%.\w,><?=+:-]+',
      :newBlck=>'[%.\w,><?=+:-]+',
      :blckAnyTag=>'[%.\w,><?=+:-]+',
  	},
  	:with_tagblck =>[:document,:if,:unless,:for,:loop,:case,:set,:def,:meth,:new,:super,:do,:out,:blck,:saved,:call,:style,:rverb,:rbverb,:jlverb,:rout,:tags,:keys,:part],
  	:named_tag=>{
  #=begin
  	  :> => {:tag=>'(_TAG_)(?:[^\]]+)?',:rest=>/^>([^\]]*)$/},
  	  :>> => {:tag=>'(_TAG_)(?:[^\]]+)?',:rest=>/^>>([^\]]*)$/},
  	  :"r>" => {:tag=>'(_TAG_)(?:[^\]]+)?',:rest=>/^r>([^\]]*)$/},
  	  :"rb>" => {:tag=>'(_TAG_)(?:[^\]]+)?',:rest=>/^rb>([^\]]*)$/},
  	  :"=" => {:tag=>'(_TAG_)(?:[^\]]+)?',:rest=>/^=([^\]]*)$/}
  #=end
  	},
    :mode_arg=>:next_block,
    :tag_code=>[:code,:<,:>,:<<,:txt], #used for arg mode!
    :arg=>[:if,:unless,:elsif,:for,:case,:def,:func,:meth,:new,:super,:call,:input,:when,:break,:set,:style,:keys,:"?",:"rb<",:"r<",:"R<",:"m<",:"M<",:"jl<",:"sh<"],
    :blck=>{
      :instr=>[:document,:if,:unless,:case,:loop,:set,:tag,:keys,:rverb,:rbverb,:jlverb,:for],
      :keyword=>{
        :document=>@@tagblck_dyndoc_set + @@tagblck_tex_set + @@tagblck_html_set,
        :set=>[:set],
        :if=>[:if,:unless,:elsif,:else],
        :unless=>[:if,:unless,:elsif,:else],
        :case=>[:when,:else],
        :loop=>[:loop,:break],
        :tags=>[:when],
  	    :rverb=>[:rverb,:in,:mode],
        :rbverb=>[:rbverb,:mode],
        :jlverb=>[:jlverb,:mode],
  	    :rout=>[:rout,:in,:mode]
      }
    },
    :style=>"@" #specify that the scanner recognize a style instead a call when blck[:type].include? "@"
  }
}

Instance Attribute Summary collapse

Attributes inherited from Scanner

#scan

Instance Method Summary collapse

Methods inherited from Scanner

#clean_stack, #extract, #init_atom, #init_strange, #rebuild_after_filter, #token_stack, #tokenize

Constructor Details

#initialize(type = :dtag, start = nil, stop = nil, mode = nil, escape = nil) ⇒ DevTagScanner

Returns a new instance of DevTagScanner.



273
274
275
276
# File 'lib/dyndoc/base/scanner.rb', line 273

def initialize(type=:dtag,start=nil,stop=nil,mode=nil,escape=nil)
  super
  init_tag(@tag_type) if [:dtag].include? @tag_type
end

Instance Attribute Details

#dtagObject

Returns the value of attribute dtag.



391
392
393
# File 'lib/dyndoc/base/scanner.rb', line 391

def dtag
  @dtag
end

Instance Method Details

#ajust_with_blck(res) ⇒ Object



700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
# File 'lib/dyndoc/base/scanner.rb', line 700

def ajust_with_blck(res)
  return res unless @tag_blck[:keyword].include? res[0]
  instr=@tag_blck[:keyword][res[0]]
  res_blck,blck=[],nil
  begin
    b=res.shift
    if instr.include? b
      #create the :blck block
      res_blck << b
      #is there an :args block?
      res_blck << res.shift if @tag_arg.include? b
      #if no first tag_blck then put the default :out tag
      blck=[:blck]
      blck << :out unless @@tagblck_set.include? res[0]
    else
      if blck
        blck << b
      else
        #needed for example :case block
        res_blck << b
      end
      #is the end of blck?
      if res.empty? or (instr.include? res[0])
        res_blck << blck if blck
        blck=nil
      end
    end
  end until res.empty?
  res_blck
end

#check_until_for_named_tagsObject



521
522
523
524
525
526
527
528
529
530
531
532
# File 'lib/dyndoc/base/scanner.rb', line 521

def check_until_for_named_tags
  #if res
  @named_tags.each_index{|i|
	if @scan[3+i]
	  @tag_selected=@scan[3+i].to_sym
#puts "here we go: #{@tag_selected}"
	  break
	end
  }
  #end
  #return res
end

#complete_tag(key, add = true) ⇒ Object



507
508
509
510
511
512
513
514
515
516
517
518
519
# File 'lib/dyndoc/base/scanner.rb', line 507

def complete_tag(key,add=true)
  #Regexp.escape(key.to_s)+((@dtag[:named_tag][key]) ? @dtag[:named_tag][key] : "")
  if @dtag[:named_tag][key]
  	if add
  	  @named_tags << key
  	  return nil
  	else
  	  @dtag[:named_tag][key][:tag].sub("_TAG_",Regexp.escape( key.to_s ))
  	end
  else
  	return Regexp.escape(key.to_s)
  end
end

#convert_block(blck) ⇒ Object

ATTENTION: Ne pas faire de recurrence dans convert_block à cause de @scan! qui est en unique exemplaire!



535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
# File 'lib/dyndoc/base/scanner.rb', line 535

def convert_block(blck)
#puts "split_block";p blck
  @block= blck[:txt]
  inside=blck[:inside]
  style=blck[:type].include? @tag_style
  pre_res=[]
  res=[]
=begin
  ## Mode -> unused now!
  mode=@block[0,@mode[:length]]
  mode2=(@@close[mode] ? @@close[mode] : mode)
=end
  @scan.string=@block
  @scan.pos=0
  ## Instruction
  #@scan.scan_until(/(?:#{@tag_instr.join("|")})/)
  @scan.scan_until(@start)
  instr=@scan[1] #@scan.matched
#p [:instr,instr]
  # next block is a arg block?
  @is_arg=false
  if @tag_instr.include? instr
    instr=instr.to_sym
    instr=@tag_alias[instr] if @tag_alias.include? instr
    if instr.is_a? Array
      res += instr
      instr=instr[0]
    else
      res << instr
    end
    if (@tag_arg+@tag_code).include? instr
      case @dtag[:mode_arg]
      when :find
        res << find_args(inside)
      when :next_block
        @is_arg=true
      end
    end
  else
   instr2=(style ?  :style : :call)
    #pour un éventuel ajout de > ou < à la fin
    if [">","<"].include? instr[-1,1]
      instr2,instr=(instr2.to_s+instr[-1,1]).to_sym,instr[0...-1]
    end
    res << instr2 << [:args, {:txt=>instr,:inside=>[]}]
    instr=instr2
  end
  ## Text block
  ## find keywords
  from=true
#p "todoooo"
  while from
    from=@scan.pos
#p @tag_keyword[instr]
#p /(#{@tag[:block]}?)\s*(#{@tag[:keyword][0]}(?:#{keytags=(@tag_keyword[instr] ? @tag_keyword[instr] : [] ).map{|e| Regexp.escape(e.to_s)}.join("|")})#{@dtag[:empty_keyword][0]}#{@tag[:keyword][1]})/
    tag_keyword=nil
    if @dtag[:empty_keyword][0].empty?
      #no empty tag!
      tag_keyword=@tag_keyword[instr] if @tag_keyword[instr]
    else
      tag_keyword=(@tag_keyword[instr] ? @tag_keyword[instr] : [] )
    end
   keytags=nil
   @named_tags,@tag_selected=[],nil
   if tag_keyword
#p tag_keyword
     if @tag_keyword_reg and @tag_keyword_reg[instr]
       tag_keyword=@tag_keyword_reg[instr]
       blocktag_reg=/(#{@tag[:block]}?)\s*(#{@tag[:keyword][0]}#{tag_keyword}#{@dtag[:empty_keyword][0]}#{@tag[:keyword][1]})/
       tag_reg=/#{tag_keyword}/
     else
       keytags=tag_keyword.map{|e| complete_tag(e)}.compact.join("|")
#puts "keytags(1)";p keytags
#puts "INSTR="; p instr
       if @dtag[:with_tagblck].include? instr
         keytags += "|" unless keytags.empty?
         keytags += @@keystagblck
         @named_tags += @@named_tags_blck
       end
##puts "keytags(2)";p keytags
       tag_reg=/(?:#{keytags})/
       unless @named_tags.empty?
         keytags += "|"+(@named_tags.map{|tag| complete_tag(tag,nil)}.join("|"))
       end
        ##Dyndoc.warn "keytags",keytags
       blocktag_reg=/(#{@tag[:block]}?)\s*(#{@tag[:keyword][0]}(?:#{keytags})#{@dtag[:empty_keyword][0]}#{@tag[:keyword][1]})/
     end
##Dyndoc.warn "to scan", @scan.string[@scan.pos..-1]
##Dyndoc.warn "tag_reg",[blocktag_reg,tag_reg]
   end
    if (tag_keyword and (@scan.check_until(blocktag_reg))) #or (!@named_tags.empty? and check_until_for_named_tags)
     check_until_for_named_tags unless @named_tags.empty?
      key=@scan[2]
##Dyndoc.warn "keyword",[key,@scan[0],@scan[1],@scan[2]]
##Dyndoc.warn "pre_math,tag_selected",[@scan.pre_match,@tag_selected] if key=="[#tag]"
      res << find_text(from,key,inside)
      @is_arg=false if @is_arg
##Dyndoc.warn "key(AV)",[key,tag_reg] if key=="[#tag]"
     if @tag_selected
#puts "tag_selected";p @tag_selected
       res << (key=@tag_selected)
     else
 #key=tag_reg.match(key)[0]
       key= key.scan(tag_reg)[0]
##Dyndoc.warn "key(AP)",key if key=="tag"
       res << (key=key.to_sym) if key and !key.empty?
     end
 #res << (key=key[1..-1].to_sym)
  #p @tag_arg
      if @tag_arg.include? key #without @tag_code inside a block
        case @dtag[:mode_arg]
        when :find
          res << find_args(inside)
          from=@scan.pos
        when :next_block
          @is_arg=true
        end
      end
    else
      #Last text block!
#p /(#{@tag[:block]}?)\s*(#{@tag[:stop]})/
      @scan.check_until(/(#{@tag[:block]}?)\s*(#{@tag[:stop]})/)
#puts "last"; p @scan[2];p @scan[0]; p @scan[1]
#p @scan.pre_match
      res << find_text(from,@scan[2],inside)
#p res
      from=false
    end
#puts "from2";p from
  end
#puts "res";p res
  return res
end

#find_args(inside) ⇒ Object

Types of result block:

1) :main
2) :args
3) :instr (:if, :case, ...)

Types of parsed block:

1) :text -> main block alternating text and dtag blocks
2) :dtag -> {% ...%}


438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
# File 'lib/dyndoc/base/scanner.rb', line 438

def find_args(inside)
  ## Instruction delimiter
  delim=@block[@scan.pos,1]
  #p delim
  @scan.pos += delim.bytesize #.length
  st=@scan.pos
  delim=@@close[delim] if @@close[delim]
  #p delim
  ## Arguments
  begin
    @scan.scan_until(/#{Regexp.escape(delim)}/)
  end while @block[@scan.pos-2,1]=='\\'
  sp=@scan.pos - delim.bytesize - 1 #.length - 1
  args=@block.byteslice(st..sp) #@block[st..sp]
  inside2=[]
  (1..(args.split(@re_strange,-1).length-1)).each{ inside2 << inside.shift }
  return [:args,{:txt=>args,:inside=>inside2}]
end

#find_text(from, key, inside) ⇒ Object



457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
# File 'lib/dyndoc/base/scanner.rb', line 457

def find_text(from,key,inside)
#p ["key=",key]
  res,to=nil,nil
  pre=(@next_pre ? @next_pre : nil )
  @next_pre=nil
  if @scan[1].nil? or @scan[1].empty? or @is_arg
#p ["key=",key,@tag_selected]
  	if @tag_selected
  	  @next_pre=key[2...-1].scan(@dtag[:named_tag][@tag_selected.to_sym][:rest])[0][0]
  	  @next_pre=nil if @next_pre.empty?
  	end
    @scan.scan_until(/#{Regexp.escape(key)}/)
    to=@scan.pre_match.bytesize #.length
    ##Dyndoc.warn "TOOOOOOOOOOO",[@scan.pre_match,to]
    res=@block.byteslice(from...to) #@block[from...to]
  else
#p ["pre_match=",@scan.pre_match,"to=",@scan.pre_match.bytesize]
    to=@scan.pre_match.bytesize #.length
    ##Dyndoc.warn "TOOOOOOOOOOO2222",[@scan.pre_match,to]
    delim2=@scan[1]
    delim2=@@open[delim2] if @@open[delim2]
#p ["delim2=",delim2,/#{Regexp.escape(delim2)}/]
#p @block[from...-1]
    @scan.exist?(/#{Regexp.escape(delim2)}/)
    to_tmp=@scan.pre_match.bytesize #.length
#p ["to_tmp=",to_tmp]
    ## pre=@block[from...to_tmp].strip unless pre
#p [:pre,pre]
    pre=@block.byteslice(from...to_tmp).strip unless pre
#p ["pre=",pre]
    from=to_tmp+1
#p ["key:",key,@scan.matched,from,@block[from-1,1]]
    @scan.scan_until(/#{@tag[:block]}\s*#{Regexp.escape(key)}/)
=begin
    @scan.scan_until(/[\]|]\s*#{key}/)
=end
#p ["matched=",@scan.matched]
#p @scan.pre_match
#[email protected]_match.length
    res=@block.byteslice(from...to) #does not work for ruby2 => @block[from...to]
    pre=nil if pre.empty?
#p ["res=",from,to,res,@block.byteslice(from...to)]
  end
inside2=[]
(1..(res.split(@re_strange,-1).length-1)).each{ inside2 << inside.shift }
return [:text,{:name=>pre,:txt=>res,:inside=>inside2}] if pre
return [(@is_arg ? :args : :text),{:txt=>res,:inside=>inside2}]
end

#get_tag_blckObject



268
269
270
# File 'lib/dyndoc/base/scanner.rb', line 268

def get_tag_blck
  @@tagblck_set
end

#init_tag(type = :dtag) ⇒ Object



393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
# File 'lib/dyndoc/base/scanner.rb', line 393

def init_tag(type=:dtag)
  @dtag=@@dtag[type]
  @tag_instr=@dtag[:instr]+@dtag[:alias].keys.map{|e| e.to_s}
  @tag_alias=@dtag[:alias]
  @tag_keyword=@dtag[:keyword]
  @tag_keyword_reg=@dtag[:keyword_reg]
  @tag_arg=@dtag[:arg]
  @tag_code=(@dtag[:tag_code] ? @dtag[:tag_code] : [] )
  @tag_style=@dtag[:style]
  @tag_blck=@dtag[:blck]
  ## deal with fixed blck tags
  @named_tags=[]
  @@keystagblck=@@tagblck_set.map{|e| complete_tag(e)}.compact.join("|") #only once!
  @@named_tags_blck=@named_tags
end

#merge_tag(dtag) ⇒ Object



409
410
411
412
413
414
415
416
417
418
419
420
421
422
# File 'lib/dyndoc/base/scanner.rb', line 409

def merge_tag(dtag)
  if dtag
  	@tag_instr += dtag[:instr] if dtag[:instr]
  	@tag_instr += dtag[:alias].keys.map{|e| e.to_s} if dtag[:alias]
  	@tag_alias.merge!(dtag[:alias]) if dtag[:alias]
  	@tag_keyword.merge!(dtag[:keyword]) if dtag[:keyword]
  	@tag_keyword_reg.merge!(dtag[:keyword_reg]) if dtag[:keyword_reg]
  	@tag_arg += dtag[:arg] if dtag[:arg]
  	if dtag[:blck]
  	  @tag_blck[:instr] += dtag[:blck][:instr] if dtag[:blck][:instr]
  	  @tag_blck[:keyword].merge!(dtag[:blck][:keyword]) if dtag[:blck][:keyword]
  	end
  end
end

#parse_args(blck) ⇒ Object



731
732
733
734
735
736
737
738
739
740
741
742
743
# File 'lib/dyndoc/base/scanner.rb', line 731

def parse_args(blck)
  res=[:args]
#puts ":args";p blck[:txt]
  parts=blck[:txt].split(@re_strange,-1)
#p parts
#p blck[:inside]
  blck[:inside].map do |e|
    res << [:main,parts.shift]
    res << parse_block(e)
  end
  res << [:main,parts.shift]
  res
end

#parse_block(blck) ⇒ Object



669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
# File 'lib/dyndoc/base/scanner.rb', line 669

def parse_block(blck)
  res=convert_block(blck)
#puts "res";p res
  ##Stop scan when :txt instruction to avoid parsing!
  if TXT_DTAG.include? res[0]
    res2=[res[0],rebuild_after_filter(res[1][1])]
    # NO MORE POSSIBLE! res2 << res[1][1][:name] if res[1][1][:name]
#p res2
    return res2
  end
  res2=[]
  res.each{|e|
#p e
    if e.is_a? Array
      case e[0]
        when :args
          res2 << parse_args(e[1])
        when :text
          res2 += parse_text(e[1])
      end
    else
      res2 << e
    end
  }
#p res2
  #make :blck block if necessary
  res2=ajust_with_blck(res2)
#puts "res2";p res2
  return res2
end

#parse_text(blck) ⇒ Object



755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
# File 'lib/dyndoc/base/scanner.rb', line 755

def parse_text(blck)
#puts "blck";p blck
  res=[]
  blck[:txt].split(@re_strange2,-1).each{|e|
    if e==@strange

      b=blck[:inside].shift
      res_b=parse_block(b)
      if (res_modif=parsed_block_with_modifier(res_b))
        res << res_modif
      end
#puts "parse_text: res_b";p res_b
      res << res_b
    else
      res << [:main,e]
    end
  }
  res=[[:named,blck[:name]]+res] if blck[:name]
  res
end

#parsed_block_with_modifier(res_block) ⇒ Object



745
746
747
748
749
750
751
752
753
# File 'lib/dyndoc/base/scanner.rb', line 745

def parsed_block_with_modifier(res_block)
  res=nil
  instr=res_block[0,1].to_s
  if !["<","<<",">"].include? instr and [">","<"].include?(modif=instr[-1,1])
    res=modif.to_sym
    res_block[0,1]=instr[0...-1].to_sym
  end
  res
end

#pretty_print(res, tab = 0) ⇒ Object



793
794
795
796
797
798
799
800
801
# File 'lib/dyndoc/base/scanner.rb', line 793

def pretty_print(res,tab=0)
  res.each{|b|
    if b.is_a? Array
      pretty_print(b,tab+1)
    else
      puts "  "*tab+b.inspect+"\n"
    end
  }
end

#process(txt) ⇒ Object



788
789
790
791
# File 'lib/dyndoc/base/scanner.rb', line 788

def process(txt)
  tokenize(txt)
  parse_text(extract)
end

#rebuild_after_parse(res) ⇒ Object



776
777
778
779
780
781
782
783
784
785
786
# File 'lib/dyndoc/base/scanner.rb', line 776

def rebuild_after_parse(res)
    txt=""
    start=0
    parts=res[:txt].split(@re_strange,-1)
    res[:inside].map do |e|
      txt << parts.shift
      txt << (e[:inside] ? rebuild_after_parse(e) : e[:txt])
    end
    txt << parts.shift
    txt
end

#update_tag_keyword(keyword, tags_set = [], args = {}) ⇒ Object

update an existing tag keywork (ex: document for html structure by adding #css #js #menu or anything needed in the model)



425
426
427
428
# File 'lib/dyndoc/base/scanner.rb', line 425

def update_tag_keyword(keyword,tags_set=[],args={})
  @tag_keyword[keyword] += tags_set
  @tag_blck[:keyword][keyword] += new_tags_set if args[:mode] && args[:mode] == :blck
end