aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-docs/src/templates
diff options
context:
space:
mode:
authorWouter Admiraal <wouter.admiraal@sonarsource.com>2019-01-04 16:46:00 +0100
committersonartech <sonartech@sonarsource.com>2019-01-16 09:42:17 +0100
commit47068be19be3b7e80b27c34ccb9278c2e83ae9de (patch)
tree0171e51153b38ba3f78a6ef2bdb4bd1593f36a42 /server/sonar-docs/src/templates
parent355a3b65066e968e3669a97892df81ef15770a55 (diff)
downloadsonarqube-47068be19be3b7e80b27c34ccb9278c2e83ae9de.tar.gz
sonarqube-47068be19be3b7e80b27c34ccb9278c2e83ae9de.zip
SONAR-11608 Conditional formatting broken when used within a table
Diffstat (limited to 'server/sonar-docs/src/templates')
-rw-r--r--server/sonar-docs/src/templates/page.js28
1 files changed, 5 insertions, 23 deletions
diff --git a/server/sonar-docs/src/templates/page.js b/server/sonar-docs/src/templates/page.js
index 164ff5909ac..d627cd7a338 100644
--- a/server/sonar-docs/src/templates/page.js
+++ b/server/sonar-docs/src/templates/page.js
@@ -46,15 +46,13 @@ export default class Page extends React.PureComponent {
render() {
const page = this.props.data.markdownRemark;
- let htmlWithInclusions = cutSonarCloudContent(page.html).replace(
- /<p>@include (.*)<\/p>/,
- (_, path) => {
- const chunk = data.allMarkdownRemark.edges.find(edge => edge.node.fields.slug === path);
- return chunk ? chunk.node.html : '';
- }
- );
+ let htmlWithInclusions = page.html.replace(/<p>@include (.*)<\/p>/, (_, path) => {
+ const chunk = data.allMarkdownRemark.edges.find(edge => edge.node.fields.slug === path);
+ return chunk ? chunk.node.html : '';
+ });
const realHeadingsList = removeExtraHeadings(page.html, page.headings);
+
htmlWithInclusions = removeTableOfContents(htmlWithInclusions);
htmlWithInclusions = createAnchorForHeadings(htmlWithInclusions, realHeadingsList);
htmlWithInclusions = replaceDynamicLinks(htmlWithInclusions);
@@ -190,19 +188,3 @@ function createAnchorForHeadings(content, headings) {
function removeTableOfContents(content) {
return content.replace(/<h[1-9]>Table Of Contents<\/h[1-9]>/i, '');
}
-
-function cutSonarCloudContent(content) {
- const beginning = '<!-- sonarcloud -->';
- const ending = '<!-- /sonarcloud -->';
-
- let newContent = content;
- let start = newContent.indexOf(beginning);
- let end = newContent.indexOf(ending);
- while (start !== -1 && end !== -1) {
- newContent = newContent.substring(0, start) + newContent.substring(end + ending.length);
- start = newContent.indexOf(beginning);
- end = newContent.indexOf(ending);
- }
-
- return newContent;
-}