@@ -40,8 +40,11 @@ class Context {
4040 * @returns the string of the AstroJS markdown "frontmatter"
4141 */
4242function icu4xAstroMdFrontMatter ( foundTitle : string ) {
43+ // special case for the quickstart tutorial title in ICU4X
44+ let title = foundTitle . replace ( / I n t r o d u c t i o n t o I C U 4 X f o r R u s t / g, "Quickstart" ) ;
45+
4346 let frontMatterStr = "---" + "\n"
44- + "title: " + foundTitle + "\n"
47+ + "title: " + title + "\n"
4548 + "---" + "\n" ;
4649 return frontMatterStr ;
4750}
@@ -196,7 +199,7 @@ function printHelp() {
196199 console . log ( "Usage:" ) ;
197200 console . log ( "\tnpm run icu4x-convert -- --inDir=<input-dir> --outDir=<output-dir> --icu4xRef=<ICU4X-git-ref> --webDirName=<version-based-dir-name> --sitePrefix=<site-prefix-str-else-emptystr> --astroVersion=<semver>" ) ;
198201 console . log ( ) ;
199- console . log ( "Example: npm run icu4x-convert -- --inDir=/tmp/1.5- tutorials/ --outDir=/tmp/1.5-output/ --icu4xVersion=1.5.0 --icu4xRef=release/1.5 --webDirName=1_5 --sitePrefix= --astroVersion=4.16.18" )
202+ console . log ( "Example: npm run icu4x-convert -- --inDir=/path/to/icu4x/ tutorials/ --outDir=/path/to/icu4x-docs/src/content/docs/ --icu4xVersion=1.5.0 --icu4xRef=release/1.5 --webDirName=1_5 [ --sitePrefix=/uriPrefix] --astroVersion=4.16.18" )
200203}
201204
202205/**
@@ -243,7 +246,9 @@ function parseCLIArgs() {
243246 icu4xVersion : values [ "icu4xVersion" ] ?? ( ( ) => { throw new Error ( "Need icu4xVersion" ) } ) ( ) ,
244247 icu4xRef : values [ "icu4xRef" ] ?? ( ( ) => { throw new Error ( "Need icu4xRef" ) } ) ( ) ,
245248 webDirName : values [ "webDirName" ] ?? ( ( ) => { throw new Error ( "Need webDirName" ) } ) ( ) ,
246- sitePrefix : values [ "sitePrefix" ] ?? ( ( ) => { throw new Error ( "Need sitePrefix" ) } ) ( ) ,
249+ sitePrefix : values [ "sitePrefix" ] ?? "" , // default value for sitePrefix is "" because
250+ // URIs for base site icu4x.unicode.org do not need
251+ // a prefix, unlike hosting on Github Pages
247252 astroVersion : values [ "astroVersion" ] ?? ( ( ) => { throw new Error ( "Need astroVersion" ) } ) ( ) ,
248253 }
249254 } ;
@@ -263,11 +268,11 @@ try {
263268 let { values, positionals} = parsedArgs ;
264269
265270 const inputDirPath : string = values [ "inDir" ] ;
266- const outputDirPath = values [ "outDir" ] ;
267271 const icu4xVersion = values [ "icu4xVersion" ] ;
268272 const icu4xRef = values [ "icu4xRef" ] ;
269273 const sitePrefix = values [ "sitePrefix" ] ;
270274 const webDirName = values [ "webDirName" ] ;
275+ const outputDirPath = path . join ( values [ "outDir" ] , webDirName ) ;
271276
272277 const context = new Context ( { icu4xVersion, icu4xRef, webDirName, sitePrefix} ) ;
273278
0 commit comments