@@ -1061,6 +1061,7 @@ private command __nameToKeyAndType pName, @rKey, @rType
10611061 case "Introduced"
10621062 case "Deprecated"
10631063 case "Edition"
1064+ case "Name"
10641065 put "standard" into rType
10651066 break
10661067 case "Example"
@@ -1095,10 +1096,6 @@ private command __nameToKeyAndType pName, @rKey, @rType
10951096 put "tags" into rKey
10961097 put "items" into rType
10971098 break
1098- case "Name"
1099- put "display name" into rKey
1100- put "standard" into rType
1101- break
11021099 case "Parameters"
11031100 put "parameters" into rType
11041101 break
@@ -1219,6 +1216,9 @@ function revDocsParseElements pExtractedA, pBlocksA, pFilename
12191216 if tParsedA [tItem ] is empty then
12201217 put pBlocksA [tItem ] into tParsedA [tItem ]
12211218 end if
1219+ if tParsedA ["display name" ] is empty then
1220+ put tParsedA ["name" ] into tParsedA ["display name" ]
1221+ end if
12221222 end repeat
12231223
12241224 return tParsedA
@@ -1256,14 +1256,10 @@ function revDocsParseDocFileToLibraryArray pFile, pLibraryName, pAuthor
12561256end revDocsParseDocFileToLibraryArray
12571257
12581258function revDocsParseDocTextToLibraryArray pFile, pText, pLibraryName, pAuthor
1259- local tLibraryA
1260- put revDocsParseDocText(pText , pFile ) into tLibraryA
1261- if pLibraryName is not empty then
1262- put pLibraryName into tLibraryA ["display name" ]
1263- put revDocsModifyForUrl(pLibraryName ) into tLIbraryA ["name" ]
1264- end if
1265- put pAuthor into tLibraryA ["author" ]
1266- return tLibraryA
1259+ local tOverridesA
1260+ put pLibraryName into tOverridesA ["display name" ]
1261+ put pAuthor into tOverridesA ["author" ]
1262+ return revDocsParseDocText(pText , pFile , "" , tOverridesA )
12671263end revDocsParseDocTextToLibraryArray
12681264
12691265function revDocsParseDocFile pFile
@@ -1319,7 +1315,7 @@ function revDocsGroupElements pElementsA
13191315
13201316end revDocsGroupElements
13211317
1322- function revDocsParseDocText pText, pFilename, pDefaults
1318+ function revDocsParseDocText pText, pFilename, pDefaults, pOverrides
13231319 local tElementsA
13241320 put revDocsExtractElements(pText ) into tElementsA
13251321
@@ -1343,6 +1339,7 @@ function revDocsParseDocText pText, pFilename, pDefaults
13431339 put tElementsA [tStartNum ]["content" ] into tParsedA ["name" ]
13441340 add 1 to tStartNum
13451341 break
1342+ case "Summary"
13461343 case "Description"
13471344 case "Author"
13481345 case "Type"
@@ -1418,24 +1415,36 @@ function revDocsParseDocText pText, pFilename, pDefaults
14181415 end if
14191416 end repeat
14201417
1421- // Add a library entry
1422- local tLibraryElements
1423- local tCount
1424- put 1 into tCount
1425- add 1 to tEntryCount
1426-
1427- repeat for each item tItem in "name,description,author,type,example,references,edition"
1428- if tParsedA [tItem ] is not empty then
1429- put tItem into tEntriesA [tEntryCount ]["elements" ][tCount ]["name" ]
1430- put tParsedA [tItem ] into tEntriesA [tEntryCount ]["elements" ][tCount ]["content" ]
1431- add 1 to tCount
1432- end if
1433- end repeat
1418+ // Add a library entry, if there was one
1419+ local tHasLibraryEntry
1420+ put tParsedA ["name" ] is not empty into tHasLibraryEntry
1421+ if tHasLibraryEntry then
1422+ local tLibraryElements
1423+ local tCount
1424+ put 1 into tCount
1425+ add 1 to tEntryCount
1426+
1427+ // Use overrides if specified
1428+ repeat for each item tItem in "name,description,author,type,example,references,edition,associations"
1429+ if tParsedA [tItem ] is not empty then
1430+ put tItem into tEntriesA [tEntryCount ]["elements" ][tCount ]["name" ]
1431+ put tParsedA [tItem ] into tEntriesA [tEntryCount ]["elements" ][tCount ]["content" ]
1432+ add 1 to tCount
1433+ end if
1434+ end repeat
1435+ end if
14341436
14351437 repeat for each key tKey in tEntriesA
14361438 put revDocsParseElements(tEntriesA [tKey ]["elements" ], tEntriesA [tKey ], pFilename ) into tParsedA ["doc" ][tKey ]
14371439 end repeat
14381440
1441+ if tHasLibraryEntry then
1442+ repeat for each key tKey in pOverrides
1443+ put pOverrides [tKey ] into tParsedA ["doc" ][tEntryCount ][tKey ]
1444+ put pOverrides [tKey ] into tParsedA [tKey ]
1445+ end repeat
1446+ end if
1447+
14391448 return tParsedA
14401449end revDocsParseDocText
14411450
@@ -1895,17 +1904,18 @@ private function __tabs pNum
18951904 return tOutput
18961905end __tabs
18971906
1898- function revDocsFormatLibraryDocArrayAsJSON pLibraryName, pDocA
1899- local tCount
1900- put the number of elements in pDocA into tCount
1907+ function revDocsFormatLibraryDocArrayAsJSON pLibraryA
1908+ local tCount , tDocA
1909+ put pLibraryA ["doc" ] into tDocA
1910+ put the number of elements in tDocA into tCount
19011911
19021912 local tJSON
19031913 if tCount is not 0 then
19041914 repeat with tIndex = 1 to tCount
19051915 local tDoc , tId
1906- put pDocA [tIndex ] into tDoc
1907- put pLibraryName & "-" & tIndex into tId
1908- put revDocsFormatLibraryDataAsJSON(tId , tDoc , pLibraryName ) & comma after tJSON
1916+ put tDocA [tIndex ] into tDoc
1917+ put pLibraryA [ "name" ] & "-" & tIndex into tId
1918+ put revDocsFormatLibraryDataAsJSON(tId , tDoc , pLibraryA ) & comma after tJSON
19091919 end repeat
19101920 delete the last char of tJSON
19111921 end if
@@ -2221,92 +2231,90 @@ end __revDocsFormatCustomArrayAsJSON
22212231Format the library array data as a JSON array as needed by the docs viewer
22222232*/
22232233
2224- function revDocsFormatLibraryDataAsJSON pID, pLibraryDataA, pAPIName
2234+ function revDocsFormatLibraryDataAsJSON pID, pDocDataA, pLibraryDataA
22252235 local tJSON
22262236 put "{" & return into tJSON
22272237
2228- if pLibraryDataA ["display name" ] is empty then
2229- put pLibraryDataA ["name" ] into pLibraryDataA ["display name" ]
2230- else if pLibraryDataA ["name" ] is empty then
2231- put pLibraryDataA ["display name" ] into pLibraryDataA ["name" ]
2232- else
2233- throw "No name parsed"
2238+ if pDocDataA ["name" ] is empty then
2239+ throw "no name parsed"
22342240 end if
2241+
22352242 # The 'name' should be urlencoded
2236- put revDocsModifyForURL(pLibraryDataA ["name" ]) into pLibraryDataA ["name" ]
2243+ put revDocsModifyForURL(pDocDataA ["name" ]) into pDocDataA ["name" ]
22372244
22382245 # ID
22392246 put outputElement("id" , pID , 3 ) after tJSON
22402247
22412248 # Name
2242- put outputArrayElement("name" , pLibraryDataA , 3 ) after tJSON
2249+ put outputArrayElement("name" , pDocDataA , 3 ) after tJSON
22432250
22442251 # Display Name
2245- put outputArrayElement("display name" , pLibraryDataA , 3 ) after tJSON
2252+ put outputArrayElement("display name" , pDocDataA , 3 ) after tJSON
22462253
2247- put outputElement("library" , pAPIName , 3 ) after tJSON
2254+ # Library Name
2255+ put outputElement("library" , pLibraryDataA ["name" ], 3 ) after tJSON
22482256
22492257 # Type
2250- put outputArrayElement("type" , pLibraryDataA , 3 , true ) after tJSON
2258+ put outputArrayElement("type" , pDocDataA , 3 , true ) after tJSON
22512259
22522260 # Syntax
2253- put __revDocsFormatCustomArrayAsJSON("syntax" , pLibraryDataA ) after tJSON
2261+ put __revDocsFormatCustomArrayAsJSON("syntax" , pDocDataA ) after tJSON
22542262
22552263 # Display syntax
2256- if pLibraryDataA ["syntax" ] is not empty then
2257- put line 1 of pLibraryDataA ["syntax" ][1 ] into pLibraryDataA ["display syntax" ][1 ]
2264+ if pDocDataA ["syntax" ] is not empty then
2265+ put line 1 of pDocDataA ["syntax" ][1 ] into pDocDataA ["display syntax" ][1 ]
22582266 else
2259- put pLibraryDataA ["display name" ] into pLibraryDataA ["display syntax" ][1 ]
2267+ put pDocDataA ["display name" ] into pDocDataA ["display syntax" ][1 ]
22602268 end if
2261- put __revDocsFormatCustomArrayAsJSON("display syntax" , pLibraryDataA ) after tJSON
2269+ put __revDocsFormatCustomArrayAsJSON("display syntax" , pDocDataA ) after tJSON
22622270
22632271 # Synonyms
2264- put revDocsItemListToJSONArray(pLibraryDataA , "synonyms" ) after tJSON
2272+ put revDocsItemListToJSONArray(pDocDataA , "synonyms" ) after tJSON
22652273
22662274 # Associations
2267- put revDocsItemListToJSONArray(pLibraryDataA , "associations" ) after tJSON
2275+ put revDocsItemListToJSONArray(pDocDataA , "associations" ) after tJSON
22682276
22692277 # Summary
2270- put outputElementIfExists("summary" , pLibraryDataA , 3 ) after tJSON
2278+ put outputElementIfExists("summary" , pDocDataA , 3 ) after tJSON
22712279
22722280 # Edition
2273- put outputElementIfExists("edition" , pLibraryDataA , 3 ) after tJSON
2281+ put outputElementIfExists("edition" , pDocDataA , 3 ) after tJSON
22742282
22752283 # Introduced
2276- put outputElementIfExists("introduced" , pLibraryDataA , 3 ) after tJSON
2284+ put outputElementIfExists("introduced" , pDocDataA , 3 ) after tJSON
22772285
22782286 # Deprecated
2279- put outputElementIfExists("deprecated" , pLibraryDataA , 3 ) after tJSON
2287+ put outputElementIfExists("deprecated" , pDocDataA , 3 ) after tJSON
22802288
22812289 # OS
2282- put revDocsItemListToJSONArray(pLibraryDataA , "OS" ) after tJSON
2290+ put revDocsItemListToJSONArray(pDocDataA , "OS" ) after tJSON
22832291
22842292 # Platforms
2285- put revDocsItemListToJSONArray(pLibraryDataA , "platforms" ) after tJSON
2293+ put revDocsItemListToJSONArray(pDocDataA , "platforms" ) after tJSON
22862294
22872295 # Security
2288- put revDocsItemListToJSONArray(pLibraryDataA , "security" ) after tJSON
2296+ put revDocsItemListToJSONArray(pDocDataA , "security" ) after tJSON
22892297
22902298 # Parameters
2291- put __revDocsFormatCustomArrayAsJSON("params" , pLibraryDataA ) after tJSON
2299+ put __revDocsFormatCustomArrayAsJSON("params" , pDocDataA ) after tJSON
22922300
22932301 # Example
2294- put __revDocsFormatCustomArrayAsJSON("example" , pLibraryDataA ) after tJSON
2302+ put __revDocsFormatCustomArrayAsJSON("example" , pDocDataA ) after tJSON
22952303
22962304 # Value
2297- put __revDocsFormatCustomArrayAsJSON("value" , pLibraryDataA ) after tJSON
2305+ put __revDocsFormatCustomArrayAsJSON("value" , pDocDataA ) after tJSON
22982306
22992307 # Description
2300- put outputElementIfExists("description" , pLibraryDataA , 3 ) after tJSON
2308+ put outputElementIfExists("description" , pDocDataA , 3 ) after tJSON
23012309
23022310 # References
2303- put __revDocsFormatReferencesArrayAsJSON(pLibraryDataA ["references" ]) after tJSON
2311+ put __revDocsFormatReferencesArrayAsJSON(pDocDataA ["references" ]) after tJSON
23042312
23052313 # Tags
2306- put revDocsItemListToJSONArray(pLibraryDataA , "tags" ) after tJSON
2314+ put revDocsItemListToJSONArray(pDocDataA , "tags" ) after tJSON
23072315
23082316 # Changes
2309- put outputElementIfExists("changes" , pLibraryDataA , 3 ) after tJSON
2317+ put outputElementIfExists("changes" , pDocDataA , 3 ) after tJSON
23102318
23112319 delete char - 2 to - 1 of tJSON
23122320 put return & tab & tab & "}" after tJSON
0 commit comments