Cut lazy HISTORY remark leaks from extracted descriptions

Three IFC2X3 type descriptions leaked HISTORY remark text that is not
wrapped in a blockquote in the source markdown: a literal "> HISTORY ..."
tail inside the definition paragraph (IfcEnergyMeasure,
IfcHeatFluxDensityMeasure) and an inline "HISTORY: ..." sentence
(IfcMetricValueSelect). Teach extract_full_description to skip leading
HISTORY paragraphs and cut at inline/lazy remark markers, and clean the
three affected data entries (all other descriptions unchanged).

Generated with the assistance of an AI coding tool.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Petru Conduraru
2026-07-12 15:13:18 +03:00
parent 5a7ab0ca68
commit 6490e3ffa9
2 changed files with 15 additions and 4 deletions
@@ -283,8 +283,19 @@ class DocExtractor:
items = [li.get_text() for li in child.find_all("li", recursive=False)] items = [li.get_text() for li in child.find_all("li", recursive=False)]
parts.append(" ".join(f"- {item}" for item in items)) parts.append(" ".join(f"- {item}" for item in items))
else: else:
parts.append(child.get_text()) part = child.get_text()
# Some IFC2X3 docs put the HISTORY remark in a plain leading
# paragraph rather than a blockquote; it is metadata, not part
# of the definition.
if re.match(r"\s*(HISTORY|IFC2x Edition)\b", part):
continue
parts.append(part)
text = " ".join(parts) text = " ".join(parts)
# A remark can also be a "lazy" blockquote continuation inside a
# paragraph (a literal "> HISTORY ..." tail that markdown does not
# turn into a <blockquote>) or an inline "HISTORY: ..." sentence; cut
# the definition there.
text = re.split(r"\s*(?:>\s*)?(?:HISTORY\s*:|>\s*HISTORY\b|(?:>\s*)?IFC2x Edition\b)", text)[0]
# strip inline kramdown/pandoc attribute-list markers that survive as literal # strip inline kramdown/pandoc attribute-list markers that survive as literal
# text once we're no longer limited to the first paragraph, e.g. # text once we're no longer limited to the first paragraph, e.g.
# "{ .change-ifc2x4}", "{ .note}", "{: .extDef}". # "{ .change-ifc2x4}", "{ .note}", "{: .extDef}".
@@ -416,7 +416,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcproductextension/lexical/ifcelementcompositionenum.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcproductextension/lexical/ifcelementcompositionenum.htm"
}, },
"IfcEnergyMeasure": { "IfcEnergyMeasure": {
"description": "A measure of energy required or used. Usually measured in Joules, (J, Nm). Type: REAL > HISTORY New type in IFC Release 2.0.", "description": "A measure of energy required or used. Usually measured in Joules, (J, Nm). Type: REAL",
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcmeasureresource/lexical/ifcenergymeasure.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcmeasureresource/lexical/ifcenergymeasure.htm"
}, },
"IfcEnergySequenceEnum": { "IfcEnergySequenceEnum": {
@@ -520,7 +520,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifchvacdomain/lexical/ifcheatexchangertypeenum.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifchvacdomain/lexical/ifcheatexchangertypeenum.htm"
}, },
"IfcHeatFluxDensityMeasure": { "IfcHeatFluxDensityMeasure": {
"description": "A measure of the density of heat flux within a body. Usually measured in W/m2 (J/s m2). Type: REAL > HISTORY New type in IFC Release 2.0.", "description": "A measure of the density of heat flux within a body. Usually measured in W/m2 (J/s m2). Type: REAL",
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcmeasureresource/lexical/ifcheatfluxdensitymeasure.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcmeasureresource/lexical/ifcheatfluxdensitymeasure.htm"
}, },
"IfcHeatingValueMeasure": { "IfcHeatingValueMeasure": {
@@ -696,7 +696,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcsharedbldgelements/lexical/ifcmembertypeenum.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcsharedbldgelements/lexical/ifcmembertypeenum.htm"
}, },
"IfcMetricValueSelect": { "IfcMetricValueSelect": {
"description": "An IfcMetricValueSelect is a select type that enables selection of the data type for the value component of an IfcMetric. HISTORY: New type in IFC Release 2.0 Select - IfcCostValue - IfcDateTimeSelect - IfcMetricBoundedValue - IfcMeasureWithUnit - IfcTable - IfcText - IfcTimeSeries", "description": "An IfcMetricValueSelect is a select type that enables selection of the data type for the value component of an IfcMetric.",
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcconstraintresource/lexical/ifcmetricvalueselect.htm" "spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcconstraintresource/lexical/ifcmetricvalueselect.htm"
}, },
"IfcMinuteInHour": { "IfcMinuteInHour": {