jamesb93 / documax

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

Generation Issue #1

Closed jamesb93 closed 1 year ago

jamesb93 commented 1 year ago

Documented here: https://github.com/flucoma/manual-doc-generator/issues/1

rconstanzo commented 1 year ago

Here's the relevant info from the trunk or whatever.

@jamesb93 asked me to create an issue for this.

Loads of errors that look like this in Max:

xmltree_document: error reading file Macintosh HD:/Users/rodrigo/Sync/Files/Max/Packages/SP-Tools/docs/sp.corpusmatch.maxref.xml at byte offset 711 / mismatched tag
line (8): p>
xmltree_document: error reading file Macintosh HD:/Users/rodrigo/Sync/Files/Max/Packages/SP-Tools/docs/sp.corpusmatch.maxref.xml at byte offset 711 / mismatched tag
line (8): p>

My input file looks like this:

[object]
name = "sp.corpusmatch"
module = "SP-Tools"
category = ""
digest = "Find the nearest match in a pre-analyzed corpus"
seealso =  ['sp.corpusanalysis', 'sp.corpuscreate', 'sp.gridmatch', 'sp.corpusplayer~', 'sp.corpuslist', 'sp.folderloop', 'sp.descriptors~', 'sp.descriptorframe']
description = "Find the nearest match in a pre-analyzed corpus."
discussion = """
    <h4><openfilelink filename="SP-Tools Overview.maxpat">Open the Overview Patch</openfilelink></h4>
    <p>The <o>sp.corpusmatch</o> object works in conjunction with <o>sp.descriptors~</o> or <o>sp.descriptorsframe</o> to find the nearest match in a pre-analyzed corpus. <o>sp.corpusmatch<o/> also houses the required datasets, <o>coll</o>, and <o>polybuffer~<o/>.</p>
"""

[metadata]
author = "Rodrigo Constanzo, Flucoma Project"
tags = ['Machine Learning', 'Drums']

And the output looks like this:

<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<c74object name='sp.corpusmatch' category='' module='SP-Tools'>
    <digest>Find the nearest match in a pre-analyzed corpus</digest>
    <description>Find the nearest match in a pre-analyzed corpus.</description>
    <discussion>    <h4><openfilelink filename="SP-Tools Overview.maxpat">Open the Overview Patch</openfilelink></h4>
    <p>The <o>sp.corpusmatch</o> object works in conjunction with <o>sp.descriptors~</o> or <o>sp.descriptorsframe</o> to find the nearest match in a pre-analyzed corpus. <o>sp.corpusmatch<o/> also houses the required datasets, <o>coll</o>, and <o>polybuffer~<o/>.</p>
</discussion>

    <metadatalist>
        <metadata name='author'>Rodrigo Constanzo, Flucoma Project</metadata>
        <metadata name='tag'>Machine Learning</metadata>
        <metadata name='tag'>Drums</metadata>
    </metadatalist>

As far as I can read, that looks ok. The <p> </p> tags look intact.

Here's the .toml file for the above: sp.corpusmatch.toml.zip

rconstanzo commented 1 year ago

Ok, in some further testing (on suggestion from @steadykammer) I tried manually reformatting the .xml (and .toml) to have the

` tags on separate lines, and that still throws up errors.

Today I manually copied in the full <discussion> tag from a known/working object (fluid.audiotransport~) and it still throws up the following error:

xmltree_document: error reading file Macintosh HD:/Users/rodrigo/Sync/Files/Max/Packages/SP-Tools/docs/sp.corpusmatch.maxref.xml at byte offset 741 / mismatched tag
line (9): p>
xmltree_document: error reading file Macintosh HD:/Users/rodrigo/Sync/Files/Max/Packages/SP-Tools/docs/sp.corpusmatch.maxref.xml at byte offset 741 / mismatched tag
line (9): p>

Here's the new/current .xml bit that generated that error:

<?xml version='1.0' encoding='utf-8' standalone='yes'?>
<?xml-stylesheet href="./_c74_ref.xsl" type="text/xsl"?>

<c74object name='sp.corpusmatch' category='SP-Tools' module='SP-Tools'>
        <digest>Find the nearest match in a pre-analyzed corpus</digest>
        <description>Find the nearest match in a pre-analyzed corpus.</description>
 <discussion>
    <h4><openfilelink filename="Fluid Corpus Manipulation Toolkit.maxpat">Open the Overview Patch</openfilelink></h4>
            <p>Interpolates between the spectra of two sounds using the optimal transport algorithm. This enables morphing and hybridisation of the perceptual qualities of each source linearly.
        See Henderson and Solomon (2019) AUDIO TRANSPORT: A GENERALIZED PORTAMENTO VIA OPTIMAL TRANSPORT, DaFx</p>
        <p><a class="reference external" href="https://arxiv.org/abs/1906.06763">https://arxiv.org/abs/1906.06763</a></p>

    <p>Read more about fluid.audiotransport~ on the <a href='https://learn.flucoma.org/reference/audiotransport'>learn platform</a>.</p>
    <p>fluid.audiotransport~ is part of the Fluid Decomposition Toolkit of the FluCoMa project. For more explanations, learning material, and discussions on its musicianly uses, visit <a href="http://www.flucoma.org/">flucoma.org</a>.</p>
  </discussion>

In having seen similar-ish non-sensical errors in Arduino-land, I'm thinking/wondering if there's an orphan tag further down the tree that's propagating backwards and messing this up. I manually looked through the linked .toml above, and couldn't find anything out of place (though it's hard visually parsing that kind of stuff. Also (visually) looked through the generated .xml and nothing stands out either.

jamesb93 commented 1 year ago

The issue arises because you have misplaced your slashes in the closing of <o> tags. For example:

<o>coll</o>, and <o>polybuffer~<o/>

Ahhh the joys of xml...

Let me know if changing that fixes it for you. I think it does for me but my environment is not the same as yours.

rconstanzo commented 1 year ago

For the sake of posterity, it was/is a combination of malformed closing tags (<o/> and <m/>) as well as some weird syntax to get around > and similar operators, which need the following respectively: > = quot;&gt;&quot; < = quot;&gt;&quot; >= = &quot;&gt;=&quot; <= = &quot;&lt;=&quot;

rconstanzo commented 1 year ago

Actually it doesn't even need the quot; bit, just needs to close with a semicolon like: &gt;