From 6490e3ffa9aa228371e8b970e7787cb7c2db9e40 Mon Sep 17 00:00:00 2001 From: Petru Conduraru Date: Sun, 12 Jul 2026 15:13:18 +0300 Subject: [PATCH] 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 --- src/ifcopenshell-python/ifcopenshell/util/doc.py | 13 ++++++++++++- .../ifcopenshell/util/schema/ifc2x3_types.json | 6 +++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/ifcopenshell-python/ifcopenshell/util/doc.py b/src/ifcopenshell-python/ifcopenshell/util/doc.py index be780c0bd8..cd13f26f04 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/doc.py +++ b/src/ifcopenshell-python/ifcopenshell/util/doc.py @@ -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
) 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}". diff --git a/src/ifcopenshell-python/ifcopenshell/util/schema/ifc2x3_types.json b/src/ifcopenshell-python/ifcopenshell/util/schema/ifc2x3_types.json index 3c8403c259..9818f3a41a 100644 --- a/src/ifcopenshell-python/ifcopenshell/util/schema/ifc2x3_types.json +++ b/src/ifcopenshell-python/ifcopenshell/util/schema/ifc2x3_types.json @@ -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": {