Books

Django app for book, volume and page content and access. Provides eulfedora.models.DigitalObject models for books and two variants of volume and page objects.

For more information on the Fedora content modeling and object relations, see Book Content Models and Volume and Page variants.

DigWF

Client and XmlObject classes to interact with the Digitization Workflow API in order to retrieve information about Large Scale Digitization Initiative (LSDI) content.

Note

DigWF is a legacy application (no longer in use) that contains data about existing Emory Readux volumes. The DigWF API was used to import cover images and selected page images.

class readux.books.digwf.Client(url)[source]

A simple client to query the Digitization Workflow REST(ish) API for information about files associated with LSDI/DigWF items.

Parameters:baseurl – base url of the api for the DigWF REST service., e.g. http://my.domain.com/digwf_api/
get_items(**kwargs)[source]

Query the DigWF API getItems method. If no search terms are specified, getItems returns any items that are in the Ready for Repository state. Any keyword arguments will be passed to getItems as query arguments. Currently supports:

  • control_key (e.g., ocm or ocn number) - may match more than one item
  • item_id - the item id for the record in the DigWF
  • pid - the noid portion of the pid/ARK for the item
Returns:Items
class readux.books.digwf.Item(node=None, context=None, **kwargs)[source]

XmlObject to read Item information returned by the DigWF API.

(Not all fields provided by DigWF are mapped here; only those currently in use.)

pid = <eulxml.xmlmap.fields.StringField>

pid (noid portion of the ARK or Fedora pid)

item_id = <eulxml.xmlmap.fields.StringField>

item_id within the DigWF

control_key = <eulxml.xmlmap.fields.StringField>

control key (e.g., ocm or ocn number in euclid; unique per book, not per volume)

display_image_path = <eulxml.xmlmap.fields.StringField>

display image path

ocr_file_path = <eulxml.xmlmap.fields.StringField>

path to OCR files (text & word position)

pdf = <eulxml.xmlmap.fields.StringField>

path to PDF file

class readux.books.digwf.Items(node=None, context=None, **kwargs)[source]

XmlObject for the response returned by getItems. Has a count of the number of items found, and a list of Item objects with details about each item.

count = <eulxml.xmlmap.fields.IntegerField>

number of items in the result

items = <eulxml.xmlmap.fields.NodeListField>

List of items as instances of Item

TEI

class readux.books.tei.TeiBase(node=None, context=None, **kwargs)[source]

Base class for all TEI objects, with all namespaces

class readux.books.tei.Graphic(node=None, context=None, **kwargs)[source]

TEI Graphic

url = <eulxml.xmlmap.fields.StringField>

url

rend = <eulxml.xmlmap.fields.StringField>

rend

class readux.books.tei.Zone(node=None, context=None, **kwargs)[source]

XmlObject for a zone in a TEI facsimile document

id = <eulxml.xmlmap.fields.StringField>

xml id

n = <eulxml.xmlmap.fields.StringField>

n attribute

type = <eulxml.xmlmap.fields.StringField>

type attribute

ulx = <eulxml.xmlmap.fields.FloatField>

upper left x coord

uly = <eulxml.xmlmap.fields.FloatField>

upper left y coord

lrx = <eulxml.xmlmap.fields.FloatField>

lower right x coord

lry = <eulxml.xmlmap.fields.FloatField>

lower right y coord

href = <eulxml.xmlmap.fields.StringField>

xlink href

text = <eulxml.xmlmap.fields.StringField>

text content

word_zones = <eulxml.xmlmap.fields.NodeListField>

list of word zones contained in this zone (e.g., within a textLine zone)

preceding = <eulxml.xmlmap.fields.NodeField>

nearest preceding sibling word zone (e.g., previous word in this line), if any)

parent = <eulxml.xmlmap.fields.NodeField>

nearest ancestor zone

page = <eulxml.xmlmap.fields.NodeField>

containing page

graphics = <eulxml.xmlmap.fields.NodeListField>

list of graphic elements (i.e. page images)

full_image = <eulxml.xmlmap.fields.NodeField>

full size image (tei:graphic with type “full”)

page_image = <eulxml.xmlmap.fields.NodeField>

page size image (tei:graphic with type “page”)

thumbnail = <eulxml.xmlmap.fields.NodeField>

thumbnail image (tei:graphic with type “thumbnail”)

small_thumbnail = <eulxml.xmlmap.fields.NodeField>

small thumbnail image (tei:graphic with type “small-thumbnail”)

image_info = <eulxml.xmlmap.fields.NodeField>

image info as provided by IIIF (tei:graphic with type “info”)

width

zone width

height

zone height

avg_height

Calculated average height of word zones in the current zone (i.e. in a text line)

