From b5be1ce382ec1afc92d3e5bdc2fc33593786b288 Mon Sep 17 00:00:00 2001 From: Candid Dauth Date: Wed, 19 Oct 2016 18:55:49 +0300 Subject: [PATCH] Add OpenSearch --- frontend/gulpfile-img64.js | 8 +++++++- frontend/gulpfile.js | 5 ++++- frontend/index.html | 1 + frontend/opensearch.xml | 8 ++++++++ 4 files changed, 20 insertions(+), 2 deletions(-) create mode 100644 frontend/opensearch.xml diff --git a/frontend/gulpfile-img64.js b/frontend/gulpfile-img64.js index aaed2756..a21b7130 100644 --- a/frontend/gulpfile-img64.js +++ b/frontend/gulpfile-img64.js @@ -32,7 +32,9 @@ module.exports = function() { } if (file.isBuffer()) { - var $ = cheerio.load(String(file.contents)); + var $ = cheerio.load(String(file.contents), { + xmlMode: mime.lookup(file.path) == "application/xml" + }); $('img').each(function() { $(this).attr('src', replacePath($(this).attr('src'), file)); @@ -42,6 +44,10 @@ module.exports = function() { $(this).attr('href', replacePath($(this).attr('href'), file)); }); + $('OpenSearchDescription Image').each(function() { + $(this).text(replacePath($(this).text(), file)); + }); + file.contents = new Buffer($.html()); return callback(null, file); diff --git a/frontend/gulpfile.js b/frontend/gulpfile.js index ad184731..c050e535 100644 --- a/frontend/gulpfile.js +++ b/frontend/gulpfile.js @@ -107,7 +107,10 @@ gulp.task("all", [ "deps", "app" ], function() { concat("all.css"), sourcemaps.write("./sourcemaps") ), - gulp.src("deref.html") + combine( + gulp.src([ "deref.html", "opensearch.xml" ]), + img64() + ) ), gulp.dest("build") ); diff --git a/frontend/index.html b/frontend/index.html index 7aaaf837..bad6e934 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -6,6 +6,7 @@ +