mirror of
https://github.com/wassname/template.git
synced 2026-06-30 17:08:32 +08:00
fix citation
This commit is contained in:
@@ -8,8 +8,10 @@ export default function(dom, data) {
|
||||
}
|
||||
|
||||
var citeTags = [].slice.apply(dom.querySelectorAll("dt-cite"));
|
||||
console.log(citeTags)
|
||||
citeTags.forEach(el => {
|
||||
var keys = el.textContent.split(",");
|
||||
var keys = el.getAttribute("key").split(",");
|
||||
console.log(keys)
|
||||
var cite_string = keys.map(inline_cite).join(", ");
|
||||
el.innerHTML = cite_string;
|
||||
});
|
||||
@@ -26,6 +28,7 @@ export default function(dom, data) {
|
||||
}
|
||||
|
||||
function inline_cite(key){
|
||||
console.log(key, data.citations)
|
||||
if (key in data.citations){
|
||||
var ent = data.citations[key];
|
||||
var names = ent.author.split(" and ");
|
||||
|
||||
@@ -61,7 +61,7 @@
|
||||
<h2>A description of the article</h2>
|
||||
<dt-byline></dt-byline>
|
||||
<p>This is the first paragraph of the article.</p>
|
||||
<p>We can also cite <dt-cite article="gregor2015draw"></dt-cite> external publications.</p>
|
||||
<p>We can also cite <dt-cite key="gregor2015draw"></dt-cite> external publications.</p>
|
||||
</dt-article>
|
||||
<dt-bibliography>
|
||||
@article{gregor2015draw,
|
||||
@@ -137,7 +137,7 @@
|
||||
</dt-code>
|
||||
<p>Citations are then used in the article body with the <dt-code language="html"><dt-cite></dt-code> tag. The <dt-code>article</dt-code> attribute is a reference to the id provided in the bibiography.</p>
|
||||
<dt-code block language="html">
|
||||
<dt-cite article="gregor2015draw"></dt-cite>
|
||||
<dt-cite ket="gregor2015draw"></dt-cite>
|
||||
</dt-code>
|
||||
|
||||
<hr>
|
||||
|
||||
Reference in New Issue
Block a user