UNPKG

@xpack/docusaurus-plugin-doxygen

Version:

A Docusaurus plugin to integrate Doxygen into a Docusaurus project.

80 lines 3.86 kB
/* * This file is part of the xPack project (http://xpack.github.io). * Copyright (c) 2025 Liviu Ionescu. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software * for any purpose is hereby granted, under the terms of the MIT license. * * If a copy of the license was not distributed with this file, it can * be obtained from https://opensource.org/licenses/MIT. */ // ---------------------------------------------------------------------------- import assert from 'assert'; import * as util from 'node:util'; import { AbstractDataModelBase } from '../types.js'; // ---------------------------------------------------------------------------- // <xsd:complexType name="compoundRefType"> // <xsd:simpleContent> // <xsd:extension base="xsd:string"> // <xsd:attribute name="refid" type="xsd:string" use="optional" /> // <xsd:attribute name="prot" type="DoxProtectionKind" /> // <xsd:attribute name="virt" type="DoxVirtualKind" /> // </xsd:extension> // </xsd:simpleContent> // </xsd:complexType> export class AbstractCompoundRefType extends AbstractDataModelBase { constructor(xml, element, elementName) { super(elementName); // Mandatory elements. this.text = ''; // Passed as element text. // Mandatory attributes. this.prot = ''; this.virt = ''; // console.log(elementName, util.inspect(element, { compact: false, depth: 999 })) // ------------------------------------------------------------------------ // Process elements. assert(xml.isInnerElementText(element, elementName)); this.text = xml.getInnerElementText(element, elementName); assert(this.text.length > 0); // ------------------------------------------------------------------------ // Process attributes. assert(xml.hasAttributes(element)); const attributesNames = xml.getAttributesNames(element); for (const attributeName of attributesNames) { if (attributeName === '@_prot') { this.prot = xml.getAttributeStringValue(element, '@_prot'); } else if (attributeName === '@_virt') { this.virt = xml.getAttributeStringValue(element, '@_virt'); } else if (attributeName === '@_refid') { this.refid = xml.getAttributeStringValue(element, '@_refid'); } else { console.error(util.inspect(element, { compact: false, depth: 999 })); console.error(`${elementName} attribute:`, attributeName, 'not implemented yet in', this.constructor.name); } } assert(this.prot.length > 0); assert(this.virt.length > 0); // ------------------------------------------------------------------------ // console.log(util.inspect(this, { compact: false, depth: 999 })) } } // ---------------------------------------------------------------------------- // <xsd:element name="basecompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" /> // <xsd:element name="derivedcompoundref" type="compoundRefType" minOccurs="0" maxOccurs="unbounded" /> export class BaseCompoundRefDataModel extends AbstractCompoundRefType { constructor(xml, element) { // console.log(elementName, util.inspect(element, { compact: false, depth: 999 })) super(xml, element, 'basecompoundref'); } } export class DerivedCompoundRefDataModel extends AbstractCompoundRefType { constructor(xml, element) { // console.log(elementName, util.inspect(element, { compact: false, depth: 999 })) super(xml, element, 'derivedcompoundref'); } } // ---------------------------------------------------------------------------- //# sourceMappingURL=compoundreftype-dm.js.map