Glyph - Macro Statistics

Displaying stats about all macros

To display statistics about all macros, execute glyph stats --macros. Glyph displays something like this:

 1===== Macros
 2-- Total Macro Instances: 2497
 3-- Total Macro Definitions: 65
 4-- Total Macro Aliases: 57
 5-- Total Used Macro Definitions: 56
 6-- Macro Definitions:
 7     #>            $>            %>            alias:        aliases       
 8     anchor        and           article       author        block_example 
 9     book          box           class         codeblock     comment       
10     condition     config        config:       config_table  default       
11     document      draftcomment  eq            error_table   escape        
12     example       examples      features      figure        fmi           
13     head          highlight     image         include       issue         
14     link          macro:        markdown      match         navigation    
15     not           note          option        or            parameters    
16     pubdate       ref_config    ref_error     ref_macro     release       
17     revision      rewrite:      ruby          section       snippet       
18     snippet:      stats_for     style         subtitle      textile       
19     title         toc           todo          values        |xml|         
20
21-- Used Macro Definitions:
22     #>            $>            %>            aliases       anchor        
23     and           author        block_example book          box           
24     class         codeblock     comment       condition     config        
25     config_table  default       document      eq            error_table   
26     escape        example       examples      features      figure        
27     fmi           head          highlight     image         include       
28     issue         link          note          option        or            
29     parameters    pubdate       ref_config    ref_error     ref_macro     
30     release       revision      rewrite:      ruby          section       
31     snippet       snippet:      stats_for     style         subtitle      
32     textile       title         toc           todo          values        
33     |xml|

Remarks

  • Only macro definitions (not their aliases) are displayed, both default and user-defined.
  • The |xml| macro is a special macro used if the options.xml_fallback setting is enabled.
  • There’s no distinction between macros defined by the user and macros defined by Glyph itself.

Displaying stats about a single macro

To display statistics about a single macro (e.g. note), execute glyph stats --macro=note. Glyph displays something like this:

 1===== Macro 'note' 
 2-- Total Instances: 18
 3-- Occurrences:
 4   - text/compiling/compiling.glyph (2)
 5   - text/compiling/programmatic_usage.glyph (1)
 6   - text/extending/params_attrs.glyph (1)
 7   - text/getting_started/configuration.glyph (1)
 8   - text/stats/macros.glyph (2)
 9   - text/text_editing/attribute_intro.glyph (1)
10   - text/text_editing/esc_quot.glyph (1)
11   - text/text_editing/images.glyph (1)
12   - text/text_editing/inclusions.glyph (3)
13   - text/text_editing/links.glyph (1)
14   - text/text_editing/raw_html.glyph (1)
15   - text/text_editing/section_aliases.glyph (1)
16   - text/text_editing/xml_fallback.glyph (2)

Remarks

  • All the instances of the specified macro definition and all its aliases are collected, regardless whether a definition or an alias is specified.
  • If you use custom macros, make sure they call the Macro#update_source appropriately method if necessary.
  • If macros are used within rewritten macros, they’ll be also listed in each file where the rewritten macro is used.