mirror of
https://github.com/msberends/a_new_instrument_for_microbial_epidemiology.git
synced 2025-07-28 00:25:24 +02:00
chapter 1 finished
This commit is contained in:
@ -97,9 +97,3 @@ div.proof>*:last-child:after {
|
||||
.header-section-number {
|
||||
padding-right: .5em;
|
||||
}
|
||||
#header .multi-author {
|
||||
margin: 0.5em 0 -0.5em 0;
|
||||
}
|
||||
#header .date {
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
|
7
docs/libs/gitbook-2.6.7/js/lunr.js
Normal file
7
docs/libs/gitbook-2.6.7/js/lunr.js
Normal file
File diff suppressed because one or more lines are too long
@ -1,24 +1,9 @@
|
||||
gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
|
||||
var index = null;
|
||||
var fuse = null;
|
||||
var _search = {engine: 'lunr', opts: {}};
|
||||
var $searchInput, $searchLabel, $searchForm;
|
||||
var $highlighted = [], hi, hiOpts = { className: 'search-highlight' };
|
||||
var collapse = false, toc_visible = [];
|
||||
|
||||
function init(config) {
|
||||
// Instantiate search settings
|
||||
_search = gitbook.storage.get("search", {
|
||||
engine: config.search.engine || 'lunr',
|
||||
opts: config.search.options || {},
|
||||
});
|
||||
};
|
||||
|
||||
// Save current search settings
|
||||
function saveSearchSettings() {
|
||||
gitbook.storage.set("search", _search);
|
||||
}
|
||||
|
||||
// Use a specific index
|
||||
function loadIndex(data) {
|
||||
// [Yihui] In bookdown, I use a character matrix to store the chapter
|
||||
@ -29,36 +14,18 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
|
||||
// lunr cannot handle non-English text very well, e.g. the default
|
||||
// tokenizer cannot deal with Chinese text, so we may want to replace
|
||||
// lunr with a dumb simple text matching approach.
|
||||
if (_search.engine === 'lunr') {
|
||||
index = lunr(function () {
|
||||
this.ref('url');
|
||||
this.field('title', { boost: 10 });
|
||||
this.field('body');
|
||||
index = lunr(function () {
|
||||
this.ref('url');
|
||||
this.field('title', { boost: 10 });
|
||||
this.field('body');
|
||||
});
|
||||
data.map(function(item) {
|
||||
index.add({
|
||||
url: item[0],
|
||||
title: item[1],
|
||||
body: item[2]
|
||||
});
|
||||
data.map(function(item) {
|
||||
index.add({
|
||||
url: item[0],
|
||||
title: item[1],
|
||||
body: item[2]
|
||||
});
|
||||
});
|
||||
return;
|
||||
}
|
||||
fuse = new Fuse(data.map((_data => {
|
||||
return {
|
||||
url: _data[0],
|
||||
title: _data[1],
|
||||
body: _data[2]
|
||||
};
|
||||
})), Object.assign(
|
||||
{
|
||||
includeScore: true,
|
||||
threshold: 0.1,
|
||||
ignoreLocation: true,
|
||||
keys: ["title", "body"]
|
||||
},
|
||||
_search.opts
|
||||
));
|
||||
});
|
||||
}
|
||||
|
||||
// Fetch the search index
|
||||
@ -69,33 +36,20 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
|
||||
|
||||
// Search for a term and return results
|
||||
function search(q) {
|
||||
let results = [];
|
||||
switch (_search.engine) {
|
||||
case 'fuse':
|
||||
if (!fuse) return;
|
||||
results = fuse.search(q).map(function(result) {
|
||||
var parts = result.item.url.split('#');
|
||||
return {
|
||||
path: parts[0],
|
||||
hash: parts[1]
|
||||
};
|
||||
});
|
||||
break;
|
||||
case 'lunr':
|
||||
default:
|
||||
if (!index) return;
|
||||
results = _.chain(index.search(q)).map(function(result) {
|
||||
var parts = result.ref.split("#");
|
||||
return {
|
||||
path: parts[0],
|
||||
hash: parts[1]
|
||||
};
|
||||
})
|
||||
.value();
|
||||
}
|
||||
if (!index) return;
|
||||
|
||||
var results = _.chain(index.search(q))
|
||||
.map(function(result) {
|
||||
var parts = result.ref.split("#");
|
||||
return {
|
||||
path: parts[0],
|
||||
hash: parts[1]
|
||||
};
|
||||
})
|
||||
.value();
|
||||
|
||||
// [Yihui] Highlight the search keyword on current page
|
||||
$highlighted = $('.page-inner')
|
||||
$highlighted = results.length === 0 ? [] : $('.page-inner')
|
||||
.unhighlight(hiOpts).highlight(q, hiOpts).find('span.search-highlight');
|
||||
scrollToHighlighted(0);
|
||||
|
||||
@ -218,7 +172,6 @@ gitbook.require(["gitbook", "lodash", "jQuery"], function(gitbook, _, $) {
|
||||
gitbook.events.bind("start", function(e, config) {
|
||||
// [Yihui] disable search
|
||||
if (config.search === false) return;
|
||||
init(config);
|
||||
collapse = !config.toc || config.toc.collapse === 'section' ||
|
||||
config.toc.collapse === 'subsection';
|
||||
|
||||
|
12
docs/libs/header-attrs-2.9/header-attrs.js
Normal file
12
docs/libs/header-attrs-2.9/header-attrs.js
Normal file
@ -0,0 +1,12 @@
|
||||
// Pandoc 2.9 adds attributes on both header and div. We remove the former (to
|
||||
// be compatible with the behavior of Pandoc < 2.8).
|
||||
document.addEventListener('DOMContentLoaded', function(e) {
|
||||
var hs = document.querySelectorAll("div.section[class*='level'] > :first-child");
|
||||
var i, h, a;
|
||||
for (i = 0; i < hs.length; i++) {
|
||||
h = hs[i];
|
||||
if (!/^h[1-6]$/i.test(h.tagName)) continue; // it should be a header h1-h6
|
||||
a = h.attributes;
|
||||
while (a.length > 0) h.removeAttribute(a[0].name);
|
||||
}
|
||||
});
|
4
docs/libs/jquery-2.2.3/jquery.min.js
vendored
Normal file
4
docs/libs/jquery-2.2.3/jquery.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user