-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
223 additions
and
104 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -36,6 +36,7 @@ base/fonts | |
/slides/**/libs | ||
/slides/**/generated | ||
/slides/**/*.html | ||
!/slides/_common/** | ||
|
||
# others | ||
*.h5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,74 +1,70 @@ | ||
{{ if and (and (not .Params.disable_highlight) (in (string .Content) "</code>")) (not .IsHome) }} | ||
{{ $clipboardjsVersion := .Site.Params.clipboardjsVersion }} | ||
{{ $clipboardjsCDN := .Site.Params.clipboardjsCDN }} | ||
{{ $prismjsVersion := .Site.Params.prismjsVersion }} | ||
{{ $prismjsCDN := .Site.Params.prismjsCDN }} | ||
<script src="{{ $clipboardjsCDN }}/clipboard.js/{{ $clipboardjsVersion }}/clipboard.min.js"></script> | ||
<script src="{{ $prismjsCDN }}/prism/{{ $prismjsVersion }}/prism.min.js"></script> | ||
{{ range .Site.Params.prismjsPluginJS }} | ||
<script src="{{ $prismjsCDN }}/prism/{{ $prismjsVersion }}/plugins/{{ . }}/prism-{{ . }}.min.js"></script> | ||
{{ end }} | ||
<script src="//cdn.jsdelivr.net/npm/clipboard@{{ $.Site.Params.clipboardjsVersion }}/dist/clipboard.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@{{ $.Site.Params.prismjsVersion }}/prism.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@{{ $.Site.Params.prismjsVersion }}/plugins/autoloader/prism-autoloader.min.js"></script> | ||
<script src="//cdn.jsdelivr.net/npm/prismjs@{{ $.Site.Params.prismjsVersion }}/plugins/toolbar/prism-toolbar.min.js"></script> | ||
<script> | ||
(function() { | ||
if (!self.Prism) { | ||
return; | ||
} | ||
|
||
// 显示语言 | ||
Prism.languages.dos = Prism.languages.powershell; | ||
Prism.languages.gremlin = Prism.languages.groovy; | ||
(function() { | ||
if (!self.Prism) { | ||
return; | ||
} | ||
|
||
var Languages = { | ||
'r': 'R', 'python': 'Python', 'xml': 'XML', 'html': 'HTML', | ||
'yaml': 'YAML', 'latex': 'LaTeX', 'tex': 'TeX', | ||
'powershell': 'PowerShell', 'javascript': 'JavaScript', | ||
'dos': 'DOS', 'qml': 'QML', 'json': 'JSON', 'bash': 'Bash', | ||
'text': 'Text', 'txt': 'Text', 'sparql': 'SPARQL', | ||
'gremlin': 'Gremlin', 'cypher': 'Cypher', 'ngql': 'nGQL', | ||
'shell': 'Shell', 'sql': 'SQL', 'apacheconf': 'Apache Configuration' | ||
}; | ||
// 显示语言 | ||
Prism.languages.dos = Prism.languages.powershell; | ||
Prism.languages.gremlin = Prism.languages.groovy; | ||
|
||
Prism.hooks.add('before-highlight', function(env) { | ||
if (env.language !== 'plain') { | ||
var language = Languages[env.language] || env.language; | ||
env.element.setAttribute('data-language', language); | ||
} | ||
}); | ||
let languages = { | ||
'r': 'R', 'python': 'Python', 'xml': 'XML', 'html': 'HTML', | ||
'yaml': 'YAML', 'latex': 'LaTeX', 'tex': 'TeX', | ||
'powershell': 'PowerShell', 'javascript': 'JavaScript', | ||
'dos': 'DOS', 'qml': 'QML', 'json': 'JSON', 'bash': 'Bash', | ||
'text': 'Text', 'txt': 'Text', 'sparql': 'SPARQL', | ||
'gremlin': 'Gremlin', 'cypher': 'Cypher', 'ngql': 'nGQL', | ||
'shell': 'Shell', 'sql': 'SQL', 'apacheconf': 'Apache Configuration', 'c': 'C', 'css': 'CSS' | ||
}; | ||
|
||
// 复制代码 | ||
var ClipboardJS = window.ClipboardJS || undefined; | ||
Prism.hooks.add('before-highlight', function(env) { | ||
if (env.language !== 'plain') { | ||
let language = languages[env.language] || env.language; | ||
env.element.setAttribute('data-language', language); | ||
} | ||
}); | ||
|
||
Prism.plugins.toolbar.registerButton('copy-to-clipboard', function(env) { | ||
var linkCopy = document.createElement('button'); | ||
linkCopy.textContent = '复制'; | ||
// 复制代码 | ||
let ClipboardJS = window.ClipboardJS || undefined; | ||
|
||
registerClipboard(); | ||
Prism.plugins.toolbar.registerButton('copy-to-clipboard', function(env) { | ||
let linkCopy = document.createElement('button'); | ||
linkCopy.classList.add('prism-button-copy'); | ||
|
||
return linkCopy; | ||
registerClipboard(); | ||
|
||
function registerClipboard() { | ||
var clip = new ClipboardJS(linkCopy, { | ||
'text': function () { | ||
return env.code; | ||
} | ||
}); | ||
return linkCopy; | ||
|
||
clip.on('success', function() { | ||
linkCopy.textContent = '已复制'; | ||
resetText(); | ||
}); | ||
clip.on('error', function () { | ||
linkCopy.textContent = '按 Ctrl+C 复制'; | ||
resetText(); | ||
}); | ||
} | ||
function registerClipboard() { | ||
let clip = new ClipboardJS(linkCopy, { | ||
'text': function () { | ||
return env.code; | ||
} | ||
}); | ||
|
||
function resetText() { | ||
setTimeout(function () { | ||
linkCopy.textContent = '复制'; | ||
}, 3000); | ||
} | ||
clip.on('success', function() { | ||
linkCopy.classList.add('prism-button-copy-success'); | ||
resetText(); | ||
}); | ||
clip.on('error', function () { | ||
linkCopy.classList.add('prism-button-copy-error'); | ||
resetText(); | ||
}); | ||
})(); | ||
} | ||
|
||
function resetText() { | ||
setTimeout(function () { | ||
linkCopy.classList.remove('prism-button-copy-success'); | ||
linkCopy.classList.remove('prism-button-copy-error'); | ||
}, 1600); | ||
} | ||
}); | ||
})(); | ||
</script> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,3 @@ | ||
{{ if and (not .Params.disable_highlight) (in (string .Content) "</code>") }} | ||
{{ $prismjsVersion := .Site.Params.prismjsVersion }} | ||
{{ $prismjsCDN := .Site.Params.prismjsCDN }} | ||
<link rel="stylesheet" type="text/css" href="{{ $prismjsCDN }}/prism/{{ .Site.Params.prismjsVersion }}/themes/prism.min.css"> | ||
{{ range .Site.Params.prismjsPluginCSS }} | ||
<link rel="stylesheet" type="text/css" href="{{ $prismjsCDN }}/prism/{{ $prismjsVersion }}/plugins/{{ . }}/prism-{{ . }}.min.css"> | ||
{{ end }} | ||
<link rel="stylesheet" type="text/css" href="//cdn.jsdelivr.net/npm/prismjs@{{ $.Site.Params.prismjsVersion }}/themes/prism.min.css"> | ||
{{ end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
<script> | ||
MathJax = { | ||
loader: { | ||
load: ['[tex]/boldsymbol'] | ||
}, | ||
tex: { | ||
tags: "all", | ||
inlineMath: [['$','$'], ['\\(','\\)']], | ||
displayMath: [['$$','$$'], ['\\[','\\]']], | ||
processEscapes: true, | ||
processEnvironments: true, | ||
packages: { | ||
'[+]': ['boldsymbol'] | ||
} | ||
} | ||
}; | ||
</script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/jquery.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/[email protected]/lib/js/emojione.min.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-chtml-full.js"></script> | ||
<script src="https://cdn.jsdelivr.net/npm/pseudocode@latest/build/pseudocode.min.js"></script> | ||
<script type="text/javascript"> | ||
$(document).ready(function() { | ||
document.querySelectorAll( | ||
'.remark-slide-content' + | ||
':not(.title-slide)' + | ||
':not(.section)' + | ||
':not(.content)' + | ||
':not(.thanks)' | ||
).forEach(el => { | ||
el.innerHTML += '<a target="_black" href="https://leovan.me"><div class="logo"></div></a>'; | ||
}); | ||
|
||
$(".convert-emoji").each(function() { | ||
var original = $(this).html(); | ||
// use .shortnameToImage if only converting shortnames (for slightly better performance) | ||
var converted = emojione.toImage(original); | ||
$(this).html(converted); | ||
}); | ||
|
||
var captionCount = 0; | ||
$(".convert-pseudocode").each(function() { | ||
var pseudocode_options = { | ||
indentSize: '1.2em', | ||
commentDelimiter: '#', | ||
lineNumber: true, | ||
lineNumberPunc: ':', | ||
noEnd: false, | ||
captionCount: undefined | ||
}; | ||
pseudocode_options.captionCount = captionCount; | ||
|
||
var code = "\\begin{algorithm}\n"; | ||
if ($(this).attr("caption") != undefined) { | ||
code += "\\caption{" + $(this).attr("caption") + "}\n"; | ||
captionCount += 1; | ||
} | ||
code += "\\begin{algorithmic}\n"; | ||
code += $('<div/>').html($(this).html()).text(); | ||
code += "\\end{algorithmic}\n"; | ||
code += "\\end{algorithm}"; | ||
code = code.replace(/`\\\(/g, "$"); | ||
code = code.replace(/\\\)`/g, "$"); | ||
$(this).html(""); | ||
var parent = $(this).parent().get(0); | ||
pseudocode.render(code, parent, pseudocode_options); | ||
}); | ||
|
||
$(".remark-code-line").each(function() { | ||
var that = $(this); | ||
|
||
["ValueWarning", | ||
"warnings.warn", | ||
"## INFO:prophet", | ||
"%|", | ||
"WARNING:", | ||
"## Disabling daily seasonality", | ||
"cmdstanpy - INFO", | ||
"forecasts with cutoffs between", | ||
"n.changepoints greater than number of observations"].forEach(function(keyword) { | ||
if (that.html().includes(keyword)) { | ||
that.remove(); | ||
} | ||
}); | ||
|
||
["## ", "..."].forEach(function(keyword) { | ||
if (that.html() === keyword) { | ||
that.remove(); | ||
} | ||
}); | ||
}); | ||
}); | ||
</script> |
Oops, something went wrong.