First, we will prepare your working directory for usage by initialising Alexandria:
! alexandria init
The next step is to register "lighthouse-woolf.tagml" as a document in the Alexandria repository you just started on your machine.
! alexandria add tagml/lighthouse-woolf.tagml
You have now added the TAGML file "lighthouse-woolf.tagml".
At all times, you can check which documents and views are registered in Alexandria:
! alexandria status
Alexandria will inform you about the registered documents and views, and shows the state of the source files.
Adding files to Alexandria basically means you have registered them for your local repository, but mind you: the files are not yet committed to your local repository. Let's do that now:
! alexandria commit tagml/lighthouse-woolf.tagml
You can also commit all files that you have added at once with commit -a
, which means something like "commit all at once":
! alexandria commit -a
When you commit a TAGML file to your local Alexandria repository, the file is parsed automatically. If you made any syntax mistakes in your TAGML transcription, Alexandria will abort the commit and inform you that you made a syntax error, what error it is exactly and in which line you can find it. You can go back to the file and correct the mistake. Once you have done that, you can commit the file again.
Conceptually, views are a selection of layers and/or or markup elements. In a JSON file, you identify the markup and layers you want to include or exclude in the view. We use the file "lighthouse-woolf.tagml" as a starting point for the view definition.
First, we create a view that includes only the markup element s
.
Open a new text file in the views/
directory by selecting 'text file' in the 'New'-dropdown menu on the right side of the Jupyterhub environment.
Enter the following lines of code in the text file:
{"includeMarkup": ["s"]}
Change the name of the file to "view-s-markup.json".
Save and close the file.
Let's create another view, that includes all markup with the layer ID "T".
Open a new text file in the views/
directory and enter the following code:
{"includeLayers":["T"]}
Rename the file to "view-T-layer.json", then save and close the file.
Let's commit the views we just created into our local repository:
! alexandria commit -a
They should all be ready, so let's check with Alexandria by running alexandria status
again:
! alexandria status
The command provides information about the version plus the documents and the views you have registered in the repository.
Let's take a look at the views we have just created:
! ls views/
We can now add these views to the Alexandria repository as well. Note that files with the .json extension are automatically understood as views. You add the views in the same way as you've added the transcriptions:
! alexandria add views/view-s-markup.json
! alexandria commit views/view-s-markup.json
The name of the view is derived from the name of the file, so "view-s-markup.json" will become view-s-markup
in the Alexandria repository.
Repeat this step for the other views.
Check with alexandria status
if everything worked:
! alexandria status
You can use the views you have just defined to checkout a view on the documents:
! alexandria checkout view-s-markup
This updates the TAGML files from the document to contain only text and s
markup.
If you want to deactivate the view and return to the original tagml file, you can run:
! alexandria checkout -
The -
parameter after checkout
will reset the TAGML files.
You can repeat these steps for the other view you have created. Play around with it for a while!
In the next notebook we will continue working with views, including an export to XML and HTML.