Commit ab77d830 authored by Ian Dennis Miller's avatar Ian Dennis Miller

render notes in HTML

parent 1e45688c
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "visfact-make",
"type": "shell",
"command": "DEBUGVISFACT=T /home/comiandennismillerprofile1/.virtualenvs/visfact/bin/python3 ~/Work/visfact/bin/visfact-make.py example/visfact.yaml",
"options": {
"cwd": "${workspaceRoot}"
},
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "silent",
"focus": false,
"panel": "shared"
}
}
]
}
\ No newline at end of file
......@@ -148,6 +148,7 @@ The following Turtle corresponds to `example/argument-1/article-1.ttl`, which is
[ a thesis:claim ;
thesis:appearance <#article-1> ;
thesis:quote "This new fact is justified by this article, itself." ;
thesis:note "I have a thought." ;
thesis:source <#article-1> ;
] .
......
......@@ -12,6 +12,13 @@
[ a thesis:Claim ;
thesis:appearance <#article-1> ;
thesis:quote "This new fact is justified by this article, itself." ;
thesis:note "I have a thought..." ;
thesis:source <#article-1> ;
] .
[ a thesis:Claim ;
thesis:appearance <#article-1> ;
thesis:note "Here is another thought." ;
thesis:source <#article-1> ;
] .
......
......@@ -6,14 +6,27 @@
{{ appearance_authors }}. ({{ appearance_year }}). {{ appearance_title }}
</div>
<div class="quote_container">
{% if quote_identicon %}
<div class="identicon">
<img src="data:image/png;base64,{{ quote_identicon }}">
</div>
{% endif %}
<div class="quote">
{% if quote %}
{{ quote }}
{% endif %}
{% if note %}
<div class="note">
{{ note }}
</div>
{% endif %}
</div>
</div>
{% if quote %}
<div class="search">
<ul>
{% for source in sources %}
......@@ -26,6 +39,8 @@
{% endfor %}
</ul>
</div>
{% endif %}
<div class="controls">
<a id="reveal" href="#" onclick="toggle_appearance('{{ id }}'); return false;">[r]</a>
</div>
......
......@@ -12,6 +12,7 @@
# [ a thesis:Claim ;
# thesis:appearance <#article-1> ;
# thesis:quote "" ;
# thesis:note "" ;
# thesis:source <#article-1> ;
# ] .
......
......@@ -69,6 +69,12 @@ ul {
/*.quote { font-weight: bold; }*/
.note {
font-style: italic;
background: #333;
padding: 0.5em 0.5em;
}
.controls {
font-size: 10pt;
display: none;
......
......@@ -15,10 +15,11 @@ from .__meta__ import __version__
sparql = """
SELECT ?quote ?authors ?year ?appearance_title ?appearance_authors ?appearance_year ?fact_id ?appearance_id ?source_id ?title
SELECT ?quote ?note ?authors ?year ?appearance_title ?appearance_authors ?appearance_year ?fact_id ?appearance_id ?source_id ?title
WHERE {{
?fact_id rdf:type <https://projects.sisrlab.com/idm/visfact/raw/master/schema/thesis.rdf#Claim> .
?fact_id thesis:quote ?quote .
optional {{ ?fact_id thesis:quote ?quote }} .
optional {{ ?fact_id thesis:note ?note }} .
?fact_id thesis:appearance ?appearance_id .
?fact_id thesis:source ?source_id .
?source_id dc:authors ?authors .
......@@ -67,7 +68,7 @@ class VisFact:
articles = {}
facts = {}
for row in self.g.query(sparql):
(quote, authors, year, appearance_title, appearance_authors, appearance_year, fact_id,
(quote, note, authors, year, appearance_title, appearance_authors, appearance_year, fact_id,
appearance_id, source_id, title) = row
# make fact_id sortable
......@@ -104,22 +105,30 @@ class VisFact:
# if this fact has not been added yet
if fact_id not in facts.keys():
quote_identicon_data = self.quote_identicon_generator.generate(
data=alpha_pattern.sub('', quote.upper()), width=16, height=16)
if quote:
quote_identicon_data = self.quote_identicon_generator.generate(
data=alpha_pattern.sub('', quote.upper()), width=16, height=16)
quote_identicon_encode = base64.b64encode(quote_identicon_data).decode()
else:
quote_identicon_encode = None
appearance_identicon_data = self.source_identicon_generator.generate(
data=alpha_pattern.sub('', appearance_cite.upper()), width=16, height=16)
content += quote + '\n'
if quote:
content += quote + '\n'
elif note:
content += note + '\n'
facts[fact_id] = {
'id': "{0}".format(fact_id),
'quote': quote,
'note': note,
'appearance_authors': appearance_authors,
'appearance_year': appearance_year,
'appearance_title': appearance_title,
'appearance_id': appearance_id,
'quote_identicon': base64.b64encode(quote_identicon_data).decode(),
'quote_identicon': quote_identicon_encode,
'appearance_identicon': base64.b64encode(appearance_identicon_data).decode(),
'sources': [source],
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment