Publishing Editions on GitHub Pages
with the Text Encoding Initiative
Hugh Cayless, Raff Viglianti
Get this presentation:� http://bit.ly/2smyFut
Workshop structure
Part I
Part II
First things first
Download Atom editor�https://atom.io/
Create a GitHub account�https://github.com/
Get this presentation: � http://bit.ly/2smyFut
Introduction to text encoding and the TEI
XML Rules
XML Rules
XML Rules
XML Schemas
TEI Documents
TEI documents always start with
<TEI xmlns="http://www.tei-c.org/ns/1.0">
They generally have a <teiHeader>, for metadata, and a <text> for the text content of your document.
The teiHeader contains things like title, date (of the TEI document), author/editor info, info about the source document(s), editorial practices, and revision history.
The text contains the text content along with whatever markup you want to use to model the structure and meaning of the document.
The Text
TEI customization
Using TEI for editorial work
Setup Atom for use with TEI
Press Ctrl + , to access Settings > Install > search “linter-autocomplete-jing”
Using TEI for editorial work
<?xml version="1.0" encoding="UTF-8"?>
<?xml-model href="http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://relaxng.org/ns/structure/1.0"?>
<?xml-model href="http://www.tei-c.org/Vault/P5/current/xml/tei/custom/schema/relaxng/tei_all.rng" type="application/xml" schematypens="http://purl.oclc.org/dsdl/schematron"?>
<TEI xmlns="http://www.tei-c.org/ns/1.0">
<teiHeader>
<fileDesc>
<titleStmt>
<title>Title</title>
</titleStmt>
<publicationStmt>
<p>Publication Information</p>
</publicationStmt>
<sourceDesc>
<p>Information about the source</p>
</sourceDesc>
</fileDesc>
</teiHeader>
<text>
<body>
<p>Some text here.</p>
</body>
</text>
</TEI>
Copy & paste this template� to get started
Using TEI for editorial work
Always check that your file is well-formed and valid
You can get suggestions for available elements
Using TEI for editorial work
Encoding textual structures
<div> (text division)
Encodes a division of text, such as a chapter or a section
<p> (paragraph)
<lg> (line group)
Encodes a group of verses forming a formal unit, such as a stanza
<l> (verse line)
Encodes a line of verse (not a line of text; use <lb/> if you need to mark lines on a page)
Using TEI for editorial work
Encoding phrase-level text
Mise-en-page is a term used by codicologists for the general layout and organization of the manuscript page.
Mise-en-page is a term used by codicologists for the general layout and organization of the manuscript page.
italic
foreign word
Procedural markup
Descriptive markup
Using TEI for editorial work
Encoding phrase-level text
Using TEI for editorial work
Some TEI elements for editorial work
Using TEI for editorial work - exercise
Choose a text to work on (more or less in order of difficulty)
Break
☕
Get this presentation:� https://go.umd.edu/STS-TEI
Part II
Get this presentation:� https://go.umd.edu/STS-TEI
Introduction to Git and GitHub
file.xml
ADD
Introduction to Git and GitHub
file.xml
Version 4
Version 3
Version 2
Version 1
COMMIT
Introduction to Git and GitHub
file.xml
PUSH
REPOSITORY
Introduction to Git and GitHub
file.xml
PUSH
REPOSITORY
GitHub
Introduction to Git and GitHub
CLONE
Introduction to Git and GitHub
COMMIT
file.xml
Version 5
Introduction to Git and GitHub
COMMIT
PUSH
file.xml
Version 5
Introduction to Git and GitHub
PUSH
PULL
file.xml
Version 5
Version 4
Version 3
Version 2
Version 1
Introduction to Git and GitHub: summary
Git: a version control system GitHub: a social network of Git repositories
Add: add a new file to be tracked and versioned
Commit: save changes to a new version
Push: store files and their commits (versions) to a repository online
Repository: collection of files and their versions
Clone: recreate an online repository on your computer
Pull: get new changes from an online repository
Introduction to Git and GitHub
Creating static sites for TEI documents
What is a static site?
A web page delivered to the user exactly as stored
What is it made of?
HTML
CSS
JAVASCRIPT
OTHER
ASSETS
Creating static sites for TEI documents
What is a static site?
A web page delivered to the user exactly as stored
What is it made of?
HTML
CSS
JAVASCRIPT
IMAGES
OTHER MEDIA
TEI
Creating static sites for TEI documents
MySite
css
data
js
texts
index.html
README.md
Create this folder structure
for your static site
Copy your TEI file into data
Creating static sites for TEI documents
Setup Atom for HTML preview
Press Ctrl + , to access Settings > Install > search “atom-html-preview”
Creating static sites for TEI documents
Open index.html in Atom
Creating static sites for TEI documents
A simple template for HTML 5 documents
<!doctype html>�<html lang="en">�� <head>� <title>My site</title> � <meta charset="utf-8">� <meta name="description" content="A site for my TEI">� <meta name="author" content="Me">� </head>�� <body>� <p>Hello world.</p>� </body>��</html>
Copy this to your index.html
Creating static sites for TEI documents
Add some content and preview with Ctrl + Shift + h
� <body>� <div>Hello, <i>world</i>!</div>� </body>
Hello, world!
Creating static sites for TEI documents
Rendering TEI files in your static site with
CETEIcean 🐳
HTML
CETEIcean
TEI
Creating static sites for TEI documents
Rendering TEI files in your static site with
CETEIcean 🐳
HTML
CETEIcean
TEI
The browser now treats TEI elements as if they were HTML
Creating static sites for TEI documents
Rendering TEI files in your static site with
CETEIcean 🐳
Creating static sites for TEI documents
Add CETEIcean to your index.html
� <head>� <title>My static site</title> � <meta charset="utf-8">� <meta name="description" content="A static site for my TEI">� <meta name="author" content="Me">�� <script src="js/CETEI.js"></script>�� </head>
Make sure to have both � opening and closing tags
Creating static sites for TEI documents
Run CETEIcean on your TEI file
STEP 1: Create a container for the TEI elements
<body>� <div>Hello, <i>world</i>!</div>� � <div id="TEI"></div>��</body>
You can remove this <div>
now if you want
Creating static sites for TEI documents
Run CETEIcean on your TEI file
STEP 2: Start CETEIcean
<body> � <div id="TEI"></div>�� <script>� var CETEIcean = new CETEI()� </script>��</body>
Creating static sites for TEI documents
Run CETEIcean on your TEI file
STEP 3: Run CETEIcean on your TEI file
<body> � <div id="TEI"></div>�� <script>� var CETEIcean = new CETEI()� CETEIcean.getHTML5('data/TEI.xml', function(data) {�� })� </script>��</body>
Creating static sites for TEI documents
Run CETEIcean on your TEI file
STEP 4: Add TEI data to the HTML container
<body> � <div id="TEI"></div>�� <script>� var CETEIcean = new CETEI()� CETEIcean.getHTML5("data/TEI.xml", function(data) {� document.getElementById("TEI").appendChild(data)� })� </script>��</body>
Remember to preview with
Ctrl + Shift + h
Basic styling and interaction
Let’s add some style
Cascading Style Sheets is a � language to style marked-up � documents
Basic styling and interaction
Let’s add some style
Basic styling and interaction
Add CSS to your index.html
� <head>� <title>My static site</title> � <meta charset="utf-8">� <meta name="description" content="A static site for my TEI">� <meta name="author" content="Me">�� <script src="js/CETEI.js"></script>�� <link rel="stylesheet" href="css/CETEIcean.css"/>�� </head>
Basic styling and interaction
Let’s create a new CSS “style.css” for our own changes. Save it to css
� <head>� <title>My static site</title> � <meta charset="utf-8">� <meta name="description" content="A static site for my TEI">� <meta name="author" content="Me">�� <script src="js/CETEI.js"></script>�� <link rel="stylesheet" href="css/CETEIcean.css"/>� <link rel="stylesheet" href="css/style.css"/>�� </head>
Basic styling and interaction
Writing new styles
div
{ color: red; text-align: center }
selector
declaration
tei-div
{ color: red; text-align: center }
selector
declaration
Basic styling and interaction
Let’s add a new style declaration for tei-supplied in style.css
tei-supplied {
font-style: italic;
}
Atom will suggest CSS � properties and values � as you type
Remember to preview with
Ctrl + Shift + h
Basic styling and interaction
Let’s add a new style declaration for tei-supplied in style.css
tei-supplied {
font-style: italic;
}
A pseudoselector
tei-supplied:before {
content: "["
}
tei-supplied:after {
content: "]"
}
Basic styling and interaction
Exercise: show a new page separator
TEI element: pb
What to style:
Use Atom’s suggestions to look through CSS properties and values as you type
Basic styling and interaction
Styling based on @rend attributes
Example: a drop cap
tei-seg[rend="decorInit"] {
font-size: 300%;
float: left;
line-height: 1em;
padding-right: 10px;
}
<p>� <seg rend="dropInit">T</seg>he� quick brown fox jumped over the� lazy dog.�</p>
he quick brown fox � jumped over the lazy dog.
T
Basic styling and interaction
Let’s add some interaction
There are many ways of adding � interaction to a web page. � We’re just taking a quick dip!
Basic styling and interaction
Hide del in style.css, but only when its container is subst
Give add some color and a pointer cursor
tei-subst > tei-del {
display: none;
text-decoration: line-through;
}
tei-subst > tei-add {
color: blue;
cursor: pointer;
}
Basic styling and interaction
Now add interaction via JavaScript
<script>� var CETEIcean = new CETEI()� CETEIcean.getHTML5("data/TEI.xml", function(data) {� document.getElementById("TEI").appendChild(data)� � var substitutions = document.querySelectorAll("tei-subst")� substitutions.forEach( function(subst){� subst.querySelector("tei-add").addEventListener("click", function(){� var del = subst.querySelector("tei-del")� if (window.getComputedStyle(del).getPropertyValue("display") == "none") {� del.style.display = "inline"� }� else {� del.style.display = "none"� }�� })� })�</script>
This can be hard! Feel free to � copy and paste
Basic styling and interaction
Publishing on GitHub pages
Your static site is ready to go public!
Basic styling and interaction
Publishing on GitHub pages
Basic styling and interaction
Publishing on GitHub pages
🎉🎉🎉
Here is the address to complain
For TEI problems: https://github.com/TEIC/TEI/issues
For CETEIcean bugs: https://github.com/TEIC/CETEIcean/issues
Examples
http://teic.github.io/CETEIcean/
Digital Latin Library Critical Apparatus code: https://github.com/DigitalLatin/viewer / http://digitallatin.github.io/viewer/editio.html (may go away)
TEI Council Technical Working Papers: http://teic.github.io/TCW/