Commit 9bc289ae authored by Ian Dennis Miller's avatar Ian Dennis Miller

add scaffolds for config and article

parent f421809f
graft visfact
include *.cfg *.rst *.in *.txt *.ini *.mako *.html *.js *.css *.jpg *.gif *.sparql
include *.cfg *.rst *.in *.txt *.ini *.mako *.html *.js *.css *.jpg *.gif *.sparql *.ttl *.yaml
......@@ -12,6 +12,9 @@ requirements:
test:
mkdir -p ./build
DEBUGVISFACT=T bin/visfact-scaffold-config.py build/config.yaml
DEBUGVISFACT=T bin/visfact-scaffold-article.py build/article.ttl
DEBUGVISFACT=T bin/visfact-make.py build/config.yaml
DEBUGVISFACT=T bin/visfact-make.py example/visfact.yaml
snippets-sublime-text-3:
......
......@@ -38,24 +38,21 @@ Snippets must be installed in your text editor.
### Workflow
1. Create a blank file in the argument path: `touch argument-1/author-2019.ttl`
2. Open `.ttl` file in text editor
3. Type `article` and tab-complete to activate the **article** snippet
4. Enter the DOI, title, authors, and year.
5. Use `cite`, `self`, and `src` to populate the rest of the file with quotes.
1. `visfact-scaffold-article.py article.ttl`
2. Open `article.ttl` file in text editor
3. Enter the DOI, title, authors, and year.
4. Use `cite`, `self`, and `src` to populate the rest of the file with quotes.
### Config
1. Create a blank config file: `touch visfact.yaml`
1. `visfact-scaffold-config.py config.yaml`
2. Open `visfact.yaml` in the text editor
3. Type `config` and tab-complete to activate the **configuration** snippet
4. provide the path to the `.ttl` files
4. provide the path to the `article.ttl` files
### Running
```sh
visfact-make.py visfact.yaml
open argument-1.html
visfact-make.py config.yaml
```
## Snippets
......
......@@ -22,7 +22,7 @@ if __name__ == "__main__":
if len(sys.argv) > 1:
yaml_file = sys.argv[1]
else:
print("Usage: visfact-make.py [configuration.yaml]")
print("Usage: visfact-make.py [config.yaml]")
sys.exit()
main(yaml_file)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
# export VISFACTDEBUG=T
if 'DEBUGVISFACT' in os.environ:
sys.path.insert(0, ".")
def main(yaml_file):
from visfact.visfact import VisFact
thesis = VisFact()
thesis.scaffold_article(yaml_file)
if __name__ == "__main__":
if len(sys.argv) > 1:
yaml_file = sys.argv[1]
else:
print("Usage: visfact-scaffold-article.py [article.ttl]")
sys.exit()
main(yaml_file)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
# export VISFACTDEBUG=T
if 'DEBUGVISFACT' in os.environ:
sys.path.insert(0, ".")
def main(yaml_file):
from visfact.visfact import VisFact
thesis = VisFact()
thesis.scaffold_config(yaml_file)
if __name__ == "__main__":
if len(sys.argv) > 1:
yaml_file = sys.argv[1]
else:
print("Usage: visfact-scaffold-config.py [config.yaml]")
sys.exit()
main(yaml_file)
......@@ -25,6 +25,8 @@ setup(
packages=find_packages(),
scripts=[
"bin/visfact-make.py",
"bin/visfact-scaffold-config.py",
"bin/visfact-scaffold-article.py",
],
long_description=read('Readme.md'),
classifiers=[], # Get strings from http://pypi.python.org/pypi?%3Aaction=list_classifiers
......
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns/> .
@prefix dc: <http://purl.org/dc/elements/1.1/> .
@prefix thesis: <https://projects.sisrlab.com/idm/visfact/raw/master/schema/thesis.rdf#> .
<#article-1>
a thesis:Article ;
dc:title "" ;
dc:authors "" ;
dc:url "https://doi.org/" ;
dc:year 2019 .
# [ a thesis:Claim ;
# thesis:appearance <#article-1> ;
# thesis:quote "" ;
# thesis:source <#article-1> ;
# ] .
# [ a thesis:Claim ;
# thesis:appearance <#article-1> ;
# thesis:quote "" ;
# thesis:source [ a thesis:Article ;
# dc:authors "" ;
# dc:title "" ;
# dc:year ;
# ] ;
# ] .
---
files:
- "build/article.ttl"
dest: "build/argument-1.html"
rdf: "build/argument-1.rdf"
......@@ -127,6 +127,7 @@ class VisFact:
buf = re.sub(r'file:///.+?#', '#', buf)
# buf = re.sub(r'rdf:about="#', 'rdf:about="', buf)
f.write(buf.encode())
print("visfact: wrote {0}".format(self.cfg["rdf"]))
result, articles = self.build_cards()
# sort articles by value
......@@ -137,3 +138,14 @@ class VisFact:
buf = html_tmpl.render(quotes=result, articles=sorted_articles)
buf = re.sub(r'file:///.+?#', '', buf)
f.write(buf.encode())
print("visfact: wrote {0}".format(self.cfg["dest"]))
def scaffold_config(self, filename):
tmpl = self.env.get_template('scaffold/config.yaml')
with open(filename, "w") as f:
f.write(tmpl.render())
def scaffold_article(self, filename):
tmpl = self.env.get_template('scaffold/article.ttl')
with open(filename, "w") as f:
f.write(tmpl.render())
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