Changeset c26897a in sasmodels for doc/gentoc.py
- Timestamp:
- Jun 26, 2017 8:13:26 AM (7 years ago)
- Branches:
- master, core_shell_microgels, costrafo411, magnetic_model, ticket-1257-vesicle-product, ticket_1156, ticket_1265_superball, ticket_822_more_unit_tests
- Children:
- 870a2f4
- Parents:
- b52e00f (diff), c935936 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/gentoc.py
r40a87fa r990d8df 16 16 from sasmodels.modelinfo import ModelInfo 17 17 18 TEMPLATE ="""\18 TEMPLATE = """\ 19 19 .. 20 20 Generated from doc/gentoc.py -- DO NOT EDIT -- … … 30 30 """ 31 31 32 MODEL_TOC_PATH = " ref/models"32 MODEL_TOC_PATH = "guide/models" 33 33 34 34 def _make_category(category_name, label, title, parent=None): … … 65 65 # assume model is in sasmodels/models/name.py, and ignore the full path 66 66 model_name = basename(item)[:-3] 67 if model_name.startswith('_'): continue 67 if model_name.startswith('_'): 68 continue 68 69 model_info = load_model_info(model_name) 69 70 if model_info.category is None: 70 71 print("Missing category for", item, file=sys.stderr) 71 72 else: 72 category.setdefault(model_info.category, []).append(model_name)73 category.setdefault(model_info.category, []).append(model_name) 73 74 74 75 # Check category names 75 for k, v in category.items():76 for k, v in category.items(): 76 77 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) 78 79 79 80 # Generate category files for the table of contents. … … 86 87 # alphabetical order before them. 87 88 88 if not exists(MODEL_TOC_PATH): mkdir(MODEL_TOC_PATH) 89 if not exists(MODEL_TOC_PATH): 90 mkdir(MODEL_TOC_PATH) 89 91 model_toc = _make_category( 90 'index', 92 'index', 'Models', 'Model Functions') 91 93 #shape_toc = _make_category( 92 94 # 'shape', 'Shapes', 'Shape Functions', model_toc) 93 95 free_toc = _make_category( 94 'shape-independent', 96 'shape-independent', 'Shape-independent', 95 97 'Shape-Independent Functions') 96 98 struct_toc = _make_category( 97 'structure-factor', 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') 100 102 101 103 # remember to top level categories … … 105 107 'shape-independent':free_toc, 106 108 'structure-factor': struct_toc, 107 'custom': custom_toc,109 #'custom': custom_toc, 108 110 } 109 111 110 112 # Process the model lists 111 for k, v in sorted(category.items()):113 for k, v in sorted(category.items()): 112 114 if ':' in k: 113 cat, subcat = k.split(':')115 cat, subcat = k.split(':') 114 116 _maybe_make_category(cat, v, cat_files, model_toc) 115 117 cat_file = cat_files[cat] 116 label = "-".join((cat, subcat))118 label = "-".join((cat, subcat)) 117 119 filename = label 118 title = subcat.capitalize() +" Functions"120 title = subcat.capitalize() + " Functions" 119 121 sub_toc = _make_category(filename, label, title, cat_file) 120 122 for model in sorted(v): … … 130 132 _add_subcategory('shape-independent', model_toc) 131 133 _add_subcategory('structure-factor', model_toc) 132 _add_subcategory('custom-models', model_toc)134 #_add_subcategory('custom-models', model_toc) 133 135 134 136 # Close the top-level category files 135 137 #model_toc.close() 136 for f in cat_files.values(): f.close() 138 for f in cat_files.values(): 139 f.close() 137 140 138 141
Note: See TracChangeset
for help on using the changeset viewer.