From c82d7a4c2ee8ccb1003fe0b06a24ca3dc347ea8c Mon Sep 17 00:00:00 2001 From: Simon Lydell Date: Thu, 8 Sep 2016 09:34:28 +0200 Subject: [PATCH] Add `gulp hints.html` to help styling hint markers --- .gitignore | 1 + documentation/tools.md | 2 ++ extension/lib/modes.coffee | 2 ++ extension/skin/style.css | 2 +- gulpfile.coffee | 42 +++++++++++++++++++++++--------------- 5 files changed, 31 insertions(+), 18 deletions(-) diff --git a/.gitignore b/.gitignore index ea708ee..886d2f1 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,4 @@ /build /gulpfile.js /help.html +/hints.html diff --git a/documentation/tools.md b/documentation/tools.md index db5a454..1e587d6 100644 --- a/documentation/tools.md +++ b/documentation/tools.md @@ -118,6 +118,8 @@ internally by other tasks.) using the Style Editor! You can even press the “Save” button when done to save your changes! +- `gulp hints.html` is like `gulp help.html` but for styling hint markers. + ### Release See the [“Making a release”][release] section below for more information. diff --git a/extension/lib/modes.coffee b/extension/lib/modes.coffee index 7fb020e..6c0eac8 100644 --- a/extension/lib/modes.coffee +++ b/extension/lib/modes.coffee @@ -273,6 +273,8 @@ mode('hints', { increase_count: ({storage}) -> storage.count += 1 + # Uncomment this line if you want to use `gulp hints.html`! + # utils.writeToClipboard(storage.markerContainer.container.outerHTML) toggle_complementary: ({storage}) -> storage.markerContainer.toggleComplementary() diff --git a/extension/skin/style.css b/extension/skin/style.css index 511def0..dff5862 100644 --- a/extension/skin/style.css +++ b/extension/skin/style.css @@ -17,7 +17,7 @@ * along with VimFx. If not, see . */ -/* Allow file:/// prefix for testing using `gulp help.html`. */ +/* Allow file:/// prefix for testing using `gulp {help,hints}.html`. */ @-moz-document url(chrome://browser/content/browser.xul), url-prefix(file:///) { diff --git a/gulpfile.coffee b/gulpfile.coffee index ba9b335..ffc293b 100644 --- a/gulpfile.coffee +++ b/gulpfile.coffee @@ -299,22 +299,30 @@ parseLocaleFile = (fileContents) -> lines.push(line) return {keys, template: lines, newline} -helpHTMLFile = 'help.html' -gulp.task(helpHTMLFile, -> - unless fs.existsSync(helpHTMLFile) - process.stdout.write(""" - First enable the “Copy to clipboard” line in help.coffee, show the help - dialog and finally dump the clipboard into #{helpHTMLFile}. - """) - return - gulp.src('help.html') - .pipe(tap((file) -> - file.contents = new Buffer(generateHelpHTML(file.contents.toString())) - )) - .pipe(gulp.dest('.')) -) +generateHTMLTask = (filename, message) -> + gulp.task(filename, -> + unless fs.existsSync(filename) + process.stdout.write(message(filename)) + return + gulp.src(filename) + .pipe(tap((file) -> + file.contents = new Buffer(generateTestHTML(file.contents.toString())) + )) + .pipe(gulp.dest('.')) + ) + +generateHTMLTask('help.html', (filename) -> """ + First enable the “Copy to clipboard” line in help.coffee, show the help + dialog and finally dump the clipboard into #{filename}. +""") + +generateHTMLTask('hints.html', (filename) -> """ + First enable the “Copy to clipboard” line in modes.coffee, show the + hint markers, activate the “Increase count” command and finally dump the + clipboard into #{filename}. +""") -helpHTMLPrelude = ''' +testHTMLPrelude = ''' VimFx help @@ -325,8 +333,8 @@ helpHTMLPrelude = ''' ''' -generateHelpHTML = (dumpedHTML) -> - return helpHTMLPrelude + dumpedHTML +generateTestHTML = (dumpedHTML) -> + return testHTMLPrelude + dumpedHTML .replace(/^<\w+ xmlns="[^"]+"/, '$/, 'div>') .replace(/<(\w+)([^>]*)\/>/g, '<$1$2>') -- 2.39.3