]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-11644 Swap {instance} with SonarQube in sonar-docs search result
authorGrégoire Aubert <gregoire.aubert@sonarsource.com>
Mon, 21 Jan 2019 15:49:05 +0000 (16:49 +0100)
committerSonarTech <sonartech@sonarsource.com>
Tue, 22 Jan 2019 19:21:02 +0000 (20:21 +0100)
server/sonar-docs/plugins/sonarsource-source-filesystem/index.js
server/sonar-docs/src/templates/page.tsx

index ec53803861732223bb400d97cc6398e7088d2a86..8a46249f409595aa72298e66eca97c3c95a48789 100644 (file)
@@ -29,6 +29,7 @@ function loadNodeContentSync(fileNode) {
   let newContent = cutSonarCloudContent(content);
   newContent = removeRemainingContentTags(newContent);
   newContent = handleIncludes(newContent, fileNode);
+  newContent = replaceInstanceTag(newContent);
   return newContent;
 }
 
@@ -76,6 +77,10 @@ function handleIncludes(content, fileNode) {
   });
 }
 
+function replaceInstanceTag(content) {
+  return content.replace(/{instance}/gi, 'SonarQube');
+}
+
 exports.createFilePath = createFilePath;
 exports.createRemoteFileNode = createRemoteFileNode;
 exports.loadNodeContent = loadNodeContent;
index c5d2ecd6c11bfeedfd1b54dd0e4a1de2e8ebd859..11b25083c3f5baced581ad80ae2ea295644edeb3 100644 (file)
@@ -71,7 +71,6 @@ export default class Page extends React.PureComponent<Props> {
     htmlPageContent = createAnchorForHeadings(htmlPageContent, realHeadingsList);
     htmlPageContent = replaceDynamicLinks(htmlPageContent);
     htmlPageContent = replaceImageLinks(htmlPageContent);
-    htmlPageContent = replaceInstanceTag(htmlPageContent);
 
     return (
       <>
@@ -126,10 +125,6 @@ export const query = graphql`
   }
 `;
 
-function replaceInstanceTag(content: string) {
-  return content.replace(/{instance}/gi, 'SonarQube');
-}
-
 function replaceImageLinks(content: string) {
   const version = process.env.GATSBY_DOCS_VERSION || '';
   if (version !== '') {