@@ -30,9 +30,6 @@ command guideBuilderRun pEdition, pVersion, pReleaseType, pOutputDir
3030 Initialize pVersion , pOutputDir
3131
3232 BaseCreate
33-
34- AddIDEGuides
35- AddRepoGuides
3633
3734 OutputGuide
3835
@@ -61,23 +58,11 @@ private function OutputGetGuideTitle
6158end OutputGetGuideTitle
6259
6360private command OutputGuide
64- OutputGuideMarkdown
61+ OutputGuideJson
6562 OutputGuideHtml
6663 OutputGuidePdf
6764end OutputGuide
6865
69- private command OutputGuideMarkdown
70- local tPath
71- put OutputGetGuideFilename("md" ) into tPath
72- builderLog "report" , merge ("Writing [[tPath]]" )
73-
74- local tMarkdown
75- put sMarkdownText ["guide" ] into tMarkdown
76- put return & sMarkdownText ["ide-guides" ] after tMarkdown
77- put return & sMarkdownText ["repo-guides" ] after tMarkdown
78- FileSetUTF8Contents tPath , tMarkdown
79- end OutputGuideMarkdown
80-
8166private function OutputEscape pMarkdown, pEscapeHtml
8267 -- Try to do the minimum possible escaping to be able to insert the
8368 -- markdown into a JavaScript string
@@ -92,16 +77,32 @@ private function OutputEscape pMarkdown, pEscapeHtml
9277 return pMarkdown
9378end OutputEscape
9479
80+ private command OutputGuideJson
81+ local tGuideJsonPath
82+ put builderGuideFolder() & slash & "distributed_guide.js" into tGuideJsonPath
83+
84+ local tGuideJson
85+ put FileGetUTF8Contents(tGuideJsonPath ) into tGuideJson
86+
87+ local tJS
88+ put "var tUserGuideData =" & return & "{" & return & tab & quote & "guides" & quote & ":[" into tJS
89+ put tGuideJson after tJS
90+ put return & tab & "]" & return & "}" after tJS
91+
92+ local tGuideJSPath
93+ put OutputGetGuideFilename("js" ) into tGuideJSPath
94+ FileSetUTF8Contents tGuideJSPath , tJS
95+ end OutputGuideJson
96+
9597private command OutputGuideHtml
9698 local tHtmlTemplatePath
9799 put builderSystemFolder() & "/user-guide-template.html" into tHtmlTemplatePath
98100
99101 local tHtml
100102 put FileGetUTF8Contents(tHtmlTemplatePath ) into tHtml
101103
102- replace "@prefix@" with OutputEscape(sMarkdownText ["guide" ], false ) in tHtml
103- replace "@ide-guides@" with OutputEscape(sMarkdownText ["ide-guides" ], true ) in tHtml
104- replace "@repo-guides@" with OutputEscape(sMarkdownText ["repo-guides" ], true ) in tHtml
104+ replace "@PREFIX@" with OutputEscape(sMarkdownText ["guide" ], false ) in tHtml
105+ replace "@GUIDE_JSON@" with OutputGetGuideFilename("js" ) in tHtml
105106
106107 local tOutpath
107108 put OutputGetGuideFilename("html" ) into tOutpath
@@ -164,40 +165,6 @@ private command BaseCreate
164165
165166end BaseCreate
166167
167- -- --------------------------------------------------------------
168- -- Guide Contents
169- -- --------------------------------------------------------------
170-
171- private command AddGuide pWhich, pFolder, pFilename
172- local tGuidePath
173- put pFolder & slash & pFilename into tGuidePath
174-
175- local tGuideContents
176- put FileGetUTF8Contents(tGuidePath ) into tGuideContents
177-
178- MarkdownAppend pWhich , tGuideContents
179- end AddGuide
180-
181- private command AddGuides pWhich
182- local tFolder
183- put FileGetPath(pWhich ) into tFolder
184-
185- local tGuides
186- put FolderListFiles(tFolder , "md" ) into tGuides
187-
188- repeat for each line tGuide in tGuides
189- AddGuide pWhich , tFolder , tGuide
190- end repeat
191- end AddGuides
192-
193- private command AddRepoGuides
194- AddGuides "repo-guides"
195- end AddRepoGuides
196-
197- private command AddIDEGuides
198- AddGuides "ide-guides"
199- end AddIDEGuides
200-
201168-- --------------------------------------------------------------
202169-- File helpers
203170-- --------------------------------------------------------------
0 commit comments