Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spectools: clean the references in enum titles #139

Merged
merged 1 commit into from
Jan 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion spectool/schema_2_kaxsemantic_h.xsl
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ namespace libmatroska {
</xsl:variable>

<xsl:text>/**&#10; *</xsl:text>
<xsl:value-of select="ebml:documentation[@purpose='definition']"/>
<xsl:call-template name="cleanEnumTitle">
<xsl:with-param name="label" select="ebml:documentation[@purpose='definition']"/>
</xsl:call-template>
<xsl:text>&#10; */&#10;</xsl:text>
<xsl:text>typedef enum {&#10;</xsl:text>

Expand Down Expand Up @@ -495,6 +497,25 @@ namespace libmatroska {
</xsl:choose>
</xsl:template>

<xsl:template name="cleanEnumTitle">
<xsl:param name="label"/>
<xsl:choose>
<xsl:when test="contains($label,' [@!')">
<xsl:call-template name="cleanEnumTitle">
<xsl:with-param name="label" select="concat(substring-before($label, ' [@!'), ' ', substring-before(substring-after($label, ' [@!'), ']'), '', substring-after(substring-after($label, ' [@!'), ']'))"/>
</xsl:call-template>
</xsl:when>
<xsl:when test="contains($label,' [@?')">
<xsl:call-template name="cleanEnumTitle">
<xsl:with-param name="label" select="concat(substring-before($label, ' [@?'), ' ', substring-before(substring-after($label, ' [@?'), ']'), '', substring-after(substring-after($label, ' [@?'), ']'))"/>
</xsl:call-template>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$label"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>

<xsl:template name="cleanEnumDoc">
<xsl:param name="label"/>
<xsl:choose>
Expand Down
Loading