Changeset 7bb290c in sasmodels


Ignore:
Timestamp:
Dec 1, 2015 12:41:57 PM (8 years ago)
Author:
Paul Kienzle <pkienzle@…>
Branches:
master, core_shell_microgels, costrafo411, magnetic_model, release_v0.94, release_v0.95, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
Children:
9404dd3
Parents:
e88bb78
Message:

adjust table of contents so models are only three levels deep

Location:
doc
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • doc/Makefile

    r402c351 r7bb290c  
    8585 
    8686clean: 
    87         -$(RMDIR) _build model api 
     87        -$(RMDIR) _build model api ref/models 
    8888 
    8989html: build 
  • doc/gentoc.py

    r61ba623 r7bb290c  
    2828    file.write(TEMPLATE%{'label':label, 'title':title, 'bar':'*'*len(title)}) 
    2929    if parent: 
    30         _add_subcategory(parent, category_name) 
     30        _add_subcategory(category_name, parent) 
    3131    return file 
    3232 
    33 def _add_subcategory(file, category_name): 
    34     file.write("    %s.rst\n"%category_name) 
     33def _add_subcategory(category_name, parent): 
     34    parent.write("    %s.rst\n"%category_name) 
    3535 
    3636def _add_model(file, model_name): 
    3737    file.write("    ../../model/%s.rst\n"%model_name) 
     38 
     39def _maybe_make_category(category, models, cat_files, model_toc): 
     40    if category not in cat_files: 
     41        print >>sys.stderr, "Unexpected category %s containing"%category, models 
     42        title = category.capitalize()+" Functions" 
     43        cat_files[category] = _make_category(category, category, title, model_toc) 
    3844 
    3945def generate_toc(model_files): 
     
    5864            print >>sys.stderr, "Category %s contains only %s"%(k,v[0]) 
    5965 
    60     # Generate category files 
    61     # Assume that top-level groups are: 
    62     #    shape, shape-independent, structure-factor and custom 
    63     # Supports a two-level category structure. 
     66    # Generate category files for the table of contents. 
     67    # Initially we had "shape functions" as an additional TOC level, but we 
     68    # have revised it so that the individual shape categories now go at 
     69    # the top level.  Judicious rearrangement of comments will make the 
     70    # "shape functions" level reappear. 
     71    # We are forcing shape-independent, structure-factor and custom-models 
     72    # to come at the end of the TOC.  All other categories will come in 
     73    # alphabetical order before them. 
    6474 
    6575    if not exists(MODEL_TOC_PATH): mkdir(MODEL_TOC_PATH) 
    6676    model_toc = _make_category( 
    6777        'index',  'Models', 'Model Functions') 
    68     shape_toc = _make_category( 
    69         'shape',  'Shapes', 'Shape Functions', model_toc) 
     78    #shape_toc = _make_category( 
     79    #    'shape',  'Shapes', 'Shape Functions', model_toc) 
    7080    free_toc = _make_category( 
    7181        'shape-independent',  'Shape-independent', 
    72         'Shape-Independent Functions', model_toc) 
     82        'Shape-Independent Functions') 
    7383    struct_toc = _make_category( 
    74         'structure-factor',  'Structure-factor', 'Structure Factors', model_toc) 
     84        'structure-factor',  'Structure-factor', 'Structure Factors') 
    7585    custom_toc = _make_category( 
    76         'custom-models',  'Custom-models', 'Custom Models', model_toc) 
    77     model_toc.close() 
     86        'custom-models',  'Custom-models', 'Custom Models') 
    7887 
    7988    # remember to top level categories 
    8089    cat_files = { 
    81         'shape':shape_toc, 
     90        #'shape':shape_toc, 
     91        'shape':model_toc, 
    8292        'shape-independent':free_toc, 
    8393        'structure-factor': struct_toc, 
     
    8999        if ':' in k: 
    90100            cat,subcat = k.split(':') 
     101            _maybe_make_category(cat, v, cat_files, model_toc) 
    91102            cat_file = cat_files[cat] 
    92103            label = "-".join((cat,subcat)) 
     
    98109            sub_toc.close() 
    99110        else: 
    100             if k not in cat_files: 
    101                 print >>sys.stderr, "Unknown category %s containing"%cat, v 
    102             else: 
    103                 cat_file = cat_files[k] 
    104                 for model in sorted(v): 
    105                     _add_model(cat_file, model) 
     111            _maybe_make_category(k, v, cat_files, model_toc) 
     112            cat_file = cat_files[k] 
     113            for model in sorted(v): 
     114                _add_model(cat_file, model) 
     115 
     116    #_add_subcategory('shape', model_toc) 
     117    _add_subcategory('shape-independent', model_toc) 
     118    _add_subcategory('structure-factor', model_toc) 
     119    _add_subcategory('custom-models', model_toc) 
    106120 
    107121    # Close the top-level category files 
     122    #model_toc.close() 
    108123    for f in cat_files.values(): f.close() 
    109124 
  • doc/index.rst

    rd138d43 r7bb290c  
    1212.. toctree:: 
    1313   :numbered: 
    14    :maxdepth: 5 
     14   :maxdepth: 4 
    1515 
    1616   guide/index.rst 
    1717   developer/index.rst 
    1818   ref/index.rst 
     19   ref/models/index.rst 
    1920   api/index.rst 
    2021 
  • doc/ref/index.rst

    r61ba623 r7bb290c  
    88 
    99   intro.rst 
    10    models/index.rst 
    1110   refs.rst 
Note: See TracChangeset for help on using the changeset viewer.