specref icon indicating copy to clipboard operation
specref copied to clipboard

Improve version sorting and inherit dates

Open socram8888 opened this issue 3 months ago • 6 comments

As a previous step to #883, this severely improves version sorting and updates the rawDate on the parent element. Previous sorting (https://api.specref.org/bibrefs?refs=ECMASCRIPT):

{
  "ECMASCRIPT": {
    "title": "ECMAScript Language Specification",
    "href": "https://tc39.es/ecma262/multipage/",
    "publisher": "Ecma International",
    "versions": [
      "ECMASCRIPT-9.0",
      "ECMASCRIPT-8.0",
      "ECMASCRIPT-7.0",
      "ECMASCRIPT-60",
      "ECMASCRIPT-6.0",
      "ECMASCRIPT-51",
      "ECMASCRIPT-5.1",
      "ECMASCRIPT-2025",
      "ECMASCRIPT-2024",
      "ECMASCRIPT-2023",
      "ECMASCRIPT-2022",
      "ECMASCRIPT-2021",
      "ECMASCRIPT-2020",
      "ECMASCRIPT-2019",
      "ECMASCRIPT-2018",
      "ECMASCRIPT-2017",
      "ECMASCRIPT-2016",
      "ECMASCRIPT-2015",
      "ECMASCRIPT-16.0",
      "ECMASCRIPT-15.0",
      "ECMASCRIPT-14.0",
      "ECMASCRIPT-13.0",
      "ECMASCRIPT-12.0",
      "ECMASCRIPT-11.0",
      "ECMASCRIPT-10.0"
    ],
    "repository": "https://github.com/tc39/ecma262",
    "id": "ECMASCRIPT"
  }
}

New sorting:

{
  "ECMASCRIPT": {
    "title": "ECMAScript Language Specification",
    "href": "https://tc39.es/ecma262/multipage/",
    "publisher": "Ecma International",
    "versions": [
      "ECMASCRIPT-2025",
      "ECMASCRIPT-2024",
      "ECMASCRIPT-2023",
      "ECMASCRIPT-2022",
      "ECMASCRIPT-2021",
      "ECMASCRIPT-2020",
      "ECMASCRIPT-2019",
      "ECMASCRIPT-2018",
      "ECMASCRIPT-2017",
      "ECMASCRIPT-2016",
      "ECMASCRIPT-2015",
      "ECMASCRIPT-60",
      "ECMASCRIPT-51",
      "ECMASCRIPT-16.0",
      "ECMASCRIPT-15.0",
      "ECMASCRIPT-14.0",
      "ECMASCRIPT-13.0",
      "ECMASCRIPT-12.0",
      "ECMASCRIPT-11.0",
      "ECMASCRIPT-10.0",
      "ECMASCRIPT-9.0",
      "ECMASCRIPT-8.0",
      "ECMASCRIPT-7.0",
      "ECMASCRIPT-6.0",
      "ECMASCRIPT-5.1"
    ],
    "repository": "https://github.com/tc39/ecma262",
    "id": "ECMASCRIPT"
  }
}

An old, redundant and buggy unused version has been also dropped for cleanup.

socram8888 avatar Sep 26 '25 12:09 socram8888

Thanks for this PR. Could you please explain what problem it is trying to solve?

tobie avatar Sep 26 '25 14:09 tobie

https://github.com/tobie/specref/pull/883#issuecomment-3336045793 this

socram8888 avatar Sep 26 '25 15:09 socram8888

Got it. Could we just focus on finding the newest date in that case rather than sorting the sub references?

tobie avatar Sep 26 '25 15:09 tobie

Simply max(rawDate)? Or max(rawDate) in addition to sorting?

For the record, the sorting is already happening on cleanupRefs, just badly by comparing ASCII so it leaves 9 > 11.

El 26 de septiembre de 2025 17:57:42 CEST, Tobie Langel @.***> escribió:

tobie left a comment (tobie/specref#888)

Got it. Could we just focus on finding the newest date in that case rather than sorting the sub references?

-- Reply to this email directly or view it on GitHub: https://github.com/tobie/specref/pull/888#issuecomment-3339342652 You are receiving this because you authored the thread.

Message ID: @.***>

socram8888 avatar Sep 26 '25 16:09 socram8888

Yeah. I believe the sorting was to avoid generating diffs.

tobie avatar Sep 26 '25 16:09 tobie

I don't think that approach can be generalized in practice. The two WHATWG entries with versions (WEBIDL and WEBSOCKETS) record historical versions, when specs were still being published by W3C. For example, for WEBIDL, the most recent version has a raw date of 20161215, but the spec itself last got updated less than a month ago.

Given that all other entries with "versions" are either in w3c.json (where dates are always set), biblio.json (where things are done manually in any case), and unicode.json, I would just focus on unicode.json as part of #883.

tidoust avatar Oct 10 '25 06:10 tidoust