Browse Source

Fix dynamic links replacing in static doc

tags/7.7
Grégoire Aubert 5 years ago
parent
commit
d2f6a51f79

+ 3
- 3
server/sonar-docs/src/pages/instance-administration/project-move.md View File

@@ -35,12 +35,12 @@ A zip file containing all project data ex is generated in _$SONAR_SOURCE_HOME/da
## How To Import
On the target instance:

* With a user having the "Administer System" and "Create Projects" permissions, go to **[Administration > Projects > Management](/#sonarqube-admin#/admin/projects_management/)** and [provision the project](/project-administration/project-existence/) using the same key the project had in the source instance.
* With a user having the "Administer System" and "Create Projects" permissions, go to [**Administration > Projects > Management**](/#sonarqube-admin#/admin/projects_management/) and [provision the project](/project-administration/project-existence/) using the same key the project had in the source instance.
* Configure the Project's permissions, and the Quality Profiles and Quality Gate associated to the Project
* Put the generated zip file into the directory _$SONAR_TARGET_HOME/data/governance/project_dumps/import_
* Put the generated zip file into the directory *$SONAR\_TARGET\_HOME/data/governance/project_dumps/import*
* Go to the Project's Home Page and choose **Administration > Import / Export**
* Click on the Import button to start importing your data
** Source code is not included in the zip file. Once the import is finished, trigger an analysis to import source files into the new instance.
* Source code is not included in the zip file. Once the import is finished, trigger an analysis to import source files into the new instance.

Notes:


+ 4
- 3
server/sonar-docs/src/templates/page.tsx View File

@@ -128,7 +128,7 @@ export const query = graphql`
function replaceImageLinks(content: string) {
const version = process.env.GATSBY_DOCS_VERSION || '';
if (version !== '') {
content = content.replace(/<img src="\/images\/(.*)"/gim, `<img src="/${version}/images/$1"`);
content = content.replace(/<img src="\/images\/(.*?)"/gim, `<img src="/${version}/images/$1"`);
}
return content;
}
@@ -136,12 +136,13 @@ function replaceImageLinks(content: string) {
function replaceDynamicLinks(content: string) {
// Make outside link open in a new tab
content = content.replace(
/<a href="http(.*)">(.*)<\/a>/gim,
/<a href="http(.*?)">(.*?)<\/a>/gim,
'<a href="http$1" target="_blank">$2</a>'
);

// Render only the text part of links going inside the app
return content.replace(
/<a href="(.*)\/#(?:sonarqube|sonarcloud|sonarqube-admin)#.*">(.*)<\/a>/gim,
/<a href="(.*)\/#(?:sonarqube|sonarcloud|sonarqube-admin)#.*?">(.*?)<\/a>/gim,
'$2'
);
}

Loading…
Cancel
Save