From d5af08498f99a22c2a6439c05453f0d8a3b35836 Mon Sep 17 00:00:00 2001 From: vss-devel <3645234+vss-devel@users.noreply.github.com> Date: Wed, 17 Jul 2019 13:51:37 +0300 Subject: [PATCH] main page --- zimmer.js | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/zimmer.js b/zimmer.js index 383e1db..e46a8b4 100755 --- a/zimmer.js +++ b/zimmer.js @@ -1436,13 +1436,18 @@ async function initialise () { out = new Writer( outPath ); // create output file log( 'reserving space for header and mime type list' ) await out.write( Buffer.alloc( headerLength + maxMimeLength )) + + if ( command.main ) { + mainPage.titleKey = 'A' + command.main + } var dbPath = osPath.join( srcPath, 'metadata.db' ) let preProcessed = false if ( await fs.exists( dbPath )) { preProcessed = true try { - mainPage.titleKey = 'A' + ( await fs.readFile( osPath.join( srcPath, 'M', 'mainpage' ))).toString() + mainPage.titleKey = mainPage.titleKey || + ( 'A' + ( await fs.readFile( osPath.join( srcPath, 'M', 'mainpage' ))).toString()) } catch ( err ) { warning( 'mainpage error', err ) } @@ -1594,7 +1599,13 @@ async function main () { Where: source-directory \t path to the directory with HTML pages to pack into a ZIM file zim-file \t\t optional path for the output` ) - // Mandatory arguments: + // zimmer options: + .option( '--optimg', 'optimise images' ) + .option( '--jpegquality ', 'JPEG quality', parseInt, 60 ) + .option( '--no-compress', "do not compress clusters" ) + .option( '--main ', 'title of the "home" page' ) + .option( '--no-zimlib4-fix', 'no workaround for zimlib v4.0.4' ) + // zimwriterfs "Mandatory" arguments: .option( '-w, --welcome ', 'path of default/main HTML page. The path must be relative to HTML_DIRECTORY', 'index.htm' ) .option( '-f, --favicon ', 'path of ZIM file favicon. The path must be relative to HTML_DIRECTORY and the image a 48x48 PNG', 'favicon.png' ) .option( '-l, --language ', 'language code of the content in ISO639-3', 'eng' ) @@ -1602,7 +1613,7 @@ async function main () { .option( '-d, --description ', 'short description of the content', '' ) .option( '-c, --creator ', 'creator(s) of the content', '' ) .option( '-p, --publisher ', 'creator of the ZIM file itself', '' ) - // Optional arguments: + // zimwriterfs "Optional" arguments: .option( '-v, --verbose', 'print processing details on STDOUT' ) .option( '-m, --minChunkSize ', 'number of bytes per ZIM cluster (default: 2048)', parseInt, 2048 ) .option( '-x, --inflateHtml', 'try to inflate HTML files before packing (*.html, *.htm, ...)' ) @@ -1610,11 +1621,6 @@ async function main () { .option( '-r, --redirects ', 'path to the CSV file with the list of redirects (url, title, target_url tab separated)', '' ) // Not implemented //~ .option( '-i, --withFullTextIndex', 'index the content and add it to the ZIM' ) - // Extra arguments: - .option( '--optimg', 'optimise images' ) - .option( '-4, --no-zimlib4-fix', 'no zimlib v4.0.4 compatibility mode' ) - .option( '--jpegquality ', 'JPEG quality', parseInt, 60 ) - .option( '--no-compress', "do not compress clusters" ) .parse( osProcess.argv ) log( command )