Tools__TagList.st
changeset 11801 18a705623785
parent 11771 c33eb1a7f489
child 11802 79d02540b382
equal deleted inserted replaced
11800:afee283f9636 11801:18a705623785
    24 		hideLispMethods hideLispConstants hideLocalLabels
    24 		hideLispMethods hideLispConstants hideLocalLabels
    25 		hideLocalLabels2 hideDataLabels hideTextLabels tagTypesPresent
    25 		hideLocalLabels2 hideDataLabels hideTextLabels tagTypesPresent
    26 		hidePythonClasses hidePythonMethods hidePythonFunctions
    26 		hidePythonClasses hidePythonMethods hidePythonFunctions
    27 		hideOzClasses hideOzMethods hideOzFunctions hideHTMLTextArea
    27 		hideOzClasses hideOzMethods hideOzFunctions hideHTMLTextArea
    28 		hideHTMLInput hideHTMLTable hideHTMLScript hideHTMLForm
    28 		hideHTMLInput hideHTMLTable hideHTMLScript hideHTMLForm
    29 		usingDefaultCTags ctagsCommand ctagsIsExCtags ctagsIsExCtags5x
    29 		hideHTMLHeaders usingDefaultCTags ctagsCommand ctagsIsExCtags
    30 		hideDocumentation remoteTarget hideLocalLabels3'
    30 		ctagsIsExCtags5x hideDocumentation remoteTarget hideLocalLabels3'
    31 	classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly
    31 	classVariableNames:'Sorted CachedTagListsPerFile DefaultSortCriteria DefaultShowOnly
    32 		TagsSuffixes DefaultGroupBy'
    32 		TagsSuffixes DefaultGroupBy'
    33 	poolDictionaries:''
    33 	poolDictionaries:''
    34 	category:'Interface-Tools-File-Tags'
    34 	category:'Interface-Tools-File-Tags'
    35 !
    35 !
   807 
   807 
   808 hideFunctions:aBoolean
   808 hideFunctions:aBoolean
   809     hideFunctions := aBoolean.
   809     hideFunctions := aBoolean.
   810 
   810 
   811     "Modified: / 05-05-2011 / 15:22:18 / cg"
   811     "Modified: / 05-05-2011 / 15:22:18 / cg"
       
   812 !
       
   813 
       
   814 hideHTMLHeaders
       
   815     ^ hideHTMLHeaders ? false
       
   816 
       
   817     "Created: / 12-09-2012 / 12:29:45 / cg"
       
   818 !
       
   819 
       
   820 hideHTMLHeaders:aBoolean
       
   821     hideHTMLHeaders := aBoolean.
       
   822 
       
   823     "Created: / 12-09-2012 / 12:29:52 / cg"
   812 !
   824 !
   813 
   825 
   814 hideHTMLInput
   826 hideHTMLInput
   815     ^ hideHTMLInput ? false
   827     ^ hideHTMLInput ? false
   816 
   828 
  2611      naive, q&d scan for lines containing with:
  2623      naive, q&d scan for lines containing with:
  2612         <textarea>
  2624         <textarea>
  2613         <input>
  2625         <input>
  2614         <table>
  2626         <table>
  2615         <script>
  2627         <script>
       
  2628         <hX>
  2616     "
  2629     "
  2617 
  2630 
  2618     |targets line l lineNr s tag|
  2631     |targets line l lineNr s tag|
  2619 
  2632 
  2620     "/ TODO: use HTMPParser to read all of them !!
  2633     "/ TODO: use HTMPParser to read all of them !!
  2635                 'textarea'      hideHTMLTextArea
  2648                 'textarea'      hideHTMLTextArea
  2636                 'input'         hideHTMLInput
  2649                 'input'         hideHTMLInput
  2637                 'table'         hideHTMLTable
  2650                 'table'         hideHTMLTable
  2638                 'script'        hideHTMLScript  
  2651                 'script'        hideHTMLScript  
  2639                 'form'          hideHTMLForm  
  2652                 'form'          hideHTMLForm  
       
  2653                 'h1'            hideHTMLHeaders  
       
  2654                 'h2'            hideHTMLHeaders  
       
  2655                 'h3'            hideHTMLHeaders  
       
  2656                 'h4'            hideHTMLHeaders  
       
  2657                 'h5'            hideHTMLHeaders  
       
  2658                 'h6'            hideHTMLHeaders  
  2640             ) pairWiseDo:[:nm :hideInstVarName|
  2659             ) pairWiseDo:[:nm :hideInstVarName|
  2641                 |type hideHolder idx tagText doc markup label|
  2660                 |type hideHolder idx tagText doc markup label text markupName markupType|
  2642 
  2661 
  2643                 type := hideHolder := nil.
  2662                 type := hideHolder := nil.
  2644 
  2663 
  2645                 idx := l indexOfSubCollection:('<',nm).
  2664                 idx := l indexOfSubCollection:('<',nm).
  2646                 idx ~~ 0 ifTrue:[
  2665                 idx ~~ 0 ifTrue:[
  2648                     hideHolder := self instVarNamed:hideInstVarName.
  2667                     hideHolder := self instVarNamed:hideInstVarName.
  2649 
  2668 
  2650                     tagText := line copyFrom:idx.
  2669                     tagText := line copyFrom:idx.
  2651                     doc := HTMLParser new parseText:tagText.
  2670                     doc := HTMLParser new parseText:tagText.
  2652                     markup := doc markup.
  2671                     markup := doc markup.
       
  2672                     markupName := markup name.
       
  2673                     markupType := markup type.
  2653                     markup id notEmptyOrNil ifTrue:[
  2674                     markup id notEmptyOrNil ifTrue:[
  2654                         label := nm , ' (',markup id,')'
  2675                         label := nm , ' (',markup id,')'
  2655                     ] ifFalse:[
  2676                     ] ifFalse:[
  2656                         markup name notEmptyOrNil ifTrue:[
  2677                         markupName notEmptyOrNil ifTrue:[
  2657                             label := nm , ' (',markup name,')'
  2678                             label := nm , ' (',markupName,')'
  2658                         ] ifFalse:[
  2679                         ] ifFalse:[
  2659                             (markup type == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[
  2680                             (markupType == #input and:[ markup valueString notEmptyOrNil ]) ifTrue:[
  2660                                 label := nm , ' (',markup valueString,')'
  2681                                 label := nm , ' (',markup valueString,')'
  2661                             ] ifFalse:[
  2682                             ] ifFalse:[
  2662                                 (markup type == #script and:[ markup src notEmptyOrNil ]) ifTrue:[
  2683                                 (markupType == #script and:[ markup src notEmptyOrNil ]) ifTrue:[
  2663                                     label := nm , ' ("',markup src,'")'
  2684                                     label := nm , ' ("',markup src,'")'
  2664                                 ] ifFalse:[
  2685                                 ] ifFalse:[
  2665                                      label := nm
  2686                                     ( (#(h1 h2 h3 h4 h5 h6) includes:markupType) 
       
  2687                                         and:[text := self plainTextBetweenHTMLElement:markup andElementWithTag:('/',markupType).
       
  2688                                              text notEmpty 
       
  2689                                     ]) ifTrue:[
       
  2690                                         label := '"',text,'" (',nm,')'
       
  2691                                     ] ifFalse:[
       
  2692                                          label := nm
       
  2693                                     ]
  2666                                 ]
  2694                                 ]
  2667                             ]
  2695                             ]
  2668                         ].
  2696                         ].
  2669                     ].
  2697                     ].
  2670 
       
  2671 
  2698 
  2672                     hideHolder value ~~ true ifTrue:[
  2699                     hideHolder value ~~ true ifTrue:[
  2673                         tag := type 
  2700                         tag := type 
  2674                                     label:label 
  2701                                     label:label 
  2675                                     pattern:nil
  2702                                     pattern:nil
  2683         s close
  2710         s close
  2684     ].
  2711     ].
  2685     ^ targets
  2712     ^ targets
  2686 
  2713 
  2687     "Created: / 20-04-2011 / 18:59:29 / cg"
  2714     "Created: / 20-04-2011 / 18:59:29 / cg"
  2688     "Modified: / 07-05-2011 / 17:04:53 / cg"
  2715     "Modified: / 12-09-2012 / 12:47:06 / cg"
  2689 !
  2716 !
  2690 
  2717 
  2691 javaScriptTagsInFile:aFilePath
  2718 javaScriptTagsInFile:aFilePath
  2692     "javaScript tags:
  2719     "javaScript tags:
  2693      naive, q&d scan for lines matching:
  2720      naive, q&d scan for lines matching:
  3101         s close
  3128         s close
  3102     ].
  3129     ].
  3103     ^ targets
  3130     ^ targets
  3104 !
  3131 !
  3105 
  3132 
       
  3133 plainTextBetweenHTMLElement:startElement andElementWithTag:endTag
       
  3134     "applied to an <h1>-tag element, passing '/h1' as endTag,
       
  3135      this retrieves the plain text of the headline. Used by the tag list."
       
  3136 
       
  3137     |el collector hasSpace txt|
       
  3138 
       
  3139     collector := WriteStream on:(String new:100).
       
  3140     el := startElement next.
       
  3141     hasSpace := true.
       
  3142     [el tag ~= endTag] whileTrue:[
       
  3143         el isTextElement ifTrue:[
       
  3144             hasSpace ifFalse:[
       
  3145                 collector space.
       
  3146                 hasSpace := true.
       
  3147             ].
       
  3148             txt := el text withoutSeparators.
       
  3149             txt notEmpty ifTrue:[
       
  3150                 collector nextPutAll:txt.
       
  3151                 hasSpace := txt endsWith:' '.
       
  3152             ]
       
  3153         ].
       
  3154         el := el next
       
  3155     ].
       
  3156     ^ collector contents
       
  3157 
       
  3158     "Created: / 12-09-2012 / 12:38:01 / cg"
       
  3159 !
       
  3160 
  3106 prologTagsInFile:aFilePath
  3161 prologTagsInFile:aFilePath
  3107     "prolog tags:
  3162     "prolog tags:
  3108      naive, q&d scan for lines matching:
  3163      naive, q&d scan for lines matching:
  3109         <anything> :-
  3164         <anything> :-
  3110     "
  3165     "
  3502 ! !
  3557 ! !
  3503 
  3558 
  3504 !TagList class methodsFor:'documentation'!
  3559 !TagList class methodsFor:'documentation'!
  3505 
  3560 
  3506 version
  3561 version
  3507     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.16 2012-08-23 21:21:31 cg Exp $'
  3562     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.17 2012-09-12 10:49:17 cg Exp $'
  3508 !
  3563 !
  3509 
  3564 
  3510 version_CVS
  3565 version_CVS
  3511     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.16 2012-08-23 21:21:31 cg Exp $'
  3566     ^ '$Header: /cvs/stx/stx/libtool/Tools__TagList.st,v 1.17 2012-09-12 10:49:17 cg Exp $'
  3512 !
  3567 !
  3513 
  3568 
  3514 version_SVN
  3569 version_SVN
  3515     ^ '§Id§'
  3570     ^ '§Id§'
  3516 ! !
  3571 ! !