Skip to content

Commit 62e89b8

Browse files
Merge pull request livecode#2821 from livecodeali/bugfix-release_notes_ordering
[[ Release Notes ]] Make sure subsections are output in the order they are encountered
2 parents fc83d7c + 51acd4d commit 62e89b8

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

builder/release_notes_builder.livecodescript

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -541,14 +541,16 @@ function noteSubsectionDataToMD pLevel, pDataA
541541
put "#" after tHashes
542542
end repeat
543543

544-
local tMD
545-
repeat for each key tSubsection in pDataA
546-
put tHashes && tSubsection & return after tMD
547-
if pDataA[tSubsection]["data"] is not empty then
548-
put pDataA[tSubsection]["data"] & return after tMD
544+
local tMD, tSubsections
545+
put the keys of pDataA into tSubsections
546+
sort tSubsections by pDataA[each]["order"]
547+
repeat for each line tSection in tSubsections
548+
put tHashes && tSection & return after tMD
549+
if pDataA[tSection]["data"] is not empty then
550+
put pDataA[tSection]["data"] & return after tMD
549551
end if
550-
if pDataA[tSubsection]["subsection"] is not empty then
551-
put noteSubsectionDataToMD(pLevel + 1, pDataA[tSubsection]["subsection"]) & return after tMD
552+
if pDataA[tSection]["subsection"] is not empty then
553+
put noteSubsectionDataToMD(pLevel + 1, pDataA[tSection]["subsection"]) & return after tMD
552554
end if
553555
end repeat
554556
return tMD
@@ -604,6 +606,12 @@ on addDataToSection pLevel, @xData, @xSectionA
604606
local tSection
605607
put word 2 to -1 of it into tSection
606608
delete line 1 of xData
609+
610+
local tSectionOrder
611+
if tSection is not among the keys of xSectionA["subsection"] then
612+
put the number of elements of xSectionA["subsection"] + 1 into tSectionOrder
613+
put tSectionOrder into xSectionA["subsection"][tSection]["order"]
614+
end if
607615
addDataToSection pLevel + 1, xData, xSectionA["subsection"][tSection]
608616
end if
609617
end repeat
@@ -661,7 +669,8 @@ on addExtensionReleaseNoteData pFirstVersion, pCurVersion, @xDataA
661669
put empty into tExtensionDataA
662670
local tSectionName
663671
if tType is "libraries" then
664-
put tName && "Library" into tSectionName
672+
# Libraries usually have 'Library' in their name already
673+
put tName into tSectionName
665674
else
666675
put tName && "Widget" into tSectionName
667676
end if
@@ -704,6 +713,11 @@ on addLCBReleaseNoteData pFile, pSectionName, @xDataA
704713
put word 2 to -1 of it into tSection
705714
delete line 1 of tNoteData
706715
if pSectionName is not empty then
716+
local tSectionOrder
717+
if tSection is not among the keys of xDataA[pSectionName]["subsection"] then
718+
put the number of elements of xDataA[pSectionName]["subsection"] + 1 into tSectionOrder
719+
put tSectionOrder into xDataA[pSectionName]["subsection"][tSection]["order"]
720+
end if
707721
addDataToSection 1, tNoteData, xDataA[pSectionName]["subsection"][tSection]
708722
else
709723
addDataToSection 1, tNoteData, xDataA[tSection]

0 commit comments

Comments
 (0)