mmarkdown / mmark

Mmark: a powerful markdown processor in Go geared towards the IETF
https://mmark.miek.nl
Other
480 stars 45 forks source link

The order of <reference> element is random on each call #112

Closed robUx4 closed 3 years ago

robUx4 commented 4 years ago

Everytime you touch a source file and run mmark on it, the list of references at the end has a different order.

That makes it difficult to track changes in the code or compare with a previous version.

miekg commented 4 years ago

[ Quoting notifications@github.com in "[mmarkdown/mmark] The order of <ref..." ]

Everytime you touch a source file and run mmark on it, the list of references at the end has a different order.

yes, these are not sorted currently, because xml2rfc will do - although it's not clear here if you use that.

That makes it difficult to track changes in the code or compare with a previous version.

because you look at the xml?

/Miek

-- Miek Gieben

robUx4 commented 4 years ago

because you look at the xml?

I do, because I'm comparing my generated XML file to the one I got from the AUTH48 review.

It could also be used for continuous integration to verify changes are correct or not.

miekg commented 4 years ago

[ Quoting notifications@github.com in "Re: [mmarkdown/mmark] The order of ..." ]

because you look at the xml?

I do, because I'm comparing my generated XML file to the one I got from the AUTH48 review.

It could also be used for continuous integration to verify changes are correct or not.

oh $DEITY, this review is using XML because that the base format. Ok yeah, that make sense.

See https://github.com/mmarkdown/mmark/pull/114

robUx4 commented 4 years ago

It seems #114 didn't do the trick. If I run mmark 2.2.8 multiple times on this file, the reference order is sometimes switched.

{mainmatter}

Use [@!ISO3309], [@!RFC1234] and  [@!RFC2345].

{backmatter}

<reference anchor="ISO3309" target="https://www.iso.org/standard/8558.html">
  <front>
    <title>Data communication -- High-level data link control procedures -- Frame structure</title>
    <author>
      <organization>International Organization for Standardization</organization>
    </author>
    <date year="1984" month="October"/>
  </front>
  <seriesInfo name="ISO" value="3309, 3rd Edition"/>
</reference>

After multiple runs I get all 6 permutations.

miekg commented 4 years ago

feel free to send a patch...

robUx4 commented 4 years ago

In Go ? 😱

miekg commented 4 years ago

I think I fixed it for realz now. Didn't assign back the sorted array, so kept on iterating over the random one