Skip to content

Commit

Permalink
Merge branch 'master' into es6-site-class
Browse files Browse the repository at this point in the history
  • Loading branch information
yamgent committed Jan 30, 2020
2 parents 5c2c76e + 2b378db commit ab17775
Show file tree
Hide file tree
Showing 9 changed files with 144 additions and 137 deletions.
5 changes: 0 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
"cheerio": "^0.22.0",
"chokidar": "^3.3.0",
"commander": "^3.0.2",
"ejs": "^3.0.1",
"fastmatter": "^2.1.1",
"figlet": "^1.2.4",
"find-up": "^4.1.0",
Expand Down
4 changes: 2 additions & 2 deletions src/Page.js
Original file line number Diff line number Diff line change
Expand Up @@ -722,7 +722,7 @@ class Page {
return $.html();
}


collectPageSection(section) {
const $ = cheerio.load(this.content, { xmlMode: false });
const pageSection = $(section);
Expand Down Expand Up @@ -792,7 +792,7 @@ class Page {
this.buildPageNav();

return fs.outputFileAsync(this.resultPath, htmlBeautify(
this.template(this.prepareTemplateData()),
this.template.render(this.prepareTemplateData()),
{ indent_size: 2 },
));
})
Expand Down
4 changes: 2 additions & 2 deletions src/Site.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const cheerio = require('cheerio');
const ejs = require('ejs');
const fs = require('fs-extra-promise');
const ghpages = require('gh-pages');
const ignore = require('ignore');
Expand Down Expand Up @@ -113,7 +112,8 @@ class Site {

// Page template path
this.pageTemplatePath = path.join(__dirname, PAGE_TEMPLATE_NAME);
this.pageTemplate = ejs.compile(fs.readFileSync(this.pageTemplatePath, 'utf8'));
const env = nunjucks.configure({ autoescape: false });
this.pageTemplate = nunjucks.compile(fs.readFileSync(this.pageTemplatePath, 'utf8'), env);
this.pages = [];

// Other properties
Expand Down
2 changes: 1 addition & 1 deletion src/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ module.exports = {
FOOTER_PATH: '_markbind/footers/footer.md',
INDEX_MARKDOWN_FILE: 'index.md',
MARKBIND_PLUGIN_PREFIX: 'markbind-plugin-',
PAGE_TEMPLATE_NAME: 'page.ejs',
PAGE_TEMPLATE_NAME: 'page.njk',
PROJECT_PLUGIN_FOLDER_NAME: '_markbind/plugins',
SITE_CONFIG_NAME: 'site.json',
SITE_DATA_NAME: 'siteData.json',
Expand Down
59 changes: 0 additions & 59 deletions src/page.ejs

This file was deleted.

68 changes: 68 additions & 0 deletions src/page.njk
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
<!DOCTYPE html>
<html>
<head>
{{ headFileTopContent }}
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="generator" content="{{ markBindVersion }}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{ title }}</title>
<link rel="stylesheet" href="{{ asset.bootstrap }}">
<link rel="stylesheet" href="{{ asset.bootstrapVue }}">
<link rel="stylesheet" href="{{ asset.fontAwesome }}">
<link rel="stylesheet" href="{{ asset.glyphicons }}">
<link rel="stylesheet" href="{{ asset.highlight }}">
<link rel="stylesheet" href="{{ asset.markbind }}">
{%- if asset.pluginLinks %}
{%- for link in asset.pluginLinks %}
{{ link }}
{%- endfor %}
{%- endif %}
<link rel="stylesheet" href="{{ asset.layoutStyle }}">
{%- if siteNav %}
<link rel="stylesheet" href="{{ asset.siteNavCss }}">
{%- endif %}
{%- if pageNav %}
<link rel="stylesheet" href="{{ asset.pageNavCss }}">
{%- endif %}
{{ headFileBottomContent }}
{%- if faviconUrl %}
<link rel="icon" href="{{ faviconUrl }}">
{%- endif %}
</head>
<body {% if pageNav %} data-spy="scroll" data-target="#page-nav" data-offset="100" {% endif %}>
<div id="app">
{{ headerHtml }}
<div id="flex-body">
{{ siteNavHtml }}
{{ content }}
{{ pageNavHtml }}
</div>
{{ footerHtml }}
</div>
</body>
<script src="{{ asset.vue }}"></script>
<script src="{{ asset.vueStrap }}"></script>
<script src="{{ asset.bootstrapUtilityJs }}"></script>
<script src="{{ asset.polyfillJs }}"></script>
<script src="{{ asset.bootstrapVueJs }}"></script>
<script>
const baseUrl = '{{ baseUrl }}'
const enableSearch = {{ enableSearch }}
</script>
<script src="{{ asset.setup }}"></script>

{%- if asset.externalScripts %}
{%- for script in asset.externalScripts %}
<script src="{{ script }}"></script>
{%- endfor %}
{%- endif %}

{%- if asset.pluginScripts %}
{%- for script in asset.pluginScripts %}
{{ script }}
{%- endfor %}
{%- endif %}

<script src="{{ asset.layoutScript }}"></script>
</html>
Loading

0 comments on commit ab17775

Please sign in to comment.