Compare commits

...

65 Commits

Author SHA1 Message Date
Ludwig Schubert fbfacdc7bb Add deprecation warning 2018-03-30 11:35:41 -07:00
Ludwig Schubert 90543f80a4 Update README.md 2018-03-30 11:33:42 -07:00
Ludwig Schubert 22d196c5c9 Add additional license files to v1 branch 2018-03-30 11:32:36 -07:00
Ludwig Schubert d033a2a17b Add license to deprecated v1 code 2018-03-30 11:30:29 -07:00
Ludwig Schubert 5ed282b1a4 Update README.md 2017-08-25 09:57:02 -07:00
Ludwig Schubert 6422c27090 Try enabling travis builds with Github releases 2017-08-24 11:01:10 -07:00
Shan Carter adba0f6e9b Update styles-article.css 2017-07-19 15:09:27 -07:00
Shan Carter 84503f98ae Merge pull request #45 from JonathanRaiman/patch-2
Remove ES6 arrow functions from hover-box
2017-06-27 16:35:47 -07:00
Jonathan Raiman 940b70ce5b Remove ES6 arrow functions from hover-box
Browsers such as Safari do not natively understand ES6 functions, thus during development only Chrome can be used when the hover box is imported into the page.
(On Safari the following error occurs: ```SyntaxError: Unexpected token ')'
appendChild — index.html:77
hoverBox — template.v1.js:18012
renderOnLoad — template.v1.js:18217
(anonymous function) — template.v1.js:18227
```, this is caused by the function arrow notation not being parsed).
2017-06-17 00:12:33 -07:00
Shan Carter c884d2f018 1.1.0 2017-06-16 10:35:05 -07:00
Shan Carter 5ed8b40f23 Removing console.log build 2017-06-16 10:29:30 -07:00
Shan Carter 6f4a44227f Update code.js
Removing console.log
2017-06-16 10:27:20 -07:00
Shan Carter 2c9850920b Merge branch 'ludwigschubert-master' 2017-06-16 10:12:10 -07:00
Shan Carter 0abf0247e2 Adding a few more languages. 2017-06-16 10:08:10 -07:00
Ludwig Schubert 5c4b1108b6 Add support for python and clike languages to prismjs highlighting 2017-06-15 14:53:49 -07:00
Shan Carter 11b5186394 Fixing window variable not defined 2017-06-06 11:44:44 -07:00
Shan Carter 04fa4ebb8c Created date in meta fields 2017-06-01 17:03:01 -07:00
Shan Carter 5292390ba8 Adding footer info 2017-06-01 15:39:03 -07:00
Christopher Olah 0f9e12b1f1 Merge pull request #39 from jppgks/table-centered
Add table element to centered styling rules
2017-04-18 08:47:17 -07:00
Joppe Geluykens e606c84700 feat: add table element to centered styling rules 2017-04-18 08:17:11 +02:00
Shan Carter f96ba800d8 1.0.3 2017-04-17 12:14:26 -07:00
Shan Carter 84c90fbef4 Fixes link to citation. Fixes #33 2017-04-17 12:14:18 -07:00
Shan Carter 0344bc2704 1.0.2 2017-04-17 11:52:49 -07:00
Shan Carter afc798f7a0 Adding table styles 2017-04-17 11:52:22 -07:00
Shan Carter cecaa95989 Merge pull request #32 from bfirsh/fix-hover-box-on-ios
Fix hover box on touch screens
2017-04-17 11:30:47 -07:00
Christopher Olah 87d1276564 Merge pull request #35 from jppgks/fix-ol-issue-#34
Add ol tag to dt-article css rules
2017-04-17 10:23:21 -07:00
Joppe Geluykens 397bc72df0 build(yarn): add compiled js closing #34 2017-04-17 11:42:20 +02:00
Joppe Geluykens b19b918466 fix(#34): add ol tag to dt-article css rules
Ordered list wasn't following the article rules, which lead to alignment issues.
2017-04-17 11:32:47 +02:00
Shan Carter aef31660cc Adding archive link to footer 2017-04-14 10:37:52 -07:00
Ben Firshman 22b1f06a12 Fix hover box on touch screens
Relying on the mouse events made the boxes on touch screens really
janky. I have:

- Made opening/closing the touch box purely use touchstart events
  so it is more reliable and responsive
- Made tapping anywhere outside the box close it
- Refactored binding into separate link and div functions so that
  the touch events can be bound correctly
2017-04-14 13:23:11 +02:00
Shan Carter 6394270d58 Removing console 2017-04-13 17:40:41 -07:00
Shan Carter 788546b8ca Adding escape-html 2017-04-13 17:21:06 -07:00
Shan Carter b3efa2526d Adding initial math support 2017-04-13 16:49:00 -07:00
Shan Carter c24a1d0485 Fixing katex incompatibility 2017-04-13 12:52:59 -07:00
Shan Carter 7a5a9bbe74 Merge branch 'master' of https://github.com/distillpub/distill-template 2017-04-13 12:34:29 -07:00
Christopher Olah a8c29e227a Merge pull request #28 from bcipolli/bcipolli-patch-1
dispalying => displaying
2017-04-10 14:05:02 -07:00
Ben Cipollini be4e9453c2 dispalying => displaying 2017-04-10 03:24:59 -07:00
Christopher Olah 22fd0e2b21 better hover box system 2017-04-06 15:10:35 -07:00
Shan Carter f362584a74 Adding scaffolds and moving data around 2017-03-30 16:11:23 -07:00
Shan Carter a85517e61b 1.0.1 2017-03-22 16:27:11 -07:00
Shan Carter 1b7964f626 Extracting distill specific sections from the template 2017-03-22 16:26:45 -07:00
Shan Carter befa67b4dd Merge branch 'master' of https://github.com/distillpub/distill-template 2017-03-22 16:16:56 -07:00
Christopher Olah f3578fbf15 fix bibtex field case issue 2017-03-22 16:07:01 -07:00
Shan Carter 56e8de28c4 Update README.md 2017-03-22 11:01:47 -07:00
Shan Carter a770e93ec9 Update README.md 2017-03-22 11:00:46 -07:00
Shan Carter dceed2ac71 Merge branch 'master' of https://github.com/distillpub/distill-template 2017-03-22 10:56:58 -07:00
Shan Carter ac37a19124 1.0.0 2017-03-22 10:56:41 -07:00
Shan Carter e622bd0caa Update README.md 2017-03-22 10:55:42 -07:00
Shan Carter cdb4263487 Update README.md 2017-03-22 10:55:32 -07:00
Shan Carter 9e14a84149 Update README.md 2017-03-22 10:54:38 -07:00
Shan Carter abea1dad49 Merge branch 'ontouchstart-dismiss-citation-popup-ontouchend' 2017-03-22 10:46:44 -07:00
Shan Carter c4c94867bf Merging 2017-03-22 10:46:04 -07:00
Shan Carter 4bd4c4dcf9 fixing urls 2017-03-22 09:24:37 -07:00
Sam Liu bf0cefac67 dismiss-citation-popup-ontouchend 2017-03-22 12:16:36 -04:00
Shan Carter f2cbc9ead4 Adding links to footer 2017-03-20 17:01:41 -07:00
Shan Carter f6cb5bed7d build 2017-03-20 10:32:44 -07:00
Shan Carter 2fd62c518d Merge branch 'master' of https://github.com/distillpub/distill-template 2017-03-20 10:32:25 -07:00
Shan Carter 6c2a450662 twitter images 2017-03-20 10:32:15 -07:00
Christopher Olah af02c0a845 fix links in top bar 2017-03-20 10:31:06 -07:00
Shan Carter eb8bc670c9 Fixing links 2017-03-20 08:44:40 -07:00
Shan Carter 6721d1f2db Removing distill header from dev 2017-03-18 19:35:58 -07:00
Christopher Olah b439644064 update scholar meta stuff 2017-03-15 10:14:04 -07:00
Christopher Olah 7698d45885 new dist 2017-03-14 15:09:49 -07:00
Christopher Olah b5d5e2a2f1 add new escape-html 2017-03-14 15:09:35 -07:00
Christopher Olah 47ed46b52f fix meta to be more compliant with scholar 2017-03-14 15:08:56 -07:00
43 changed files with 11023 additions and 422 deletions
+18
View File
@@ -0,0 +1,18 @@
language: node_js
node_js:
- "node" # latest version
cache:
yarn: true
directories:
- node_modules
script:
- yarn build
deploy:
provider: releases
api_key: $GITHUB_OAUTH_TOKEN
file_glob: true
file: dist/*
skip_cleanup: true
overwrite: true
on:
tags: true
+6
View File
@@ -0,0 +1,6 @@
# This is the list of The Distill Template authors for copyright purposes.
#
# This does not necessarily list everyone who has contributed code, since in
# some cases, their employer may be the copyright holder. To see the full list
# of contributors, see the revision history in source control.
Google LLC
+28
View File
@@ -0,0 +1,28 @@
# How to Contribute
We'd love to accept your patches and contributions to this project. There are
just a few small guidelines you need to follow.
## Contributor License Agreement
Contributions to this project must be accompanied by a Contributor License
Agreement. You (or your employer) retain the copyright to your contribution,
this simply gives us permission to use and redistribute your contributions as
part of the project. Head over to <https://cla.developers.google.com/> to see
your current agreements on file or to sign a new one.
You generally only need to submit a CLA once, so if you've already submitted one
(even if it was for a different project), you probably don't need to do it
again.
## Code reviews
All submissions, including submissions by project members, require review. We
use GitHub pull requests for this purpose. Consult
[GitHub Help](https://help.github.com/articles/about-pull-requests/) for more
information on using pull requests.
## Community Guidelines
This project follows [Google's Open Source Community
Guidelines](https://opensource.google.com/conduct/).
Executable
+202
View File
@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+23 -5
View File
@@ -1,9 +1,27 @@
# Distill Templates
_This is an outdated version of the Distill template. Please switch to the master branch for the current version._
## Development
# Distill Template v1
Run `yarn start` to start a watching build rollup server.
This is the repository for the Distill web framework.
## Testing
## Contributing
Run `yarn test`. That's it.
To give feedback, report a bug, or request a feature, please open an issue.
To contribute a change, [check out the contributing guide](CONTRIBUTING.md).
### Local Development
Run `npm run start` to start a watching build rollup server. To view the sample pages in the repo, you can run `npm run serve` as a separate process which starts a static server. `npm run build` will run a one-time build.
## Disclaimer & License
_This project is research code. It is not an official product of Google or any other institution supporting Distill._
Copyright 2018, The Distill Template Authors.
Licensed under the Apache License, Version 2.0
See the [full license](LICENSE).
+42
View File
@@ -0,0 +1,42 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom, data) {
let el = dom.querySelector('dt-appendix > div');
if (el) {
let newHTML = "";
newHTML += `<h3>Updates and Corrections</h3>
<p><a href="${data.githubCompareUpdatesUrl}">View all changes</a> to this article since it was first published. If you see a mistake or want to suggest a change, please <a class="github-issue" href="${data.githubUrl}/issues/new">create an issue on GitHub</a>.</p>`;
newHTML += `<h3 id="citation">Citations and Reuse</h3>
<p>Diagrams and text are licensed under Creative Commons Attribution <a href="https://creativecommons.org/licenses/by/2.0/">CC-BY 2.0</a>, unless noted otherwise, with the <a class="github" href="${data.githubUrl}">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>
<p>For attribution in academic contexts, please cite this work as</p>
<pre class="citation short">${data.concatenatedAuthors}, "${data.title}", ${data.journal.title}, ${data.publishedYear}. http://doi.org/${data.doi}</pre>
<p>BibTeX citation</p>
<pre class="citation long">@article{${data.slug},
author = {${data.bibtexAuthors}},
title = {${data.title}},
journal = {${data.journal.title}},
year = {${data.publishedYear}},
url = {${data.url}},
doi = {${data.doi}}
}</pre>`;
let existingHTML = el.innerHTML;
el.innerHTML = existingHTML + newHTML;
}
}
+25 -28
View File
@@ -1,4 +1,18 @@
const html = `
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const templateHTML = `
<style>
dt-appendix {
display: block;
@@ -45,45 +59,28 @@ const html = `
</style>
<div class="l-body">
<h3>References</h3>
<dt-bibliography></dt-bibliography>
<h3 id="citation">Errors, Reuse, and Citation</h3>
<p>If you see mistakes or want to suggest changes, please <a class="github-issue">create an issue on GitHub</a>.</p>
<p>Diagrams and text are licensed under Creative Commons Attribution <a href="https://creativecommons.org/licenses/by/2.0/">CC-BY 2.0</a>, unless noted otherwise, with the <a class="github">source available on GitHub</a>. The figures that have been reused from other sources don't fall under this license and can be recognized by a note in their caption: “Figure from …”.</p>
<p>For attribution in academic contexts, please cite this work as</p>
<pre class="citation short"></pre>
<p>BibTeX citation</p>
<pre class="citation long"></pre>
</div>
`;
export default function(dom, data) {
let el = dom.querySelector('dt-appendix')
if (el) {
let oldHtml = el.innerHTML;
el.innerHTML = html;
let div = el.querySelector("div.l-body")
let userHTML = el.innerHTML;
el.innerHTML = templateHTML;
let newHTML = "";
// If we have some footnotes on the page, render a container for the footnote list.
if (dom.querySelector("dt-fn")) {
div.innerHTML = `<h3>Footnotes</h3><dt-fn-list></dt-fn-list>` + div.innerHTML;
newHTML = newHTML + `<h3>Footnotes</h3><dt-fn-list></dt-fn-list>`;
}
div.innerHTML = oldHtml + div.innerHTML;
if (data.githubCompareUpdatesUrl) {
div.innerHTML = `<h3>Updates</h3><p><a href="${data.githubCompareUpdatesUrl}">View all changes</a> to this article since it was first published.</p>` + div.innerHTML;
// If we have any citations on the page, render a container for the bibliography.
if (dom.querySelector("dt-cite")) {
newHTML = newHTML + `<h3>References</h3><dt-bibliography></dt-bibliography>`;
}
el.querySelector("a.github").setAttribute("href", data.githubUrl);
el.querySelector("a.github-issue").setAttribute("href", data.githubUrl + "/issues/new");
el.querySelector(".citation.short").textContent = data.concatenatedAuthors + ", " + '"' + data.title + '", Distill, ' + data.publishedYear + ".";
var bibtex = "@article{" + data.slug + ",\n";
bibtex += " author = {" + data.bibtexAuthors + "},\n";
bibtex += " title = {" + data.title + "},\n";
bibtex += " journal = {Distill},\n";
bibtex += " year = {" + data.publishedYear + "},\n";
bibtex += " note = {" + data.url + "}\n";
bibtex += "}";
el.querySelector(".citation.long").textContent = bibtex;
let div = el.querySelector("div.l-body")
div.innerHTML = userHTML + newHTML;
}
}
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
const html = `
<style>
dt-banner {
+15 -20
View File
@@ -1,8 +1,21 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import bibtexParse from "bibtex-parse-js";
export default function(dom, data) {
let el = dom.querySelector('script[type="text/bibliography"]');
let citations = [];
let bibliography = {};
//TODO If we don't have a local element, make a request for the document.
if (el) {
@@ -17,30 +30,12 @@ export default function(dom, data) {
(full, x, char) => char);
val = val.replace(/{\\([a-zA-Z])}/g,
(full, char) => char);
e.entryTags[k] = val;
e.entryTags[k.toLowerCase()] = val;
}
bibliography[e.citationKey] = e.entryTags;
bibliography[e.citationKey].type = e.entryType;
});
}
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
citeTags.forEach(el => {
let key = el.getAttribute("key");
if (key) {
let citationKeys = key.split(",");
citationKeys.forEach(key => {
if (citations.indexOf(key) == -1){
citations.push(key);
if (!(key in bibliography)){
console.warn("No bibliography entry found for: " + key);
}
}
});
}
});
}
data.bibliography = bibliography;
data.citations = citations;
}
+18
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import mustache from "mustache";
const html = `
@@ -134,14 +148,18 @@ const template = `
</div>
{{/authors}}
</div>
{{#publishedYear}}
<div class="date">
<div class="month">{{publishedMonth}}. {{publishedDay}}</div>
<div class="year">{{publishedYear}}</div>
</div>
{{/publishedYear}}
{{#publishedYear}}
<a class="citation" href="#citation">
<div>Citation:</div>
<div>{{concatenatedAuthors}}, {{publishedYear}}</div>
</a>
{{/publishedYear}}
</div>
`
+36 -2
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom, data) {
let css = `
dt-cite {
@@ -35,6 +49,25 @@ export default function(dom, data) {
return a.author.localeCompare(b.author);
});
}*/
var appendCiteHoverDiv = (function() {
function nodeFromString(str) {
var div = dom.createElement("div");
div.innerHTML = str;
return div.firstChild;
}
var hover_boxes_container = nodeFromString(`<div id="cite-hover-boxes-container"></div>`)
dom.querySelector("body").appendChild(hover_boxes_container);
var hover_n = 0;
return function appendHoverDiv(content) {
var id = `dt-cite-hover-box-${hover_n}`;
hover_n += 1;
var str = `<div style="display:none;" class="dt-hover-box" id="${id}" >${content}</div>`;
var div = nodeFromString(str);
hover_boxes_container.appendChild(div);
return id;
}
})();
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
citeTags.forEach((el,n) => {
@@ -47,10 +80,11 @@ export default function(dom, data) {
if (n>0) cite_hover_str += "<br><br>";
cite_hover_str += hover_cite(data.bibliography[key]);
});
cite_hover_str = cite_hover_str.replace(/"/g, "&#39;")
var ref_id = appendCiteHoverDiv(cite_hover_str);
//cite_hover_str = cite_hover_str.replace(/"/g, "&#39;")
var orig_string = el.innerHTML;
if (orig_string != "") orig_string += " ";
el.innerHTML = `<span id="citation-${n}" data-hover="${cite_hover_str}">${orig_string}<span class="citation-number">${cite_string}</span></span>`;
el.innerHTML = `<span id="citation-${n}" data-hover-ref="${ref_id}">${orig_string}<span class="citation-number">${cite_string}</span></span>`;
}
});
+22
View File
@@ -1,4 +1,26 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import Prism from "prismjs";
import "prismjs/components/prism-python";
import "prismjs/components/prism-clike";
import "prismjs/components/prism-lua";
import "prismjs/components/prism-bash";
import "prismjs/components/prism-go";
import "prismjs/components/prism-markdown";
import "prismjs/components/prism-julia";
export default function(dom, data) {
let codeElements = [].slice.call(dom.querySelectorAll("dt-code"));
+166
View File
@@ -0,0 +1,166 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import {timeFormat} from "d3-time-format";
export default function(dom, data) {
//
// Properties from source
//
// title: 'Attention and Augmented Recurrent Neural Networks',
// description: 'A visual overview of neural attention, and the powerful extensions of neural networks being built on top of it.',
// url: 'http://distill.pub/2016/augmented-rnns',
// tags: [ 'rnn' ],
// doiSuffix: 1,
// doi: '10.23915/distill.00001',
// volume: 1,
// issue: 9,
// distillPath: '2016/augmented-rnns',
// githubPath: 'distillpub/post--augmented-rnns',
// githubCompareUpdatesUrl: 'https://github.com/distillpub/post--augmented-rnns/compare/1596e094d8943d2dc0ea445d92071129c6419c59...3bd9209e0c24d020f87cf6152dcecc6017cbc193',
// updatedDate: 2017-03-21T07:13:16.000Z,
// publishedDate: 2016-09-08T07:00:00.000Z,
// journal: {
// "title": "Distill",
// "full_title": "Distill",
// "abbrev_title": "Distill",
// "url": "http://distill.pub",
// "doi": "10.23915/distill",
// "publisherName": "Distill Working Group",
// "publisherEmail": "admin@distill.pub",
// "issn": "2476-0757",
// "editors": [...],
// "committee": [...]
// }
//
// Computed Properties
//
// githubUrl: 'https://github.com/distillpub/post--augmented-rnns',
// previewURL: 'http://distill.pub/2016/augmented-rnns/thumbnail.jpg',
// publishedDateRFC: 'Thu, 08 Sep 2016 00:00:00 -0700',
// publishedYear: 2016,
// publishedMonth: 'Sept',
// publishedDay: 8,
// publishedMonthPadded: '09',
// publishedDayPadded: '08',
// updatedDateRFC: 'Tue, 21 Mar 2017 00:13:16 -0700',
// concatenatedAuthors: 'Olah & Carter',
// bibtexAuthors: 'Olah, Chris and Carter, Shan',
// slug: 'olah2016attention'
// authors: [
// {
// "personalURL": null,
// "name": "Chris Olah",
// "firstName": "Chris",
// "lastName": "Olah",
// "affiliationURL": null,
// "affiliation": "Google Brain"
// }
// ],
// bibliography: {
// "gregor2015draw": {
// "title": "DRAW: A recurrent neural network for image generation",
// "author": "Gregor, Karol and Danihelka, Ivo and Graves, Alex and Rezende, Danilo Jimenez and Wierstra, Daan",
// "journal": "arXiv preprint arXiv:1502.04623",
// "year": "2015",
// "url": "https://arxiv.org/pdf/1502.04623.pdf",
// "type": "article"
// },
// ...
// },
// citations: [
// "gregor2015draw",
// "mercier2011humans",
// "dong2014image",
// "dumoulin2016guide",
// "mordvintsev2015inceptionism"
// ],
// citations:
let citations = [];
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
citeTags.forEach(el => {
let key = el.getAttribute("key");
if (key) {
let citationKeys = key.split(",");
citationKeys.forEach(key => {
if (citations.indexOf(key) == -1){
citations.push(key);
if (!(key in data.bibliography)){
console.warn("No bibliography entry found for: " + key);
}
}
});
}
});
data.citations = citations;
data.authors = data.authors || [];
// paths
if (!data.distillPath && !data.url) {
data.url = "http://distill.pub/";
} else if (!data.url) {
data.url = "http://distill.pub/" + data.distillPath;
}
data.githubUrl = "https://github.com/" + data.githubPath;
data.previewURL = data.previewURL ? data.previewURL : data.url + "/thumbnail.jpg"
// Homepage
//data.homepage = !post.noHomepage;
data.journal = data.journal || {};
// Dates
if (data.publishedDate){//} && data.journal) {
data.volume = data.publishedDate.getFullYear() - 2015;
data.issue = data.publishedDate.getMonth() + 1;
}
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
data.publishedDateRFC
let RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
let months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
data.publishedDateRFC = RFC(data.publishedDate);
data.publishedYear = data.publishedDate.getFullYear();
data.publishedMonth = months[data.publishedDate.getMonth()];
data.publishedDay = data.publishedDate.getDate();
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
data.updatedDateRFC = RFC(data.updatedDate);
if (data.authors.length > 2) {
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
} else if (data.authors.length === 2) {
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
} else if (data.authors.length === 1) {
data.concatenatedAuthors = data.authors[0].lastName
}
data.bibtexAuthors = data.authors.map(function(author){
return author.lastName + ", " + author.firstName;
}).join(" and ");
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
}
+32
View File
@@ -0,0 +1,32 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import katex from "katex";
const html = `
<style>
dt-math[block] {
display: block;
}
</style>
`;
export default function(dom, data) {
let equationElements = [].slice.call(dom.querySelectorAll("dt-math"));
equationElements.forEach(el => {
let content = el.textContent;
let displayMode = el.hasAttribute("block") ? true : false;
el.innerHTML = html + katex.renderToString(content, {displayMode: displayMode});
});
}
-50
View File
@@ -1,50 +0,0 @@
import {timeFormat} from "d3-time-format";
export default function(dom, data) {
data.authors = data.authors || [];
// paths
data.url = "http://distill.pub/" + data.distillPath;
data.githubUrl = "https://github.com/" + data.githubPath;
// Homepage
//data.homepage = !post.noHomepage;
data.journal = data.journal || {};
// Dates
if (data.publishedDate){//} && data.journal) {
data.volume = data.publishedDate.getFullYear() - 2015;
data.issue = data.publishedDate.getMonth() + 1;
}
data.publishedDate = data.publishedDate ? data.publishedDate : new Date("Invalid");
data.updatedDate = data.updatedDate ? data.updatedDate : new Date("Invalid");
data.publishedDateRFC
let RFC = timeFormat("%a, %d %b %Y %H:%M:%S %Z");
let months = ["Jan", "Feb", "March", "April", "May", "June", "July", "Aug", "Sept", "Oct", "Nov", "Dec"];
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
data.publishedDateRFC = RFC(data.publishedDate);
data.publishedYear = data.publishedDate.getFullYear();
data.publishedMonth = months[data.publishedDate.getMonth()];
data.publishedDay = data.publishedDate.getDate();
data.publishedMonthPadded = zeroPad(data.publishedDate.getMonth() + 1);
data.publishedDayPadded = zeroPad(data.publishedDate.getDate());
data.updatedDateRFC = RFC(data.updatedDate);
if (data.authors.length > 2) {
data.concatenatedAuthors = data.authors[0].lastName + ", et al.";
} else if (data.authors.length === 2) {
data.concatenatedAuthors = data.authors[0].lastName + " & " + data.authors[1].lastName;
} else if (data.authors.length === 1) {
data.concatenatedAuthors = data.authors[0].lastName
}
data.bibtexAuthors = data.authors.map(function(author){
return author.lastName + ", " + author.firstName;
}).join(" and ");
data.slug = data.authors.length ? data.authors[0].lastName.toLowerCase() + data.publishedYear + data.title.split(" ")[0].toLowerCase() : "Untitled";
}
+36 -2
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import logo from "./distill-logo.svg";
let html = `
@@ -29,13 +43,33 @@ dt-footer .logo {
text-decoration: none;
margin-right: 6px;
}
dt-footer .nav {
margin-top: 12px;
}
dt-footer .nav a {
color: rgba(255, 255, 255, 0.8);
margin-right: 6px;
}
</style>
<div class="l-screen-inset">
<div class="l-page">
<div class="description">
<a href="/" class="logo">
${logo}
Distill
</a> is dedicated to clear explanations of machine learning
</a>
is dedicated to clear explanations of machine learning
</div>
<div class="nav">
<a href="http://distill.pub/about/">About</a>
<a href="http://distill.pub/journal/">Submit</a>
<a href="http://distill.pub/prize/">Prize</a>
<a href="http://distill.pub/archive/">Archive</a>
<a href="http://distill.pub/rss.xml">RSS</a>
<a href="https://github.com/distillpub">GitHub</a>
<a href="https://twitter.com/distillpub">Twitter</a>
&nbsp;&nbsp;&nbsp;&nbsp; ISSN 2476-0757
</div>
</div>
`;
+36 -1
View File
@@ -1,14 +1,49 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom, data) {
var appendFootnoteHoverDiv = (function() {
function nodeFromString(str) {
var div = dom.createElement("div");
div.innerHTML = str;
return div.firstChild;
}
var hover_boxes_container = nodeFromString(`<div id="footnote-hover-boxes-container"></div>`)
dom.querySelector("body").appendChild(hover_boxes_container);
var hover_n = 0;
return function appendHoverDiv(content) {
var id = `dt-fn-hover-box-${hover_n}`;
hover_n += 1;
var str = `<div style="display:none;" class="dt-hover-box" id="${id}" >${content}</div>`;
var div = nodeFromString(str);
hover_boxes_container.appendChild(div);
return id;
}
})();
var fnTags = [].slice.apply(dom.querySelectorAll("dt-fn"));
var fnContent = [];
fnTags.forEach((el,n) => {
var content = el.innerHTML;
var ref_id = appendFootnoteHoverDiv(content)
fnContent.push(content);
n = (n+1)+"";
var key = "fn-"+n;
var escaped_content = content.replace(/"/g, "&#39;");
el.innerHTML = `<sup><span id="${key}" data-hover="${escaped_content}" style="cursor:pointer">${n}</span></sup>`;
el.innerHTML = `<sup><span id="${key}" data-hover-ref="${ref_id}" style="cursor:pointer">${n}</span></sup>`;
});
let fnList = dom.querySelector("dt-fn-list");
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import ymlParse from "js-yaml";
export default function(dom, data) {
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//import xml from "xml";
export default function(data) {
+17 -3
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import logo from "./distill-logo.svg";
const html = `
@@ -72,9 +86,9 @@ dt-header .nav a {
Distill
</a>
<div class="nav">
<a href="/faq">About</a>
<a href="https://github.com/distillpub">GitHub</a>
<!-- https://twitter.com/distillpub -->
<a href="/about/">About</a>
<a href="/prize/">Prize</a>
<a href="/journal/">Submit</a>
</div>
</div>
`
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import code from './hover-box.txt';
export default function(dom) {
+114 -99
View File
@@ -1,96 +1,4 @@
// DistillHoverBox
//=====================================
function DistillHoverBox(key, pos){
if (!(key in DistillHoverBox.contentMap)){
console.error("No DistillHoverBox content registered for key", key);
}
if (key in DistillHoverBox.liveBoxes) {
console.error("There already exists a DistillHoverBox for key", key);
} else {
for (var k in DistillHoverBox.liveBoxes)
DistillHoverBox.liveBoxes[k].remove();
DistillHoverBox.liveBoxes[key] = this;
}
this.key = key;
var pretty = window.innerWidth > 600;
var padding = pretty? 18 : 12;
var outer_padding = pretty ? 18 : 0;
var bbox = document.querySelector("body").getBoundingClientRect();
var left = pos[0] - bbox.left, top = pos[1] - bbox.top;
var width = Math.min(window.innerWidth-2*outer_padding, 648);
left = Math.min(left, window.innerWidth-width-outer_padding);
width = width - 2*padding;
var str = `<div style="position: absolute;
background-color: #FFF;
white-s
opacity: 0.95;
max-width: ${width}px;
top: ${top}px;
left: ${left}px;
border: 1px solid rgba(0, 0, 0, 0.25);
padding: ${padding}px;
border-radius: ${pretty? 3 : 0}px;
box-shadow: 0px 2px 10px 2px rgba(0, 0, 0, 0.2);
z-index: ${1e6}" >
${DistillHoverBox.contentMap[key]}
</div>`;
this.div = appendBody(str);
DistillHoverBox.bind (this.div, key);
}
DistillHoverBox.prototype.remove = function remove(){
if (this.div) this.div.remove();
if (this.timeout) clearTimeout(this.timeout);
delete DistillHoverBox.liveBoxes[this.key];
}
DistillHoverBox.prototype.stopTimeout = function stopTimeout() {
if (this.timeout) clearTimeout(this.timeout);
}
DistillHoverBox.prototype.extendTimeout = function extendTimeout(T) {
//console.log("extend", T)
var this_ = this;
this.stopTimeout();
this.timeout = setTimeout(() => this_.remove(), T);
}
DistillHoverBox.liveBoxes = {};
DistillHoverBox.contentMap = {};
DistillHoverBox.bind = function bind(node, key) {
if (typeof node == "string"){
node = document.querySelector(node);
}
node.addEventListener("mouseover", () => {
var bbox = node.getBoundingClientRect();
if (!(key in DistillHoverBox.liveBoxes)){
new DistillHoverBox(key, [bbox.right, bbox.bottom]);
}
DistillHoverBox.liveBoxes[key].stopTimeout();
});
node.addEventListener("mouseout", () => {
if (key in DistillHoverBox.liveBoxes){
DistillHoverBox.liveBoxes[key].extendTimeout(250);
}
});
}
function appendBody(str){
var node = nodeFromString(str);
var body = document.querySelector("body");
body.appendChild(node);
return node;
}
function nodeFromString(str) {
var div = document.createElement("div");
@@ -98,11 +6,118 @@ function nodeFromString(str) {
return div.firstChild;
}
var hover_es = document.querySelectorAll("span[data-hover]");
function make_hover_css(pos) {
var pretty = window.innerWidth > 600;
var padding = pretty? 18 : 12;
var outer_padding = pretty ? 18 : 0;
var bbox = document.querySelector("body").getBoundingClientRect();
var left = pos[0] - bbox.left, top = pos[1] - bbox.top;
var width = Math.min(window.innerWidth-2*outer_padding, 648);
left = Math.min(left, window.innerWidth-width-outer_padding);
width = width - 2*padding;
return (`position: absolute;
background-color: #FFF;
opacity: 0.95;
max-width: ${width}px;
top: ${top}px;
left: ${left}px;
border: 1px solid rgba(0, 0, 0, 0.25);
padding: ${padding}px;
border-radius: ${pretty? 3 : 0}px;
box-shadow: 0px 2px 10px 2px rgba(0, 0, 0, 0.2);
z-index: ${1e6};`);
}
function DtHoverBox(div_id) {
this.div = document.querySelector("#"+div_id);
this.visible = false;
this.bindDivEvents();
DtHoverBox.box_map[div_id] = this;
}
DtHoverBox.box_map = {};
DtHoverBox.get_box = function get_box(div_id) {
if (div_id in DtHoverBox.box_map) {
return DtHoverBox.box_map[div_id];
} else {
return new DtHoverBox(div_id);
}
}
DtHoverBox.prototype.show = function show(pos){
this.visible = true;
this.div.setAttribute("style", make_hover_css(pos) );
for (var box_id in DtHoverBox.box_map) {
var box = DtHoverBox.box_map[box_id];
if (box != this) box.hide();
}
}
DtHoverBox.prototype.showAtNode = function showAtNode(node){
var bbox = node.getBoundingClientRect();
this.show([bbox.right, bbox.bottom]);
}
DtHoverBox.prototype.hide = function hide(){
this.visible = false;
if (this.div) this.div.setAttribute("style", "display:none");
if (this.timeout) clearTimeout(this.timeout);
}
DtHoverBox.prototype.stopTimeout = function stopTimeout() {
if (this.timeout) clearTimeout(this.timeout);
}
DtHoverBox.prototype.extendTimeout = function extendTimeout(T) {
//console.log("extend", T)
var this_ = this;
this.stopTimeout();
this.timeout = setTimeout(function(){this_.hide();}.bind(this), T);
}
// Bind events to a link to open this box
DtHoverBox.prototype.bind = function bind(node) {
if (typeof node == "string"){
node = document.querySelector(node);
}
node.addEventListener("mouseover", function(){
if (!this.visible) this.showAtNode(node);
this.stopTimeout();
}.bind(this));
node.addEventListener("mouseout", function(){this.extendTimeout(250);}.bind(this));
node.addEventListener("touchstart", function(e) {
if (this.visible) {
this.hide();
} else {
this.showAtNode(node);
}
// Don't trigger body touchstart event when touching link
e.stopPropagation();
}.bind(this));
}
DtHoverBox.prototype.bindDivEvents = function bindDivEvents(){
// For mice, same behavior as hovering on links
this.div.addEventListener("mouseover", function(){
if (!this.visible) this.showAtNode(node);
this.stopTimeout();
}.bind(this));
this.div.addEventListener("mouseout", function(){this.extendTimeout(250);}.bind(this));
// Don't trigger body touchstart event when touching within box
this.div.addEventListener("touchstart", function(e){e.stopPropagation();});
// Close box when touching outside box
document.body.addEventListener("touchstart", function(){this.hide();}.bind(this));
}
var hover_es = document.querySelectorAll("span[data-hover-ref]");
hover_es = [].slice.apply(hover_es);
hover_es.forEach((e,n) => {
var key = "hover-"+n;
var content = e.getAttribute("data-hover");
DistillHoverBox.contentMap[key] = content;
DistillHoverBox.bind(e, key);
});
hover_es.forEach(function(e,n){
var ref_id = e.getAttribute("data-hover-ref");
DtHoverBox.get_box(ref_id).bind(e);
})
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom) {
if (!dom.querySelector("html").getAttribute("lang")) {
dom.querySelector("html").setAttribute("lang", "en")
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import fetch from "fetch";
let fetchUrl = fetch.fetchUrl
+14
View File
@@ -0,0 +1,14 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import marked from 'marked';
marked.setOptions({
+51 -10
View File
@@ -1,12 +1,27 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import favicon from './distill-favicon.base64';
import escape from 'escape-html';
export default function(dom, data) {
let head = dom.querySelector("head");
let appendHead = html => appendHtml(head, html);
function meta(name, content) {
if (content)
appendHead(` <meta name="${name}" content="${content}" >\n`);
function meta(name, content, force) {
if (content || force)
appendHead(` <meta name="${name}" content="${escape(content)}" >\n`);
}
appendHead(`
@@ -20,6 +35,7 @@ export default function(dom, data) {
appendHead(`
<!-- https://schema.org/Article -->
<meta property="article:published" itemprop="datePublished" content="${data.publishedYear}-${data.publishedMonthPadded}-${data.publishedDayPadded}" />
<meta property="article:created" itemprop="dateCreated" content="${data.publishedDate}" />
<meta property="article:modified" itemprop="dateModified" content="${data.updatedDate}" />
`);
data.authors.forEach((a) => {
@@ -33,7 +49,7 @@ export default function(dom, data) {
<meta property="og:title" content="${data.title}"/>
<meta property="og:description" content="${data.description}">
<meta property="og:url" content="${data.url}"/>
<meta property="og:image" content="${data.url}/thumbnail.jpg"/>
<meta property="og:image" content="${data.previewURL}"/>
<meta property="og:locale" content="en_US" />
<meta property="og:site_name" content="Distill" />
`);
@@ -44,7 +60,7 @@ export default function(dom, data) {
<meta name="twitter:title" content="${data.title}">
<meta name="twitter:description" content="${data.description}">
<meta name="twitter:url" content="${data.url}">
<meta name="twitter:image" content="${data.url}/thumbnail.jpg">
<meta name="twitter:image" content="${data.previewURL}">
<meta name="twitter:image:width" content="560">
<meta name="twitter:image:height" content="295">
`);
@@ -55,20 +71,23 @@ export default function(dom, data) {
<!-- https://scholar.google.com/intl/en/scholar/inclusion.html#indexing -->\n`);
meta("citation_title", data.title);
meta("citation_fulltext_html_url", data.url);
//meta("citation_fulltext_html_url", data.url);
meta("citation_volume", data.volume);
meta("citation_issue", data.issue);
meta("citation_firstpage", data.doiSuffix? `e${data.doiSuffix}` : undefined);
meta("citation_doi", data.doi);
let journal = data.journal || {};
meta("citation_journal_title", journal.name);
meta("citation_journal_abbrev", journal.nameAbbrev);
meta("citation_journal_title", journal.full_title || journal.title);
meta("citation_journal_abbrev", journal.abbrev_title);
meta("citation_issn", journal.issn);
meta("citation_publisher", journal.publisher);
meta("citation_fulltext_world_readable", "", true);
if (data.publishedDate){
let zeroPad = (n) => { return n < 10 ? "0" + n : n; };
meta("citation_online_date", `${data.publishedYear}/${data.publishedMonthPadded}/${data.publishedDayPadded}`);
// Should we do something different here?
meta("citation_publication_date", `${data.publishedYear}/${data.publishedMonthPadded}/${data.publishedDayPadded}`);
}
@@ -95,10 +114,32 @@ function appendHtml(el, html) {
}
function citation_meta_content(ref){
// Special test for arxiv
var content = `citation_title=${ref.title};`;
ref.author.split(" and ").forEach(author => {
content += `citation_author=${author.trim()};`;
let name_strings = ref.author.split(" and ").forEach(name => {
name = name.trim();
if (name.indexOf(",") != -1){
var last = name.split(",")[0].trim();
var firsts = name.split(",")[1].trim();
} else {
var last = name.split(" ").slice(-1)[0].trim();
var firsts = name.split(" ").slice(0,-1).join(" ");
}
content += `citation_author=${firsts} ${last};`;
});
if ("year" in ref) {
content += `citation_publication_date=${ref.year};`;
}
var arxiv_id_search = /https?:\/\/arxiv\.org\/pdf\/([0-9]*\.[0-9]*)\.pdf/.exec(ref.url);
arxiv_id_search = arxiv_id_search || /https?:\/\/arxiv\.org\/abs\/([0-9]*\.[0-9]*)/.exec(ref.url);
arxiv_id_search = arxiv_id_search || /arXiv preprint arXiv:([0-9]*\.[0-9]*)/.exec(ref.journal);
if (arxiv_id_search && arxiv_id_search[1]){
content += `citation_arxiv_id=${arxiv_id_search[1]};`;
return content;
}
if ("journal" in ref){
content += `citation_journal_title=${ref.journal};`;
}
+19 -11
View File
@@ -3,9 +3,7 @@ dt-article {
color: rgba(0, 0, 0, 0.8);
font: 17px/1.55em -apple-system, BlinkMacSystemFont, "Roboto", sans-serif;
padding-bottom: 72px;
overflow: hidden;
background: white;
min-height: calc(100vh - 70px - 182px);
}
@media(min-width: 1024px) {
@@ -186,6 +184,25 @@ dt-article section {
margin-bottom: 60px;
}
/* Tables */
dt-article table {
border-collapse: collapse;
}
dt-article table th {
border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}
dt-article table td {
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}
dt-article table th,
dt-article table td {
font-size: 15px;
padding: 2px 0;
}
/* Figure */
@@ -233,15 +250,6 @@ dt-article figure figcaption a {
color: rgba(0, 0, 0, 0.6);
}
/*dt-article figure figcaption::before {
position: relative;
display: block;
top: -20px;
content: "";
width: 25px;
border-top: 1px solid rgba(0, 0, 0, 0.3);
}*/
dt-article span.equation-mimic {
font-family: georgia;
font-size: 115%;
+21
View File
@@ -24,8 +24,11 @@ dt-article > h2,
dt-article > h3,
dt-article > h4,
dt-article > figure,
dt-article > table,
dt-article > ol,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,
@@ -34,6 +37,8 @@ dt-article section > h2,
dt-article section > h3,
dt-article section > h4,
dt-article section > figure,
dt-article section > table,
dt-article section > ol,
dt-article section > ul,
dt-article section > dt-byline,
dt-article section > dt-code {
@@ -57,8 +62,11 @@ dt-article section > dt-code {
dt-article > h3,
dt-article > h4,
dt-article > figure,
dt-article > table,
dt-article > ol,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,
@@ -67,6 +75,8 @@ dt-article section > dt-code {
dt-article section > h3,
dt-article section > h4,
dt-article section > figure,
dt-article section > table,
dt-article section > ol,
dt-article section > ul,
dt-article section > dt-byline,
dt-article section > dt-code {
@@ -83,8 +93,11 @@ dt-article section > dt-code {
dt-article > h3,
dt-article > h4,
dt-article > figure,
dt-article > table,
dt-article > ol,
dt-article > ul,
dt-article > dt-byline,
dt-article > dt-math,
dt-article > dt-code,
dt-article section > div,
dt-article section > p,
@@ -92,6 +105,8 @@ dt-article section > dt-code {
dt-article section > h3,
dt-article section > h4,
dt-article section > figure,
dt-article section > table,
dt-article section > ol,
dt-article section > ul,
dt-article section > dt-byline,
dt-article section > dt-code {
@@ -218,6 +233,8 @@ dt-article section > dt-code {
dt-article.centered > h3,
dt-article.centered > h4,
dt-article.centered > figure,
dt-article.centered > table,
dt-article.centered > ol,
dt-article.centered > ul,
dt-article.centered > dt-byline,
dt-article.centered > dt-code,
@@ -227,6 +244,8 @@ dt-article section > dt-code {
dt-article.centered section > h3,
dt-article.centered section > h4,
dt-article.centered section > figure,
dt-article.centered section > table,
dt-article.cebtered section > ol,
dt-article.centered section > ul,
dt-article.centered section > dt-byline,
dt-article.centered section > dt-code,
@@ -236,6 +255,8 @@ dt-article section > dt-code {
dt-article section.centered > h3,
dt-article section.centered > h4,
dt-article section.centered > figure,
dt-article section.centered > table,
dt-article section.centered > ol,
dt-article section.centered > ul,
dt-article section.centered > dt-byline,
dt-article section.centered > dt-code {
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import base from './styles-base.css';
import layout from './styles-layout.css';
import article from './styles-article.css';
+25 -8
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
export default function(dom, data) {
var textNodes = dom.createTreeWalker(
@@ -51,16 +65,19 @@ function punctuation(text){
text = text.replace(/--/g, '\u2014');
text = text.replace(/ \u2014 /g,"\u2009\u2014\u2009"); //this has thin spaces
// The following are temporary commented out because incompatibility
// with katex
// Elipses
text = text.replace(/\.\.\./g,'…');
// text = text.replace(/\.\.\./g,'…');
// Nbsp for punc with spaces
var NBSP = "\u00a0";
var NBSP_PUNCTUATION_START = /([«¿¡]) /g;
var NBSP_PUNCTUATION_END = / ([\!\?:;\.,‽»])/g;
// var NBSP = "\u00a0";
// var NBSP_PUNCTUATION_START = /([«¿¡]) /g;
// var NBSP_PUNCTUATION_END = / ([\!\?:;\.,‽»])/g;
text = text.replace(NBSP_PUNCTUATION_START, '$1' + NBSP);
text = text.replace(NBSP_PUNCTUATION_END, NBSP + '$1');
// text = text.replace(NBSP_PUNCTUATION_START, '$1' + NBSP);
// text = text.replace(NBSP_PUNCTUATION_END, NBSP + '$1');
return text;
}
@@ -91,8 +108,8 @@ function quotes(text) {
function ligatures(text){
text = text.replace(/fi/g, 'fi');
text = text.replace(/fl/g, 'fl');
// text = text.replace(/fi/g, 'fi');
// text = text.replace(/fl/g, 'fl');
return text;
};
+9786 -143
View File
File diff suppressed because one or more lines are too long
+1 -1
View File
File diff suppressed because one or more lines are too long
+34 -5
View File
@@ -1,6 +1,9 @@
<!doctype html>
<meta charset="utf8">
<script src="../dist/template.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/KaTeX/0.7.1/katex.min.css" integrity="sha384-wITovz90syo1dJWVh32uuETPVEtGigN07tkttEqPv+uR2SE/mbQcG7ATL28aI9H0" crossorigin="anonymous">
<script type="text/front-matter">
title: Article Title
published: Jan 10, 2017
@@ -17,11 +20,37 @@
<h1>Hello World</h1>
<h2>A description of the article</h2>
<dt-byline></dt-byline>
<p>This is the first paragraph of the article.</p>
<p>Test a long&thinsp;&mdash;&thinsp;dash -- here it is.</p>
<p>Test for owner's possessive.</p>
<p>Test for "quoting a passage." And another sentence. Or two.</p>
<p>We can also cite <dt-cite key="gregor2015draw,mercier2011humans"></dt-cite> external publications. <dt-cite key="dong2014image,dumoulin2016guide,mordvintsev2015inceptionism"></dt-cite></p>
<p>This is the first paragraph of the article. Test a long&thinsp;&mdash;&thinsp;dash -- here it is.</p>
<p>Test for owner's possessive. Test for "quoting a passage." And another sentence. Or two.</p>
<p>Here's a test of an inline equation <dt-math>c = a^2 + b^2</dt-math>.</p>
<dt-math block>c = \pm\sqrt{a^2 + b^2}</dt-math>
<p>We can also cite <dt-cite key="gregor2015draw,mercier2011humans"></dt-cite> external publications. <dt-cite key="dong2014image,dumoulin2016guide,mordvintsev2015inceptionism"></dt-cite> We should also be testing footnotes<dt-fn>This will become a hoverable footnote.</dt-fn>.</p>
<table>
<thead>
<tr><th>First</th><th>Second</th><th>Third</th></tr>
</thead>
<tbody>
<tr><td>23</td><td>654</td><td>23</td></tr>
<tr><td>14</td><td>54</td><td>34</td></tr>
<tr><td>234</td><td>54</td><td>23</td></tr>
</tbody>
</table>
<p>Here's a javascript code block.</p>
<dt-code block language="javascript">
var x = 25;
function(x){
return x * x;
}
</dt-code>
<p>We also support python.</p>
<dt-code block language="python">
# Python 3: Fibonacci series up to n
def fib(n):
a, b = 0, 1
while a < n:
print(a, end=' ')
a, b = b, a+b
</dt-code>
</dt-article>
<script type="text/bibliography">
+1 -1
View File
@@ -164,7 +164,7 @@
}
</script>
<p>The citation is presented inline like this: <dt-cite key="gregor2015draw"></dt-cite> (a number that displays more information on hover). If you have an appendix, a bibliography is automatically created and populated in it.</p>
<p>Distill chose a numerical inline citation style to improve readability of citation dense articles and because many of the benefits of longer citations are obviated by dispalying more information on hover. However, we consider it good style to mention author last names if you discuss something at length and it fits into the flow well -- the authors are human and it's nice for them to have the community associate them with their work.</p>
<p>Distill chose a numerical inline citation style to improve readability of citation dense articles and because many of the benefits of longer citations are obviated by displaying more information on hover. However, we consider it good style to mention author last names if you discuss something at length and it fits into the flow well -- the authors are human and it's nice for them to have the community associate them with their work.</p>
<hr>
+46 -17
View File
@@ -1,21 +1,37 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import html from "./components/html";
import styles from "./components/styles";
import frontMatter from "./components/front-matter";
import bibliography from "./components/bibliography";
import expandData from "./components/expand-data";
import expandData from "./components/data";
import meta from "./components/meta";
import banner from "./components/banner";
import header from "./components/header";
import byline from "./components/byline";
import appendix from "./components/appendix";
import footer from "./components/footer";
import appendixDistill from "./components/appendix-distill";
import citation from "./components/citation";
import footnote from "./components/footnote";
import DTMath from "./components/dt-math";
import markdown from "./components/markdown";
import code from "./components/code";
import typeset from "./components/typeset";
import hoverBox from "./components/hover-box-include";
import generateCrossref from "./components/generate-crossref";
import header from "./components/header";
import footer from "./components/footer";
function renderImmediately(dom) {
html(dom);
@@ -27,11 +43,10 @@ function renderOnLoad(dom, data) {
bibliography(dom, data);
expandData(dom, data);
meta(dom, data);
header(dom, data);
byline(dom, data);
appendix(dom, data);
footer(dom, data);
markdown(dom, data);
DTMath(dom, data);
code(dom, data);
citation(dom, data);
footnote(dom, data);
@@ -40,17 +55,23 @@ function renderOnLoad(dom, data) {
}
// If we are in a browser, render automatically...
if(window && window.document) {
let data = {};
renderImmediately(window.document);
window.document.addEventListener("DOMContentLoaded", (event) => {
renderOnLoad(window.document, data);
// Add a banner if we're not on localhost.
if (window.location.hostname !== "localhost" && window.location.origin !== "file://") {
banner(window.document, data);
}
generateCrossref(data);
});
var browser = new Function("try { return this === window; }catch(e){ return false; }");
if (browser) {
try {
var data = {};
renderImmediately(window.document);
window.document.addEventListener("DOMContentLoaded", function (event) {
renderOnLoad(window.document, data);
// Add a banner if we're not on localhost.
if (window.location.hostname !== "localhost" && window.location.origin !== "file://") {
banner(window.document, data);
}
generateCrossref(data);
// console.log(data);
});
} catch (error) {
console.error("Window not defined");
}
}
// If we are in node...
@@ -58,9 +79,17 @@ function render(dom, data) {
renderImmediately(dom);
renderOnLoad(dom, data);
// Remove script tag so it doesn't run again in the client
let s = dom.querySelector('script[src="http://distill.pub/template.js"]');
let s = dom.querySelector('script[src*="distill.pub/template"]');
if (s) { s.parentElement.removeChild(s); };
}
// Distill specific rendering
function distillify(dom, data) {
header(dom, data);
appendixDistill(dom, data);
footer(dom, data);
}
export {render as render};
export {distillify as distillify};
export {generateCrossref as generateCrossref};
+7 -10
View File
@@ -1,6 +1,6 @@
{
"name": "distill-template",
"version": "0.0.21",
"version": "1.1.1",
"description": "Template for creating Distill articles.",
"main": "dist/template.js",
"scripts": {
@@ -18,27 +18,24 @@
"url": "https://github.com/distillpub/distill-template/issues"
},
"homepage": "https://github.com/distillpub/distill-template#readme",
"devDependencies": {
"dependencies": {
"bibtex-parse-js": "^0.0.23",
"chai": "^3.5.0",
"commander": "^2.9.0",
"d3-time-format": "^2.0.3",
"escape-html": "^1.0.3",
"js-yaml": "^3.7.0",
"jsdom": "^9.10.0",
"katex": "^0.7.1",
"marked": "^0.3.6",
"mocha": "^3.2.0",
"mustache": "^2.3.0",
"prismjs": "^1.6.0",
"rollup": "^0.36.4",
"rollup-plugin-buble": "^0.14.0",
"rollup-plugin-commonjs": "^7.0.0",
"rollup-plugin-livereload": "^0.3.1",
"rollup-plugin-node-resolve": "^2.0.0",
"rollup-plugin-serve": "^0.1.0",
"rollup-plugin-string": "^2.0.2",
"rollup-plugin-uglify": "^1.0.1",
"rollup-watch": "^2.5.0"
},
"dependencies": {
"commander": "^2.9.0",
"d3-time-format": "^2.0.3",
"mustache": "^2.3.0"
}
}
+16 -5
View File
@@ -1,12 +1,23 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
import buble from 'rollup-plugin-buble';
import resolve from 'rollup-plugin-node-resolve';
import commonjs from 'rollup-plugin-commonjs';
import liveReload from 'rollup-plugin-livereload';
import serve from 'rollup-plugin-serve';
import uglify from 'rollup-plugin-uglify';
import string from 'rollup-plugin-string';
const PORT = 8080;
// const PORT = 8080;
// console.log(`open http://localhost:${PORT}/`);
export default {
@@ -16,7 +27,7 @@ export default {
{
format: 'umd',
moduleName: 'dl',
dest: `dist/template.js`,
dest: `dist/template.v1.js`,
}
],
plugins: [
View File
View File
+7
View File
@@ -0,0 +1,7 @@
# Gulp with Mustache Templates
To get started, make sure to run `yarn install` or `npm install` to install dependencies.
Run `gulp` to build the project. Running `gulp serve` will run a watching server.
There is very little processing going on, the only thing we've added is support for mustache partials.
+14
View File
@@ -1,3 +1,17 @@
// Copyright 2018 The Distill Template Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// Test format: https://mochajs.org/#bdd
// Assertion format: http://chaijs.com/api/bdd/
+33 -1
View File
@@ -389,6 +389,10 @@ ecc-jsbn@~0.1.1:
dependencies:
jsbn "~0.1.0"
escape-html@^1.0.3:
version "1.0.3"
resolved "https://registry.yarnpkg.com/escape-html/-/escape-html-1.0.3.tgz#0258eae4d3d0c0974de1c169188ef0051d1d1988"
escape-string-regexp@1.0.5, escape-string-regexp@^1.0.2:
version "1.0.5"
resolved "https://registry.yarnpkg.com/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz#1b61c0562190a8dff6ae3bb2cf0200ca130b86d4"
@@ -809,6 +813,12 @@ jsprim@^1.2.2:
json-schema "0.2.3"
verror "1.3.6"
katex@^0.7.1:
version "0.7.1"
resolved "https://registry.yarnpkg.com/katex/-/katex-0.7.1.tgz#06bb5298efad05e1e7228035ba8e1591f3061b8f"
dependencies:
match-at "^0.1.0"
kind-of@^3.0.2:
version "3.1.0"
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-3.1.0.tgz#475d698a5e49ff5e53d14e3e732429dc8bf4cf47"
@@ -905,7 +915,11 @@ marked@^0.3.6:
version "0.3.6"
resolved "https://registry.yarnpkg.com/marked/-/marked-0.3.6.tgz#b2c6c618fccece4ef86c4fc6cb8a7cbf5aeda8d7"
micromatch@^2.1.5:
match-at@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/match-at/-/match-at-0.1.0.tgz#f561e7709ff9a105b85cc62c6b8ee7c15bf24f31"
micromatch@^2.1.5, micromatch@^2.3.11:
version "2.3.11"
resolved "https://registry.yarnpkg.com/micromatch/-/micromatch-2.3.11.tgz#86677c97d1720b363431d04d0d15293bd38c1565"
dependencies:
@@ -1280,6 +1294,13 @@ rollup-plugin-string@^2.0.2:
dependencies:
rollup-pluginutils "^1.5.0"
rollup-plugin-svelte@^1.8.0:
version "1.8.0"
resolved "https://registry.yarnpkg.com/rollup-plugin-svelte/-/rollup-plugin-svelte-1.8.0.tgz#4cefe4fcf453cd051378babb5c4804645acd1652"
dependencies:
rollup-pluginutils "^2.0.1"
svelte "^1.11.2"
rollup-plugin-uglify@^1.0.1:
version "1.0.1"
resolved "https://registry.yarnpkg.com/rollup-plugin-uglify/-/rollup-plugin-uglify-1.0.1.tgz#11d0b0c8bcd2d07e6908f74fd16b0152390b922a"
@@ -1293,6 +1314,13 @@ rollup-pluginutils@^1.5.0, rollup-pluginutils@^1.5.1:
estree-walker "^0.2.1"
minimatch "^3.0.2"
rollup-pluginutils@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/rollup-pluginutils/-/rollup-pluginutils-2.0.1.tgz#7ec95b3573f6543a46a6461bd9a7c544525d0fc0"
dependencies:
estree-walker "^0.3.0"
micromatch "^2.3.11"
rollup-watch@^2.5.0:
version "2.5.0"
resolved "https://registry.yarnpkg.com/rollup-watch/-/rollup-watch-2.5.0.tgz#852d660ddecc51696890aa8c22e95ed4558cc5f7"
@@ -1410,6 +1438,10 @@ supports-color@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-2.0.0.tgz#535d045ce6b6363fa40117084629995e9df324c7"
svelte@^1.11.2:
version "1.15.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-1.15.0.tgz#d5d00c89fc158bbaf5a19a159236fe56dad6d63c"
symbol-tree@^3.2.1:
version "3.2.1"
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.1.tgz#8549dd1d01fa9f893c18cc9ab0b106b4d9b168cb"