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

snippets to create a fresh article and a fresh config

parent 1df19385
......@@ -18,7 +18,7 @@ pip install -e git+https://projects.sisrlab.com/idm/visfact.git#egg=visfact
## Usage
```sh
visfact-make.py example/visfact.yaml
visfact-make.py visfact.yaml
open output.html
```
......@@ -28,6 +28,60 @@ Arrow keys are used to navigate the fact cards:
- up: show all cards
- down: hide all cards but the current one
## Authoring
This authoring workflow creates a new file for capturing citations from one article.
Snippets must be installed in your text editor.
*Sublime Text 3* and *VS Code* are supported.
### 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.
### Config
1. Create a blank config file: `touch visfact.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
### Running
```sh
visfact-make.py visfact.yaml
open argument-1.html
```
## Snippets
Use snippets to reduce repetitive typing and to generally go faster.
Snippets are text macros that expand to produce the necessary Turtle for adding quotes.
Snippets are provided for some text editors.
### Sublime Text 3
The following snippets are provided:
- **self**: self-citation
- **cite**: a quote with one or more external sources
- **vcite**: a verbatim quote (no automatic removal of citations)
- **src**: an extra source for a particular quote
The following will install snippets to the User Packages directory.
`make snippets-sublime-text-3`
### VS Code
1. Open [snippets/vscode/turtle.json](https://projects.sisrlab.com/idm/visfact/raw/master/snippets/vscode/turtle.json)
2. In VS Code, **File -- Preferences -- User Snippets**
3. Choose Turtle (`turtle.json`)
4. Copy-paste contents of `turtle.json`
## Configuration
A YAML file is used to control visfact.
......@@ -81,29 +135,3 @@ The following Turtle corresponds to `example/argument-1/article-1.ttl`, which is
] ;
] .
```
## Snippets
Use snippets to reduce repetitive typing and to generally go faster.
Snippets are text macros that expand to produce the necessary Turtle for adding quotes.
Snippets are provided for some text editors.
### Sublime Text 3
The following snippets are provided:
- **self**: self-citation
- **cite**: a quote with one or more external sources
- **vcite**: a verbatim quote (no automatic removal of citations)
- **src**: an extra source for a particular quote
The following will install snippets to the User Packages directory.
`make snippets-sublime-text-3`
### VS Code
1. Open [snippets/vscode/turtle.json](https://projects.sisrlab.com/idm/visfact/raw/master/snippets/vscode/turtle.json)
2. In VS Code, **File -- Preferences -- User Snippets**
3. Choose Turtle (`turtle.json`)
4. Copy-paste contents of `turtle.json`
......@@ -14,10 +14,7 @@ $0] .
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>cite</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.ttl</scope>
<!-- Optional: Description to show in the menu -->
<description>Article-citation Snippet</description>
</snippet>
<snippet>
<content><![CDATA[
@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/thesis.rdf#> .
<#${TM_FILENAME/.ttl//}>
a thesis:Article ;
dc:url "https://doi.org/$1" ;
dc:title "$2" ;
dc:authors "$3" ;
dc:year $4 .
]]></content>
<tabTrigger>article</tabTrigger>
<scope>source.ttl</scope>
<description>Base Article Snippet</description>
</snippet>
<snippet>
<content><![CDATA[
---
files:
- "${1:argument}/article-1.ttl"
dest: "$1.html"
rdf: "$1.rdf"
]]></content>
<tabTrigger>config</tabTrigger>
<scope>source.ttl</scope>
<description>visfact configuration</description>
</snippet>
......@@ -7,10 +7,7 @@
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>self</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.ttl</scope>
<!-- Optional: Description to show in the menu -->
<description>Self-citation Snippet</description>
</snippet>
......@@ -7,10 +7,7 @@
dc:year ${1/.*(\d\d\d\d).*/\1/} ;
] ;
$0]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>src</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.ttl</scope>
<!-- Optional: Description to show in the menu -->
<description>Source mini Snippet</description>
</snippet>
......@@ -13,10 +13,7 @@ $0] .
]]></content>
<!-- Optional: Tab trigger to activate the snippet -->
<tabTrigger>vcite</tabTrigger>
<!-- Optional: Scope the tab trigger will be active in -->
<scope>source.ttl</scope>
<!-- Optional: Description to show in the menu -->
<description>Verbatim Article-citation Snippet</description>
</snippet>
......@@ -42,4 +42,34 @@
],
"description": "Source mini Snippet"
}
"Article_Base": {
"prefix": "article",
"body": [
"@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/thesis.rdf#> .",
"",
"<#${TM_FILENAME/.ttl//}>",
" a thesis:Article ;",
" dc:url \"https://doi.org/$1\" ;",
" dc:title \"$2\" ;",
" dc:authors \"$3\" ;",
" dc:year $4 .",
"",
""
],
"description": "Article Base Snippet"
},
"Configuration": {
"prefix": "config",
"body": [
"---",
"files:",
" - \"${1:argument}/article-1.ttl\"",
"dest: \"$1.html\"",
"rdf: \"$1.rdf\"",
""
],
"description": "Visfact Configuration"
}
}
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