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)]
parts.append(" ".join(f"- {item}" for item in items))
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)
# 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
# text once we're no longer limited to the first paragraph, e.g.
# "{ .change-ifc2x4}", "{ .note}", "{: .extDef}".
@@ -416,7 +416,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcproductextension/lexical/ifcelementcompositionenum.htm"
},
"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"
},
"IfcEnergySequenceEnum": {
@@ -520,7 +520,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifchvacdomain/lexical/ifcheatexchangertypeenum.htm"
},
"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"
},
"IfcHeatingValueMeasure": {
@@ -696,7 +696,7 @@
"spec_url": "https://standards.buildingsmart.org/IFC/RELEASE/IFC2x3/TC1/HTML/ifcsharedbldgelements/lexical/ifcmembertypeenum.htm"
},
"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"
},
"IfcMinuteInHour": {