Skip to content
This repository has been archived by the owner on Feb 17, 2022. It is now read-only.

Commit

Permalink
force replace a bad link in generated docs
Browse files Browse the repository at this point in the history
  • Loading branch information
spalger committed Oct 31, 2019
1 parent a3d0999 commit 388c5e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
4 changes: 2 additions & 2 deletions docs/api_methods.asciidoc
Expand Up @@ -3694,7 +3694,7 @@ client.indices.flushSynced([params, [callback]])

// no description

Check the *<<api-conventions>>* and https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-flush.html#synced-flush-api[the elasticsearch docs] for more information pertaining to this method.
Check the *<<api-conventions>>* and https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-synced-flush-api.html[the elasticsearch docs] for more information pertaining to this method.

// no examples

Expand All @@ -3717,7 +3717,7 @@ Options:::
`index`::
<<api-param-type-string,`String`>>, <<api-param-type-string-array,`String[]`>>, <<api-param-type-boolean,`Boolean`>> -- A comma-separated list of index names; use `_all` or empty string for all indices
`body`::
<<api-param-type-object,`Object`>>, <<api-param-type-json,`JSON`>> -- An optional request body, as either JSON or a JSON serializable object. See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-flush.html#synced-flush-api[the elasticsearch docs] for details about what can be specified here.
<<api-param-type-object,`Object`>>, <<api-param-type-json,`JSON`>> -- An optional request body, as either JSON or a JSON serializable object. See https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-synced-flush-api.html[the elasticsearch docs] for details about what can be specified here.

link:#[back to top]

Expand Down
13 changes: 12 additions & 1 deletion scripts/generate/js_api.js
Expand Up @@ -188,9 +188,20 @@ module.exports = function(branch, done) {
done();
}

var patchBadLinks = {
'https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-flush.html#synced-flush-api':
'https://www.elastic.co/guide/en/elasticsearch/reference/7.4/indices-synced-flush-api.html',
};

function writeMethodDocs(done) {
var filename = fromRoot('docs/api_methods' + branchSuffix + '.asciidoc');
fs.writeFile(filename, templates.apiMethods(docVars), function(err) {
var content = templates.apiMethods(docVars);

for (const [bad, good] of Object.entries(patchBadLinks)) {
content = content.split(bad).join(good);
}

fs.writeFile(filename, content, function(err) {
if (!err) {
console.log(
chalk.white.bold('wrote'),
Expand Down

0 comments on commit 388c5e8

Please sign in to comment.