jamesb93 / documax

Generate Max object documentation in a saner fashion
4 stars 0 forks source link

max.mustache not rendering attribues properly? #2

Closed rconstanzo closed 1 year ago

rconstanzo commented 1 year ago

After some testing back and forth with my files not having autocompletes for @attributes, I noticed that there's no mention of them in the .xml files at all. I compared to existing ones and got nowhere, so I decided to run the default/included examples (basic.object.toml, karma~.toml) and those don't render any attributes either.

I had look through the max.mustache file and didn't see anything horribly out of place.

The basic.object.toml file has the following:

[attributes]
[attributes.interp]
digest = "attribute digest"
description = "attribute description"
type = "int"
size = 1
default = { value = 0.5, size = 1, type = "int" }

And that produces this in the final .xml (basic.object.maxref.xml)

    <!--ATTRIBUTES-->
    <attributelist>
    </attributelist>
    <!--ATTRIBUTES-->

This is, I believe, the relevant bit of the .mustache file:

    <!--ATTRIBUTES-->
    <attributelist>
        {{ #attributes }}
        <attribute 
        name='{{ name }}' 
        type='{{ type }}' 
        size='{{ size }}'
        get='1' set='1' 
        >
        <digest>{{ digest }}</digest>
        <description>{{ description }}</description>

        <attributelist>
            <attribute 
            name='default' 
            type='{{ default.type }}' 
            size='{{ default.size }}' 
            value='{{ default.value }}'
            get='1' set='1' 
            />
        </attributelist>
        </attribute>
        {{ /attributes }}
    </attributelist>
    <!--ATTRIBUTES-->
rconstanzo commented 1 year ago

I have no way of testing this at the moment as I can't get the script to run on any of my computers, but I think there's a problem here in the .mustache file.

This:

    <!--ATTRIBUTES-->
    <attributelist>
        {{ #attributes }}
        <attribute 
        name='{{ name }}' 
        type='{{ type }}' 
        size='{{ size }}'
        get='1' set='1' 
        >
        <digest>{{ digest }}</digest>
        <description>{{ description }}</description>

        <attributelist>
            <attribute 
            name='default' 
            type='{{ default.type }}' 
            size='{{ default.size }}' 
            value='{{ default.value }}'
            get='1' set='1' 
            />
       </attributelist> 
       </attribute>
        {{ /attributes }}
    </attributelist>
    <!--ATTRIBUTES-->

Should instead be this:

    <!--ATTRIBUTES-->
    <attributelist>
        {{ #attributes }}
        <attribute 
        name='{{ name }}' 
        type='{{ type }}' 
        size='{{ size }}'
        get='1' set='1' 
        >
        <digest>{{ digest }}</digest>
        <description>{{ description }}</description>

        <attributelist>
            <attribute 
            name='default' 
            type='{{ default.type }}' 
            size='{{ default.size }}' 
            value='{{ default.value }}'
            get='1' set='1' 
            />
        </attribute>
        </attributelist>
        {{ /attributes }}
    </attributelist>
    <!--ATTRIBUTES-->

The closing attribute and attributelist from the second chunk are out of order (I think).

rconstanzo commented 1 year ago

Turns out that's not it. The order of tags seems odd to me here, but it doesn't render properly if I shift things around as above.

jamesb93 commented 1 year ago

This was an error in not passing attributes to the parser correctly. Should be fixed now in ddc9e460327919870ef4457a56df96ab6bbf54de