class readux.books.tei.Ref(node=None, context=None, **kwargs)[source]

Tei reference

target = <eulxml.xmlmap.fields.StringField>

target

type = <eulxml.xmlmap.fields.StringField>

type

text = <eulxml.xmlmap.fields.StringField>

text

class readux.books.tei.BiblStruct(node=None, context=None, **kwargs)[source]

Structured Bibliographic citation

id = <eulxml.xmlmap.fields.StringField>

xml id

corresp = <eulxml.xmlmap.fields.StringField>

corresp

type = <eulxml.xmlmap.fields.StringField>

type

class readux.books.tei.Note(node=None, context=None, **kwargs)[source]

Tei Note, used here to contain an annotation

id = <eulxml.xmlmap.fields.StringField>

xml id

resp = <eulxml.xmlmap.fields.StringField>

responsibility

target = <eulxml.xmlmap.fields.StringField>

target

type = <eulxml.xmlmap.fields.StringField>

type

ana = <eulxml.xmlmap.fields.StringField>

ana attribute, e.g. for tag identifiers

href = <eulxml.xmlmap.fields.StringField>

xlink href

paragraphs = <eulxml.xmlmap.fields.StringListField>

list of paragraphs as strings

markdown = <eulxml.xmlmap.fields.StringField>

code for the markdown used in the original annotation

related_pages = <eulxml.xmlmap.fields.NodeListField>

links to related pages

citations = <eulxml.xmlmap.fields.NodeListField>

list of bibliographic citations/works cited

class readux.books.tei.Bibl(node=None, context=None, **kwargs)[source]

TEI Bibl, with mappings for digital edition and pdf urls

type = <eulxml.xmlmap.fields.StringField>

type

title = <eulxml.xmlmap.fields.StringField>

title

authors = <eulxml.xmlmap.fields.StringListField>

author

date = <eulxml.xmlmap.fields.StringField>

date

url = <eulxml.xmlmap.fields.StringField>

url to digital edition

pdf_url = <eulxml.xmlmap.fields.StringField>

url to pdf of digital edition

class readux.books.tei.PublicationStatement(node=None, context=None, **kwargs)[source]

Publication statement, with mapping for readux distributor

desc = <eulxml.xmlmap.fields.StringField>

descriptive statement (paragraph)

date = <eulxml.xmlmap.fields.DateField>

date in human-readable display format

date_normal = <eulxml.xmlmap.fields.DateField>

normalized date

distributor_readux = <eulxml.xmlmap.fields.StringField>

readux distributor reference (includes ref with target of readux.library.emory.edu)

class readux.books.tei.Facsimile(node=None, context=None, **kwargs)[source]

Extension of eulxml.xmlmap.teimap.TEI to provide access to TEI facsimile elements

XSD_SCHEMA = 'file:///home/docs/checkouts/readthedocs.org/user_builds/readux/checkouts/develop/readux/books/schema/TEIPageView.xsd'

local xsd schema

page = <eulxml.xmlmap.fields.NodeField>

surface with type page, as Zone

page_list = <eulxml.xmlmap.fields.NodeListField>

list of pages (surface with type page)

lines = <eulxml.xmlmap.fields.NodeListField>

list of zones with type textLine or line as Zone

word_zones = <eulxml.xmlmap.fields.NodeListField>

list of word zones (type string) as Zone

distributor = <eulxml.xmlmap.fields.StringField>

publication statment distributor

pubstmt = <eulxml.xmlmap.fields.NodeField>

publication statmnt as PublicationStatement

encoding_desc = <eulxml.xmlmap.fields.NodeField>

encoding description

original_source = <eulxml.xmlmap.fields.NodeField>

source description for the original volume

digital_source = <eulxml.xmlmap.fields.NodeField>

source description for the readux digital edition

class readux.books.tei.Name(node=None, context=None, **kwargs)[source]

Tei NAME, with id attribute and value

id = <eulxml.xmlmap.fields.StringField>

xml id

value = <eulxml.xmlmap.fields.StringField>

full name

class readux.books.tei.AnnotatedFacsimile(node=None, context=None, **kwargs)[source]

Annotated Tei facsimile, with mappings needed to generate TEI with annotations.

main_title = <eulxml.xmlmap.fields.StringField>

main tei title

subtitle = <eulxml.xmlmap.fields.StringField>

tei subtitle (e.g., annotated edition)

responsibility = <eulxml.xmlmap.fields.StringField>

responsibility statement text

responsible_names = <eulxml.xmlmap.fields.NodeListField>

responsibility statement names

annotations = <eulxml.xmlmap.fields.NodeListField>

list of annotations at body/div[@type=”annotations”]/note[@type=”annotation”], as Note

