creator greenstone@cs.waikato.ac.nz maintainer greenstone@cs.waikato.ac.nz public true buildtype mg indexes section:text defaultindex section:text plugin GreenstoneXMLPlugin # We want the two types of paged documents to be treated differently: paged # and hierarchical. So include two PagedImagePlugin plugins and modify the # process_exp. plugin PagedImagePlugin -process_exp xml.*\.item$ -create_screenview true -OIDtype assigned -minimumsize 100 -OIDmetadata ItemOID -documenttype hierarchy plugin PagedImagePlugin -create_screenview true -OIDtype assigned -minimumsize 100 -OIDmetadata ItemOID -documenttype paged plugin MetadataXMLPlugin plugin ArchivesInfPlugin plugin DirectoryPlugin classify AZCompactList -metadata Series -sort Date classify DateList # Format statements to display Series, Volume, Number and Date information format DocumentVList "[link][icon][/link] {If}{[Series],[Series] {If}{[Volume],Vol. [Volume]} {If}{[Number],No. [Number]},[highlight]{Or}{[Title],[PageNum]}[/highlight]}" format CL1VList "[link][icon][/link] {If}{[numleafdocs],[Title],{If}{[Volume],Vol. [Volume]} {If}{[Number],No. [Number]} ([format:Date])}" format SearchVList "[link][icon][/link] [parent(Top):Series] {If}{[parent(Top):Volume],Vol. [parent(Top):Volume]} {If}{[parent(Top):Number],No. [parent(Top):Number]} Page [Title]" format DateList "[link][icon][/link] [Series] {If}{[Volume],Vol. [Volume]} {If}{[Number],No. [Number]}" format HList "[link][highlight][ex.Title][/highlight][/link]" # We customise the document display, so use the extended options format AllowExtendedOptions true # We want to add in fullsize/preview/text buttons to switch between the # different versions of each page format DocumentHeading "
{Or}{[parent(Top):Series],[Series]}
[DocumentButtonDetach][DocumentButtonHighlight] {If}{_cgiargp_ eq \'fullsize\',{If}{[screenicon],_document:viewpreview_} {If}{[NoText] eq \'1\',,_document:viewtext_}, {If}{_cgiargp_ eq \'preview\',{If}{[srcicon],_document:viewfullsize_} {If}{[NoText] eq \'1\',,_document:viewtext_}, {If}{[srcicon],_document:viewfullsize_} {If}{[screenicon],_document:viewpreview_}}}
[DocTOC]
" # Document text display changes based on the p argument - this is not used #normally for document display, so we can use it here to switch between #fullsize/preview/text versions. format DocumentText "
{If}{_cgiargp_ eq \'fullsize\',[srcicon], {If}{_cgiargp_ eq \'preview\',[screenicon],{If}{[NoText] eq \'1\',,[Text]}}}
" # -- English strings -------------------- collectionmeta collectionname [l=en] "Paged Image example" collectionmeta .section:text [l=en] "newspaper pages" # -- Spanish strings -------------------- collectionmeta collectionname [l=es] "Ejemplo de imágenes paginadas" collectionmeta .section:text [l=es] "páginas de diario" # -- Simplified Chinese strings -------------------- collectionmeta collectionname [l=zh] "分页图片示范馆藏" collectionmeta .section:text [l=zh] "报纸页面" # -- English text ----------------------- collectionmeta collectionextra [l=en] "This collection contains a few newspapers from the Niupepa collection of Maori newspapers.

How the collection works

Each newspaper issue consists of a set of images, one per page, and a set of text files for the OCR\'d text. An item file links the set of pages into a single newspaper document. PagedImagePlugin is used to process the item files.

There are two styles of item files, and this collection demonstrates both. The first uses a text based format, and consists of a list of metadata for the document, and a list of pages. Here are some examples: Te Waka o Te Iwi, Vol. 1, No. 1, Te Whetu o Te Tau, Vol. 1, No. 3. This format allows specification of document level metadata, and a single list of pages.

The second style is an extended format, and uses XML. It allows a hierarchy of pages, and metadata specification at the page level as well as at the document level. An example is Matariki 1881, No. 2. This newspaper also has an abstract associated with it. The contents have been grouped into two sections: Supplementary Material, which contains the Abstract, and Newspaper Pages, which contains the page images.

Paged documents can be presented with a hierarchical table of contents (e.g. this one), or with next and previous page arrows, and a goto page box (e.g. this one). This is specified by the -documenttype (hierarchy|paged) option to PagedImagePlugin. The next and previous arrows suit the linear sequence documents, while the table of contents suits the hierarchically organised document. Ordinarily, a Greenstone collection would have one plugin per document type, and all documents of that type get the same processing. In this case, we want to treat the XML-based item files differently from the text-based item files. We can achieve this by adding two PagedImagePlugin plugins to the collection, and configuring them differently.

plugin PagedImagePlugin -documenttype hierarchy -process_exp xml.*\.item$
plugin PagedImagePlugin -documenttype paged

XML based newpapers have been grouped into a folder called xml. This enables us to process these files differently, by utilising the process_exp option which all plugins support. The first PagedImagePlugin in the list looks for item files underneath the xml folder. These documents will be processed as hierarchical documents. Item files that don\'t match the process expression (i.e. aren\'t underneath the xml folder) will be passed onto the second PagedImagePlugin, and these are treated as paged documents.

Formatting

We have modified the document formatting to display fullsized images, preview images or text, with buttons to switch between them. This involves modifications to the DocumentHeading and DocumentText format statements in the collection configuration file, and some macro definitions in the extra.dm macro file. The extra.dm macro file provides definitions for the buttons (\_viewfullsize\_, \_viewpreview\_, \_viewtext\_) which are used by the format statement in the collect.cfg file. The format statement switches the document display and sets the buttons to be displayed based on the p argument, which is also set by the format statement. " # -- Spanish text ----------------------- collectionmeta collectionextra [l=es] "Esta colección contiene algunos diarios de la colección Niupepa de periódicos Maories.

Cómo funciona la colección

Cada diario consiste en un conjunto de imágenes, una por página, y un conjunto de archivos de texto provenientes del OCR. Un archivo .item relaciona al conjunto de páginas en un único documento de diario. PagedImagePlugin se utiliza para procesar esos archivos .item.

Hay dos estilos para escribir esos archivos item. y esta colección demuestra ambos. El primero usa un formato básico de texto, y consiste en una lista de metadatos para el documento, y una lista de páginas. Aquí hay algunos ejemplos: Te Waka o Te Iwi, Vol. 1, No. 1, Te Whetu o Te Tau, Vol. 1, No. 3. Este formato permite la especificación de metadatos a nivel de documento, y una lista simple de páginas.

El segundo estilo es un formato extendido y usa XML. Permite una jerarquía de páginas, y una especificación de metadatos a nivel de documento como también de páginas. Un ejemplo es Matariki 1881, No. 2. Este diario también tiene un resumen asociado a él. Los contenidos han sido agrupados en 2 secciones: Material Suplementario, la cual contiene el resumen, y Páginas del Diario, que contiene las imágenes de las páginas.

Los documentos paginados pueden presentarse con una tabla de contenidos jerárquica (por ej. esta), o con flechas \"Siguiente" (por ej. esta). Esto es definido por la opción -documenttype (hierarchy|paged) asignada al plugin PagedImagePlugin. Las flechas Siguiente y Anterior permiten seguir el documento de manera lineal, mientras que la tabla de contenidos muestra al documento organizado jerárquicamente. Generalmente, una colección de Greenstone tendría un plugin por cada tipo de documento y todos los documentos de ese mismo tipo tendrían el mismo procesamiento. En este caso, queremos tratar los archivos .item con formato XML de manera diferente a aquellos con formato de texto plano. Esto puede lograrse agregando dos plugin PagedImagePlugin a la colección, y configurándolo de manera diferente.

plugin PagedImagePlugin -documenttype hierarchy -process_exp xml.*\.item$
plugin PagedImagePlugin -documenttype paged

Los diarios basados en XML han sido agrupados en una carpeta llamada xml. Esto nos permite procesar esos archivos de una manera diferente, utilizando la opción process_exp que es soportada por todos los plugins. El primer plugin PagedImagePlugin en la lista busca archivos .item que se encuentren en la carpeta xml. Estos documentos se procesarán como documentos jerárquicos. Los archivos .item que no coincidan con la expresión de procesamiento (por ejemplo, los que no estén dentro de la carpeta xml) serán pasados al segundo plugin PagedImagePlugin, y se tratarán como documentos paginados.

Formateo

Hemos modificado el formateo del documento para mostrar imágenes a tamaño completo, previsualizar imágenes o texto y botones para cambiar entre estas opciones. Esto involucra modificaciones a las cadenas de formateo del DocumentHeading y el DocumentText en el archivo de configuración de la colección., y algunas definiciones de macros en el archivo de macros extra.dm. El archivo extra.dm provee definiciones para los botones (\_viewfullsize\_, \_viewpreview\_, \_viewtext\_) los cuales son usados por la sentencia de formateo en el archivo collect.cfg. La sentencia de formateo cambia la visualización del documento y setea los botones que deben mostrarse basándose en el argumento p, el cual es configurado también en la misma sentencia. " # -- Simplified Chinese text ----------------------- collectionmeta collectionextra [l=zh] "本馆藏包含若干源自 Niupepa馆藏的毛利报纸。

本馆藏如何工作

每期报纸由一组图片组成,每页对应一张图片,以及一组包含OCR文本的文本文件。 由一个item文件将一组页面链接起来,形成一个报纸文档。PagedImagePlugin用于处理这些item文件。

item文件有两种格式,而本馆藏将演示这两种格式。第一种是基于文本的格式,由一个文档元数据列表和 一个页面列表组成. 比如: Te Waka o Te Iwi,第1卷,第1期Te Whetu o Te Tau,第1卷,第3期。 这种格式允许设置文档级的元数据,以及一个页面列表。

第二种格式是一种使用XML的扩展格式。这种格式允许设置层级式页面列表,并且元数据可以是页面级的也可以是文档级的。 比如Matariki 1881,第2期。这期报纸还有附属的文摘。 这期报纸的内容被分为两个部分:包括文摘在内的补充材料,以及报纸的页面,即页面图片。

分页文档可以用一个层级式的内容大纲显示(例如这个文档) ,或者用下一页和前一页的页面箭头以及一个跳转页面输入框来显示 (比如这个文档)。 这是通过设定PagedImagePlugin的-documenttype (hierarchy|paged)选项来实现的。 下一页和前一页箭头适用于线性序列的文档,而内容大纲适用于层级式的文档。一般情况下,一个Greenstone馆藏用一个插件处理一种类型的文档, 因此所有同类型的文档都将以同一种方式进行处理。在这种情况下,我们想用不同的方式分别处理基于XML的item文件与基于文本的item文件。 这可以通过在馆藏中添加两个PagedImagePlugin插件来完成,并对其分别进行不同的设置。

plugin PagedImagePlugin -documenttype hierarchy -process_exp xml.*\.item$
plugin PagedImagePlugin -documenttype paged

基于XML的报纸被集中置于一个称为xml的文件夹中。这允许我们用不同方式对这些文件进行处理, 这是通过设置所有插件都支持的process_exp选项来实现的。列表中的第一个PagedImagePlugin将查找xml文件夹下的所有item文件。 这些文档将会按层级式文档进行处理。不匹配处理表达式的item文件(即不在xml文件夹中的item文件)将被传递给第二个PagedImagePlugin,而这些将会按分页文档进行处理。

格式化

我们已经修改了文档的格式使其显示全幅的图片,预览图片或者文本,以及在不同模式之间进行转换的按钮。 这涉及到在馆藏的配置文件中修改 DocumentHeading和DocumentText格式变量,以及 extra.dm宏文件中的一些宏。 extra.dm宏文件提供按钮(\_viewfullsize\_,\_viewpreview\_,\_viewtext\_)的定义,这些定义在collect.cfg文件的格式变量中用到。 格式变量根据p参数的值转换到不同的文档显示模式以及对应的按钮,而p参数也是由格式参数所设定的。 "