settings
NavEntry
Bases: NamedTuple
Source code in mkreports/settings.py
15 16 17 18 19 20 21 22 23 24 25 |
|
ReportSettings
Bases: MutableMapping
Source code in mkreports/settings.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
__setitem__(key, value)
Assign key to value, but also save to yaml-file.
Source code in mkreports/settings.py
226 227 228 229 |
|
add_nav_entry(mkdocs_settings, nav_entry)
Add an additional entry to the Nav in mkdocs.yml
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mkdocs_settings |
The mkdocs settings to update. |
required | |
nav_entry |
NavEntry
|
The NavEntry to add |
required |
Returns:
Type | Description |
---|---|
Any
|
The updated mkdocs_settings |
Source code in mkreports/settings.py
143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
load_yaml(file)
Load a yaml file, return empty dict if not exists.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
file |
Path
|
File to load |
required |
Returns:
Type | Description |
---|---|
Any
|
The value in the file, empty dict otherwise. |
Source code in mkreports/settings.py
164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 |
|
mkdocs_to_navlist(mkdocs_nav)
Convert an mkdocs nav to a list of NavEntry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
mkdocs_nav |
MkdocsNav
|
A python representation of the nav-entry in the mkdocs.yml file. |
required |
Source code in mkreports/settings.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
navlist_to_mkdocs(nav_list)
Convert a list of nav-entries into mkdocs format.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
nav |
Nav
|
The list of NavEntry to convert to mkdocs.yml format |
required |
Returns:
Type | Description |
---|---|
MkdocsNav
|
Python object of the mkdocs.yml nav entry. |
Source code in mkreports/settings.py
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 |
|
path_to_nav_entry(path)
Turn a file path into a NavEntry.
The path is split, each part of the path used as an element of the hierarchy. Snake-case are split into words with first letters capitalized.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path |
Path
|
The path relative to the report docs folder to turn into a nav-entry. |
required |
Returns:
Name | Type | Description |
---|---|---|
NavEntry |
NavEntry
|
The NavEntry object representing the path and the hierarchy of navigation entries. |
Source code in mkreports/settings.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
save_yaml(obj, file)
Save object to yaml file.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
Any
|
The object to save. |
required |
file |
Path
|
Filename to save it into. |
required |
Source code in mkreports/settings.py
184 185 186 187 188 189 190 191 192 193 |
|
split_nav(x)
Split the navigation entry into top level list of items and dict of Navs.
Given a nav-entry, each top-level item that is not a hierarchy itself is added to the return list. Every hierarchy will have its top level removed and entered into a dict, with the top-level hierarchy name as the key and the sub-nav as the value.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x |
Nav
|
The list of NavEntry to process |
required |
Returns:
Type | Description |
---|---|
Tuple[List[str], Dict[str, NavList]]
|
Tuple[List[str], Dict[str, Nav]]: Structure as explained above. |
Source code in mkreports/settings.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|