UNPKG

@xpack/docusaurus-plugin-doxygen

Version:

A Docusaurus plugin to integrate Doxygen into a Docusaurus project.

81 lines 3.85 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 { AbstractMemberBaseType } from './memberdeftype-dm.js'; // ---------------------------------------------------------------------------- // <xsd:complexType name="MemberType"> // <xsd:sequence> // <xsd:element name="name" type="xsd:string"/> // WARNING name may be empty // </xsd:sequence> // <xsd:attribute name="refid" type="xsd:string" use="required"/> // <xsd:attribute name="kind" type="MemberKind" use="required"/> // </xsd:complexType> export class AbstractMemberType extends AbstractMemberBaseType { // kind: string = '' // MemberKind (in parent) constructor(xml, element, elementName) { super(elementName); // Mandatory elements. // name: string = '' (in parent) // Mandatory attributes. this.refid = ''; // console.log(elementName, util.inspect(element, { compact: false, depth: 999 })) // ------------------------------------------------------------------------ // Process elements. const innerElements = xml.getInnerElements(element, elementName); assert(innerElements.length > 0); for (const innerElement of innerElements) { if (xml.hasInnerText(innerElement)) { // Ignore texts. } else if (xml.isInnerElementText(innerElement, 'name')) { this.name = xml.getInnerElementText(innerElement, 'name'); } else { console.error(util.inspect(innerElement)); console.error(`${elementName} element:`, Object.keys(innerElement), 'not implemented yet in', this.constructor.name); } } // In practice it may be empty. // assert(this.name.length > 0) // ------------------------------------------------------------------------ // Process attributes. assert(xml.hasAttributes(element)); const attributesNames = xml.getAttributesNames(element); for (const attributeName of attributesNames) { if (attributeName === '@_refid') { this.refid = xml.getAttributeStringValue(element, '@_refid'); } else if (attributeName === '@_kind') { this.kind = xml.getAttributeStringValue(element, '@_kind'); } else { console.error(util.inspect(element, { compact: false, depth: 999 })); console.error(`${elementName} attribute:`, attributeName, 'not implemented yet in', this.constructor.name); } } assert(this.refid.length > 0); assert(this.kind.length > 0); // ------------------------------------------------------------------------ // console.log(util.inspect(this, { compact: false, depth: 999 })) } } // ---------------------------------------------------------------------------- // <xsd:element name="member" type="MemberType" minOccurs="0" maxOccurs="unbounded" /> export class MemberDataModel extends AbstractMemberType { constructor(xml, element) { // console.log(elementName, util.inspect(element, { compact: false, depth: 999 })) super(xml, element, 'member'); } } // ---------------------------------------------------------------------------- //# sourceMappingURL=membertype-dm.js.map