Cscott has uploaded a new change for review. https://gerrit.wikimedia.org/r/97109
Change subject: Further improvements and bugfixes to featured article bundling. ...................................................................... Further improvements and bugfixes to featured article bundling. Trim pathnames (where necessary) intelligently; don't chop off extension. Allow specification of metabook collection title on command line; use this in the samples/featured.js collection generator. Remove _ from article titles when generating metabook.json. Change-Id: I88c7d39923976e0053b822784c40033ec8fd8f84 --- M bin/mw-bundler M lib/image.js M samples/featured.js 3 files changed, 12 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/Collection/OfflineContentGenerator/bundler refs/changes/09/97109/1 diff --git a/bin/mw-bundler b/bin/mw-bundler index 79df7ba..844d174 100755 --- a/bin/mw-bundler +++ b/bin/mw-bundler @@ -29,6 +29,8 @@ 'Parsoid API root', 'http://parsoid-lb.eqiad.wikimedia.org/') .option('-t, --toc <yes|no|auto>', 'Force presence/absence of toc [auto]', 'auto') + .option('--title <title>', + 'Set the title of the generated collection', null) .option('-v, --verbose', 'Print verbose progress information') .option('-D, --debug', @@ -152,7 +154,7 @@ // xxx fetch latest revision and timestamp? var item = { type: 'article', - title: title, + title: title.replace(/_/g,' '), content_type: 'text/x-wiki', url: w.url.replace(/\$1/, title), wiki: 0 /* select a wiki configuration */ @@ -248,6 +250,9 @@ // okay, do it! p = p.then(function() { + if (program.title) { + metabook.title = program.title; + } return bundler.bundle(metabook, { nozip: !!program.directory, output: program.directory || program.output, diff --git a/lib/image.js b/lib/image.js index 7ab7c30..0c829ee 100644 --- a/lib/image.js +++ b/lib/image.js @@ -68,11 +68,14 @@ }, function(err) { // tweak cleanFilename if there was a conflict! // (this is possible in multiwiki collections) + // it might also just be that the cleaned filename is too long. + var ext = path.extname(name); + var trimname = path.basename(name, ext).substring(0, 128); /* jshint unused: vars */ return P.call(tmp.file, tmp, { dir: imagedir, - prefix: '', - postfix: name.substring(0, 240 - imagedir.length) // limit len + prefix: trimname, + postfix: ext // limit len }); }).then(function(args) { var name = args[0], fd = args[1]; diff --git a/samples/featured.js b/samples/featured.js index 9b52e62..60c0d49 100755 --- a/samples/featured.js +++ b/samples/featured.js @@ -52,7 +52,7 @@ var args = []; if (program.debug) { args.push('-D'); } if (program.verbose) { args.push('-v'); } - args = args.concat([ '-o', outfile, '-p', prefix ]). + args = args.concat([ '--title', prefix, '-o', outfile, '-p', prefix ]). concat(articles[prefix]); console.log('mw-bundler', args.join(' ')); return P.call(rimraf, null, path.join(__dirname, outfile)). -- To view, visit https://gerrit.wikimedia.org/r/97109 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I88c7d39923976e0053b822784c40033ec8fd8f84 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/Collection/OfflineContentGenerator/bundler Gerrit-Branch: master Gerrit-Owner: Cscott <canan...@wikimedia.org> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits