catalog_merger
trestle.core.catalog.catalog_merger
¤
Provide interface to merge one catalog to another.
Attributes¤
logger = logging.getLogger(__name__)
module-attribute
¤
Classes¤
CatalogMerger
¤
Catalog merger.
Catalog merger handles all operations related to merging contents of one catalog to another.
Source code in trestle/core/catalog/catalog_merger.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 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 89 90 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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
|
Functions¤
__init__(catalog_interface)
¤
Initialize catalog merger.
Source code in trestle/core/catalog/catalog_merger.py
40 41 42 |
|
merge_catalog(catalog, replace_params)
¤
Merge the provided new catalog controls into the original catalog in this catalog interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
catalog
|
Catalog
|
catalog containing controls that are merged into the current catalog of the interface |
required |
replace_params
|
bool
|
replace all params in the control with the new ones |
required |
Notes
This is mainly to support the reading of a catalog from markdown. It allows retention of content such as metadata and backmatter, along with labels and other parameter attributes that aren't in markdown. The list of controls and group structure is specified by the markdown structure - but this doesn't allow controls to contain controls. Group lists are specified per directory.
Reading the markdown tells you groups and controls in them - and groups in groups. Controls cannot change groups. If the control was in the original json, its parts are replaced, including its parameters. Only values may be specified. If no value specified, the value is unset in json.
Source code in trestle/core/catalog/catalog_merger.py
58 59 60 61 62 63 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 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
merge_controls(dest, src, replace_params)
staticmethod
¤
Merge the src control into dest.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dest
|
Control
|
destination control into which content will be added |
required |
src
|
Control
|
source control with new content |
required |
replace_params
|
bool
|
replace the control params with the new ones |
required |
Source code in trestle/core/catalog/catalog_merger.py
44 45 46 47 48 49 50 51 52 53 54 55 56 |
|
Functions¤
handler: python