let par_hdr_opt (doc_settings : t_doc_settings) (cref_table : t_cref_table) (nte_table : t_nte_table) (path : t_path) (tag_or_id_opt : tu_tag_or_id option) (hdr_opt : ts_hdr option) : (Xml.xml list) option=
let tag_content_opt : (Xml.xml list) option =
match tag_or_id_opt with
|Some (tag_or_id : tu_tag_or_id) -> (
match tag_or_id with
|Cu_tag_or_id_tag (tag : ts_tag)
|Cu_tag_or_id_id { fld_id_tag = (tag : ts_tag); fld_id_name = _ } ->
match doc_settings.expand_tag tag with
| Some (lbl,_) -> Some [xml_of_string lbl]
| None -> None
)
| None -> None
in
let hdr_content_opt : (Xml.xml list) option =
match hdr_opt with
|None -> None
|Some (Cs_hdr (txt_units : ts_txt_units)) ->
Some (xml_list_of_ts_txt_units doc_settings cref_table nte_table path txt_units)
in
match tag_content_opt, hdr_content_opt with
|Some tag_content, Some hdr_content ->
Some [Xml.Element ("par_tag",[],tag_content);Xml.Element ("par_hdr",[],hdr_content)]
|None, Some hdr_content ->
Some [Xml.Element ("par_hdr",[],hdr_content)]
|Some tag_content, None ->
Some [Xml.Element ("par_tag_hdr",[],tag_content)]
|None, None -> None