Changes in doc/gentoc.py [40a87fa:990d8df] in sasmodels


Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • doc/gentoc.py

    r40a87fa r990d8df  
    1616    from sasmodels.modelinfo import ModelInfo 
    1717 
    18 TEMPLATE="""\ 
     18TEMPLATE = """\ 
    1919.. 
    2020    Generated from doc/gentoc.py -- DO NOT EDIT -- 
     
    3030""" 
    3131 
    32 MODEL_TOC_PATH = "ref/models" 
     32MODEL_TOC_PATH = "guide/models" 
    3333 
    3434def _make_category(category_name, label, title, parent=None): 
     
    6565        # assume model is in sasmodels/models/name.py, and ignore the full path 
    6666        model_name = basename(item)[:-3] 
    67         if model_name.startswith('_'): continue 
     67        if model_name.startswith('_'): 
     68            continue 
    6869        model_info = load_model_info(model_name) 
    6970        if model_info.category is None: 
    7071            print("Missing category for", item, file=sys.stderr) 
    7172        else: 
    72             category.setdefault(model_info.category,[]).append(model_name) 
     73            category.setdefault(model_info.category, []).append(model_name) 
    7374 
    7475    # Check category names 
    75     for k,v in category.items(): 
     76    for k, v in category.items(): 
    7677        if len(v) == 1: 
    77             print("Category %s contains only %s"%(k,v[0]), file=sys.stderr) 
     78            print("Category %s contains only %s"%(k, v[0]), file=sys.stderr) 
    7879 
    7980    # Generate category files for the table of contents. 
     
    8687    # alphabetical order before them. 
    8788 
    88     if not exists(MODEL_TOC_PATH): mkdir(MODEL_TOC_PATH) 
     89    if not exists(MODEL_TOC_PATH): 
     90        mkdir(MODEL_TOC_PATH) 
    8991    model_toc = _make_category( 
    90         'index',  'Models', 'Model Functions') 
     92        'index', 'Models', 'Model Functions') 
    9193    #shape_toc = _make_category( 
    9294    #    'shape',  'Shapes', 'Shape Functions', model_toc) 
    9395    free_toc = _make_category( 
    94         'shape-independent',  'Shape-independent', 
     96        'shape-independent', 'Shape-independent', 
    9597        'Shape-Independent Functions') 
    9698    struct_toc = _make_category( 
    97         'structure-factor',  'Structure-factor', 'Structure Factors') 
    98     custom_toc = _make_category( 
    99         'custom-models', 'Custom-models', 'Custom Models') 
     99        'structure-factor', 'Structure-factor', 'Structure Factors') 
     100    #custom_toc = _make_category( 
     101    #    'custom-models', 'Custom-models', 'Custom Models') 
    100102 
    101103    # remember to top level categories 
     
    105107        'shape-independent':free_toc, 
    106108        'structure-factor': struct_toc, 
    107         'custom': custom_toc, 
     109        #'custom': custom_toc, 
    108110        } 
    109111 
    110112    # Process the model lists 
    111     for k,v in sorted(category.items()): 
     113    for k, v in sorted(category.items()): 
    112114        if ':' in k: 
    113             cat,subcat = k.split(':') 
     115            cat, subcat = k.split(':') 
    114116            _maybe_make_category(cat, v, cat_files, model_toc) 
    115117            cat_file = cat_files[cat] 
    116             label = "-".join((cat,subcat)) 
     118            label = "-".join((cat, subcat)) 
    117119            filename = label 
    118             title = subcat.capitalize()+" Functions" 
     120            title = subcat.capitalize() + " Functions" 
    119121            sub_toc = _make_category(filename, label, title, cat_file) 
    120122            for model in sorted(v): 
     
    130132    _add_subcategory('shape-independent', model_toc) 
    131133    _add_subcategory('structure-factor', model_toc) 
    132     _add_subcategory('custom-models', model_toc) 
     134    #_add_subcategory('custom-models', model_toc) 
    133135 
    134136    # Close the top-level category files 
    135137    #model_toc.close() 
    136     for f in cat_files.values(): f.close() 
     138    for f in cat_files.values(): 
     139        f.close() 
    137140 
    138141 
Note: See TracChangeset for help on using the changeset viewer.