citations = <eulxml.xmlmap.fields.NodeListField>

list of bibliographic citations/works cited

citation_ids = <eulxml.xmlmap.fields.StringListField>

list of bibliographic citation ids

tags = <eulxml.xmlmap.fields.NodeField>

annotation tags, as TeiInterpGroup

class readux.books.tei.Anchor(node=None, context=None, **kwargs)[source]

TEI Anchor, for marking start and end of text annotation highlights

id = <eulxml.xmlmap.fields.StringField>

xml id

type = <eulxml.xmlmap.fields.StringField>

type

next = <eulxml.xmlmap.fields.StringField>

next attribute

Markdown to TEI

readux.books.markdown_tei.convert(text)[source]

Render markdown text as simple TEI. Does not include namespaces or wrapping elements; assumes that the rendered markdown will be inserted into a TEI document as text content, and that it is not intended to be an entire, valid document on its own.

class readux.books.markdown_tei.TeiMarkdownRenderer(**kwargs)[source]

TEI Markdown renderer for use with mistune markdown parsing and rendering library. Renderer is based on the built-in mistune HTML renderer.

audiovideo_ext_mimetype = {'.aac': 'aac', '.webm': 'webm', '.mpeg': 'mpeg', '.m4a': 'mp4', '.mpg': 'mpeg', '.wav': 'wav', '.mp3': 'mpeg', '.mp2': 'mpeg', '.mp1': 'mpeg', '.ogg': 'ogg', '.oga': 'ogg', '.mp4': 'mp4'}

common html5 audio file extensions and corresponding mimetypes; used to infer audio mimetype when it is not specified

classmethod preprocess(text)[source]

Method to preprocess text to make sure it is converted properly. Currently, adds whitespace to ensure that any audio tags will be processed as an html block.

block_code(code, lang=None)[source]

Rendering block level code.

Parameters:
  • code – text content of the code block.
  • lang – language of the given code.
block_quote(text)[source]

Rendering <quote> with the given text.

Parameters:text – text content of the blockquote.
block_html(html)[source]

Rendering block level pure html content. Currently only supports html5 audio tags.

Parameters:html – text content of the html snippet.
header(text, level, raw=None)[source]

Rendering header/heading.

Parameters:
  • text – rendered text content for the header.
  • level – a number for the header level, for example: 1.
  • raw – raw text content of the header.
hrule()[source]

Rendering method for horizontal rule.

list(body, ordered=True)[source]

Rendering list tags.

Parameters:
  • body – body contents of the list.
  • ordered – whether this list is ordered or not.
list_item(text)[source]

Rendering list item.

paragraph(text)[source]

Rendering paragraph tags. Like <p>.

table(header, body)[source]

Rendering table element. Wrap header and body in it.

Parameters:
  • header – header part of the table.
  • body – body part of the table.
table_row(content)[source]

Rendering a table row.

Parameters:content – content of current table row.
table_cell(content, **flags)[source]

Rendering a table cell.

Parameters:
  • content – content of current table cell.
  • header – whether this is header or not.
  • align – align of current table cell.
double_emphasis(text)[source]

Rendering strong text.

Parameters:text – text content for emphasis.
emphasis(text)[source]

Rendering emphasis text.

Parameters:text – text content for emphasis.
codespan(text)[source]

Rendering inline code text.

Parameters:text – text content for inline code.
linebreak()[source]

Rendering line break.

strikethrough(text)[source]

Rendering ~~strikethrough~~ text.

Parameters:text – text content for strikethrough.
text(text)[source]

Rendering unformatted text.

Parameters:text – text content.

Rendering a given link or email address.

Parameters:
  • link – link content or email address.
  • is_email – whether this is an email or not.

Rendering a given link with content and title.

Parameters:
  • link – href link for <a> tag.
  • title – title content for title attribute.
  • text – text content for description.
image(src, title, text)[source]

Rendering a image with title and text.

Parameters:
  • src – source link of the image.
  • title – title text of the image.
  • text – alt text of the image.
inline_html(html)[source]

Rendering span level pure html content.

Parameters:html – text content of the html snippet.
newline()[source]

Rendering newline element.

footnote_ref(key, index)[source]

Rendering the ref anchor of a footnote.

Parameters:
  • key – identity key for the footnote.
  • index – the index count of current footnote.
footnote_item(key, text)[source]

Rendering a footnote item.

Parameters:
  • key – identity key for the footnote.
  • text – text content of the footnote.
footnotes(text)[source]

Wrapper for all footnotes.

Parameters:text – contents of all footnotes.

Custom manage commands

The following management commands are available. For more details, use manage.py help <command>. As much as possible, all custom commands honor the built-in django verbosity options.