shared_funcs submodule¶
This module contains few functions shared across whole package.
- marcxml2mods.mods_postprocessor.shared_funcs.insert_tag(tag, before, root)¶
Insert tag before before tag if present. If not, insert it into root.
Parameters: - tag (obj) – HTMLElement instance.
- before (obj) – HTMLElement instance.
- root (obj) – HTMLElement instance.
- marcxml2mods.mods_postprocessor.shared_funcs.transform_content(tags, content_transformer)¶
Transform content in all tags using result of content_transformer(tag) call.
Parameters: - tags (obj/list) – HTMLElement instance, or list of HTMLElement instances.
- content_transformer (function) – Function which is called as content_transformer(tag).
- marcxml2mods.mods_postprocessor.shared_funcs.double_linked_dom(str_or_dom)¶
Create double linked DOM from input.
In case of string, parse it, make it double-linked. In case of DOM, just make it double-linked.
Parameters: str_or_dom (str/HTMLelement) – String or HTMLelement instance. Returns: HTMLelement with parsed, double-linked content from str_or_dom. Return type: obj