This is an automated email from the ASF dual-hosted git repository.
sunyi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix-website.git
The following commit(s) were added to refs/heads/master by this push:
new a7f6663 fix: some url path can't replace by absolute url path (#237)
a7f6663 is described below
commit a7f6663e0e7f873b5864e55f614e2d7e4eeb8529
Author: coolsoul <[email protected]>
AuthorDate: Wed Mar 3 18:48:33 2021 +0800
fix: some url path can't replace by absolute url path (#237)
Co-authored-by: coolsoul <[email protected]>
Co-authored-by: 琚致远 <[email protected]>
---
sync-docs.js | 12 +++++-------
1 file changed, 5 insertions(+), 7 deletions(-)
diff --git a/sync-docs.js b/sync-docs.js
index 1d03356..fc4c1d3 100644
--- a/sync-docs.js
+++ b/sync-docs.js
@@ -32,21 +32,19 @@ const replaceMDImageUrl = (project, paths) => {
const options = {
files: allMDFilePaths,
- from: /!\[[^\]]*\]\((?<filename>.*?)(?=\"|\))(?<optionalpart>\".*\")?\)/g,
+ // NOTE: just replace the url begin with ../assets/images ,then can
replace with absolute url path
+ from:
/(\.\.\/)+assets\/images\/[-A-Za-z0-9+&@#/%?=~_|!:,.;]+[-A-Za-z0-9+&@#/%=~_|]/g,
to: (match) => {
- console.log(match);
const imgPath = match
- .match(/\((.+?)\)/g)[0]
.replace("(", "")
.replace(")", "")
.replace("../", "")
.replace("../", "")
.replace("../", "")
.replace("../", "");
- const newUrl =
`(https://raw.githubusercontent.com/apache/${project}/master/docs/${imgPath})`;
- const result = match.replace(match.match(/\((.+?)\)/g)[0], newUrl);
- console.log(result);
- return result;
+ const newUrl =
`https://raw.githubusercontent.com/apache/${project}/master/docs/${imgPath}`;
+ console.log(`${project}: ${match} -> ${newUrl}`);
+ return newUrl;
},
};