Tools__TagList.st
changeset 11802 79d02540b382
parent 11801 18a705623785
child 11825 c84921788303
equal deleted inserted replaced
11801:18a705623785 11802:79d02540b382
  2648                 'textarea'      hideHTMLTextArea
  2648                 'textarea'      hideHTMLTextArea
  2649                 'input'         hideHTMLInput
  2649                 'input'         hideHTMLInput
  2650                 'table'         hideHTMLTable
  2650                 'table'         hideHTMLTable
  2651                 'script'        hideHTMLScript  
  2651                 'script'        hideHTMLScript  
  2652                 'form'          hideHTMLForm  
  2652                 'form'          hideHTMLForm  
       
  2653                 'a'             nil  
  2653                 'h1'            hideHTMLHeaders  
  2654                 'h1'            hideHTMLHeaders  
  2654                 'h2'            hideHTMLHeaders  
  2655                 'h2'            hideHTMLHeaders  
  2655                 'h3'            hideHTMLHeaders  
  2656                 'h3'            hideHTMLHeaders  
  2656                 'h4'            hideHTMLHeaders  
  2657                 'h4'            hideHTMLHeaders  
  2657                 'h5'            hideHTMLHeaders  
  2658                 'h5'            hideHTMLHeaders  
  2658                 'h6'            hideHTMLHeaders  
  2659                 'h6'            hideHTMLHeaders  
  2659             ) pairWiseDo:[:nm :hideInstVarName|
  2660             ) pairWiseDo:[:nm :hideInstVarName|
  2660                 |type hideHolder idx tagText doc markup label text markupName markupType|
  2661                 |type hideHolder idx tagText doc markup label text markupName markupType
       
  2662                  isHeader|
  2661 
  2663 
  2662                 type := hideHolder := nil.
  2664                 type := hideHolder := nil.
  2663 
  2665 
  2664                 idx := l indexOfSubCollection:('<',nm).
  2666                 idx := l indexOfSubCollection:('<',nm).
  2665                 idx ~~ 0 ifTrue:[
  2667                 idx ~~ 0 ifTrue:[
  2666                     type := Tag::TElement.
  2668                     hideHolder := hideInstVarName isNil 
  2667                     hideHolder := self instVarNamed:hideInstVarName.
  2669                                     ifTrue:[ false ]
       
  2670                                     ifFalse:[ self instVarNamed:hideInstVarName ].
  2668 
  2671 
  2669                     tagText := line copyFrom:idx.
  2672                     tagText := line copyFrom:idx.
  2670                     doc := HTMLParser new parseText:tagText.
  2673                     doc := HTMLParser new parseText:tagText.
  2671                     markup := doc markup.
  2674                     markup := doc markup.
  2672                     markupName := markup name.
  2675                     markupName := markup name.
  2673                     markupType := markup type.
  2676                     markupType := "markup tag ?" markup type.
       
  2677 
       
  2678                     isHeader := (#(h1 h2 h3 h4 h5 h6) includes:markupType).
       
  2679                     isHeader ifTrue:[ 
       
  2680                         type := Tag::THeaderElement  
       
  2681                     ] ifFalse: [ 
       
  2682                         markupType == #'form' ifTrue:[ 
       
  2683                             type := Tag::TFormElement
       
  2684                         ] ifFalse:[
       
  2685                             markupType == #'a' ifTrue:[ 
       
  2686                                 type := Tag::TAnchorElement.
       
  2687                                 markupName := markup hrefString notEmptyOrNil ifTrue:['"',markup hrefString,'"'] ifFalse:[ markup name ]
       
  2688                             ] ifFalse:[ 
       
  2689                                 type := Tag::TElement 
       
  2690                             ]
       
  2691                         ].
       
  2692                     ].
       
  2693 
  2674                     markup id notEmptyOrNil ifTrue:[
  2694                     markup id notEmptyOrNil ifTrue:[
  2675                         label := nm , ' (',markup id,')'
  2695                         label := nm , ' (',markup id,')'
  2676                     ] ifFalse:[
  2696                     ] ifFalse:[
  2677                         markupName notEmptyOrNil ifTrue:[
  2697                         markupName notEmptyOrNil ifTrue:[
  2678                             label := nm , ' (',markupName,')'
  2698                             label := nm , ' (',markupName,')'
  2679                         ] ifFalse:[
  2699                         ] ifFalse:[
  2680                             (markupType == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[
  2700                             (markupType == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[
  2681                                 label := nm , ' (',markup valueString,')'
  2701                                 label := nm , ' ("',markup valueString,'")'
  2682                             ] ifFalse:[
  2702                             ] ifFalse:[
  2683                                 (markupType == #script and:[ markup src notEmptyOrNil ]) ifTrue:[
  2703                                 (markupType == #script and:[ markup src notEmptyOrNil ]) ifTrue:[
  2684                                     label := nm , ' ("',markup src,'")'
  2704                                     label := nm , ' ("',markup src,'")'
  2685                                 ] ifFalse:[
  2705                                 ] ifFalse:[
  2686                                     ( (#(h1 h2 h3 h4 h5 h6) includes:markupType) 
  2706                                     ( isHeader 
  2687                                         and:[text := self plainTextBetweenHTMLElement:markup andElementWithTag:('/',markupType).
  2707                                           and:[text := self plainTextBetweenHTMLElement:markup andElementWithTag:('/',markupType).
  2688                                              text notEmpty 
  2708                                                text notEmpty] 
  2689                                     ]) ifTrue:[
  2709                                     ) ifTrue:[
  2690                                         label := '"',text,'" (',nm,')'
  2710                                         label := '"',text,'" (',nm,')'
  2691                                     ] ifFalse:[
  2711                                     ] ifFalse:[
  2692                                          label := nm
  2712                                          label := nm
  2693                                     ]
  2713                                     ]
  2694                                 ]
  2714                                 ]
  2710         s close
  2730         s close
  2711     ].
  2731     ].
  2712     ^ targets
  2732     ^ targets
  2713 
  2733 
  2714     "Created: / 20-04-2011 / 18:59:29 / cg"
  2734     "Created: / 20-04-2011 / 18:59:29 / cg"
  2715     "Modified: / 12-09-2012 / 12:47:06 / cg"
  2735     "Modified: / 12-09-2012 / 17:54:07 / cg"
  2716 !
  2736 !
  2717 
  2737 
  2718 javaScriptTagsInFile:aFilePath
  2738 javaScriptTagsInFile:aFilePath
  2719     "javaScript tags:
  2739     "javaScript tags:
  2720      naive, q&d scan for lines matching:
  2740      naive, q&d scan for lines matching:
  3557 ! !
  3577 ! !
  3558 
  3578 
  3559 !TagList class methodsFor:'documentation'!
  3579 !TagList class methodsFor:'documentation'!
  3560 
  3580 
  3561 version
  3581 version
  3562     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.17 2012-09-12 10:49:17 cg Exp $'
  3582     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.18 2012-09-12 15:59:53 cg Exp $'
  3563 !
  3583 !
  3564 
  3584 
  3565 version_CVS
  3585 version_CVS
  3566     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.17 2012-09-12 10:49:17 cg Exp $'
  3586     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.18 2012-09-12 15:59:53 cg Exp $'
  3567 !
  3587 !
  3568 
  3588 
  3569 version_SVN
  3589 version_SVN
  3570     ^ '§Id§'
  3590     ^ '§Id§'
  3571 ! !
  3591 ! !