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

Add support for "Groups" tag in Info.xml #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

NeilSeligmann
Copy link

@NeilSeligmann NeilSeligmann commented Aug 3, 2024

This PR aims to add support for the Groups tag found in the Info.xml.

The Groups tag, while widely used in many mods, is not in the current version of the schema definition (that I could find).
However, as so many mods use it I found it useful to implement it.

<fomod xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://bellcubedev.github.io/site-testing/assets/site/misc/Info.xsd">
    <Name>The BANANA Mod</Name>
    <Author>BellCube</Author>
    <Id>1</Id>
    <Website>https://example.com</Website>
    <Version>1.0.0</Version>
    <Groups>
        <element>category 1</element>
        <element>testGroup2</element>
    </Groups> 
</fomod>

@NeilSeligmann NeilSeligmann changed the title Add support for "Group" tag in Info.xml Add support for "Groups" tag in Info.xml Aug 3, 2024
Copy link
Owner

@BellCubeDev BellCubeDev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main concern with Info.xml in this library is to describe what existing mod managers already implement since there is no official schema. The definitions in the library were derived directly from a trip through the source code for both Vortex and MO2. If you know of a mod manager that uses this the Groups field, I'm completely open to merging this PR in!

I was working on a schema for inclusion in XML files way back in my first iteration of the Fomod Builder. Can't recall why I didn't go with a modified version of it for https://fomod.bellcube.dev/schemas/Info.xsd. That old version: https://github.com/BellCubeDev/site-testing/blob/main/site/src/_includes/Info.xsd

Comment on lines +60 to +70

if (Array.isArray(value)) {
for (const subChildValue of value) {
// Append "element" tag to child, with the value
const subChild = document.createElement('element');
subChild.textContent = subChildValue;
child.appendChild(subChild);
}
} else {
child.textContent = value;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It may be worth investigating how existing tooling and mod managers handle multi-child elements in Info.xml. I have little knowledge on the subject personally, though the Fomod Creation Tool may be a good place to look if memory serves. I suspect we'll end up creating a class for more complex representations sometime down the line, even if just to handle the element name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants