Skip to content

Commit

Permalink
Test: Update test_site expected folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Chng-Zhi-Xuan committed Mar 20, 2019
1 parent 26a39f9 commit 1e7b75f
Show file tree
Hide file tree
Showing 29 changed files with 758 additions and 658 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
* text=auto
1 change: 1 addition & 0 deletions docs/userGuide/makingTheSiteSearchable.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ If you do not wish to use MarkBind's searchbar (e.g. you have an external servic

<include src="syntax/searchBars.mbdf" />
<include src="syntax/keywords.mbdf" />
<include src="syntax/indexing.mbdf" />

{% from "njk/common.njk" import previous_next %}
{{ previous_next('reusingContents', 'deployingTheSite') }}
16 changes: 16 additions & 0 deletions docs/userGuide/syntax/indexing.mbdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
## Including or Excluding Headings

**You can specify headings which are to be included or excluded from the index built by MarkBind's built-in search feature** using the `.always-index` or `.no-index` attributes.

If you wish to index a specific heading outside the specified `headingIndexLevel`, you may add the `.always-index` attribute to the heading. Similarly, if you wish for a specific heading inside the specified `headingIndexLevel` not to be indexed, you may add the `.no-index` attribute to the heading.

<div class="indented">

{{ icon_example }}

```md
###### Heading outside heading index level that will be indexed {.always-index}

# Heading inside heading index level that will not be indexed {.no-index}
```
</div>
10 changes: 6 additions & 4 deletions src/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,15 +190,17 @@ function formatSiteNav(renderedSiteNav, src) {
}

/**
* Generates a heading selector based on the indexing level
* Generates a selector for headings with level inside the headingIndexLevel
* or with the index attribute, that do not also have the noindex attribute
* @param headingIndexingLevel to generate
*/
function generateHeadingSelector(headingIndexingLevel) {
let headingsSelector = 'h1';
let headingsSelectors = ['.always-index:header', 'h1'];
for (let i = 2; i <= headingIndexingLevel; i += 1) {
headingsSelector += `, h${i}`;
headingsSelectors.push(`h${i}`);
}
return headingsSelector;
headingsSelectors = headingsSelectors.map(selector => `${selector}:not(.no-index)`);
return headingsSelectors.join(',');
}

function unique(array) {
Expand Down
8 changes: 3 additions & 5 deletions src/lib/markbind/src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -305,14 +305,12 @@ Parser.prototype._preprocess = function (node, context, config) {
delete element.attribs.inline;
delete element.attribs.trim;

fileContent = isTrim ? fileContent.trim() : fileContent;

if (includeSrc.hash) {
// directly get segment from the src
const segmentSrc = cheerio.parseHTML(fileContent, true);
const $ = cheerio.load(segmentSrc);
const htmlContent = $(includeSrc.hash).html();
let actualContent = htmlContent;
const hashContent = $(includeSrc.hash).html();
let actualContent = (hashContent && isTrim) ? hashContent.trim() : hashContent;

if (actualContent === null) {
if (isOptional) {
Expand Down Expand Up @@ -343,7 +341,7 @@ Parser.prototype._preprocess = function (node, context, config) {
}
element.children = cheerio.parseHTML(actualContent, true); // the needed content;
} else {
let actualContent = fileContent;
let actualContent = (fileContent && isTrim) ? fileContent.trim() : fileContent;
if (isIncludeSrcMd) {
if (context.mode === 'include') {
actualContent = isInline ? actualContent : utils.wrapContent(actualContent, '\n\n', '\n');
Expand Down
8 changes: 4 additions & 4 deletions test/functional/test_site/_markbind/layouts/default/head.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<head-top>
<meta name="default-head-top">
</head-top>
<meta name="default-head-bottom">
<head-top>
<meta name="default-head-top">
</head-top>
<meta name="default-head-bottom">
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<head-top>
<meta name="head-top">
</head-top>
<meta name="head-bottom">
<head-top>
<meta name="head-top">
</head-top>
<meta name="head-bottom">
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<head-top>
<meta name="head-top">
</head-top>
<meta name="head-bottom">
<head-top>
<meta name="head-top">
</head-top>
<meta name="head-bottom">
21 changes: 12 additions & 9 deletions test/functional/test_site/expected/bugs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
<link rel="icon" href="/test_site/favicon.png">
</head>
<body>
<div id="app">
<div id="content-wrapper">
<div id="app">
<div id="flex-body">
<div id="content-wrapper">
<div>
<navbar placement="top" type="inverse" class="temp-navbar">
<a slot="brand" href="/" title="Home" class="navbar-brand">Markbind Test Site</a>
Expand All @@ -40,7 +41,8 @@ <h2 id="popover-initiated-by-trigger-honor-trigger-attribute">popover initiated
<div slot="content">
<div>
<p>Requirements gathering, requirements elicitation, requirements analysis, requirements capture are some of the terms commonly <strong>and</strong> interchangeably used to represent the activity of understanding what a software product should
do.</p>
do.
</p>
</div>
</div>
</popover>
Expand All @@ -54,7 +56,8 @@ <h2 id="support-multiple-inclusions-of-a-modal">Support multiple inclusions of a
<modal large="" title="Establishing Requirements" id="modal:bugRepro">
<div>
<p>Requirements gathering, requirements elicitation, requirements analysis, requirements capture are some of the terms commonly <strong>and</strong> interchangeably used to represent the activity of understanding what a software product should
do.</p>
do.
</p>
</div>
</modal>
</div>
Expand All @@ -65,7 +68,8 @@ <h2 id="support-multiple-inclusions-of-a-modal">Support multiple inclusions of a
<modal large="" title="Establishing Requirements" id="modal:bugRepro">
<div>
<p>Requirements gathering, requirements elicitation, requirements analysis, requirements capture are some of the terms commonly <strong>and</strong> interchangeably used to represent the activity of understanding what a software product should
do.</p>
do.
</p>
</div>
</modal>
</div>
Expand All @@ -76,13 +80,12 @@ <h2 id="remove-extra-space-in-links">Remove extra space in links<a class="fa fa-
<a href="https://github.com">link text</a>]</p>
</div>
</div>
<div id="flex-div"></div>
<footer>
</div>
<footer>
<div class="text-center">
Default footer
</div>
</footer>
</div>
</footer> </div>
</body>
<script src="../markbind/js/vue.min.js"></script>
<script src="../markbind/js/vue-strap.min.js"></script>
Expand Down
Loading

0 comments on commit 1e7b75f

Please sign in to comment.