Greenstone tutorial exercise

Back to wiki
Back to index
Devised for Greenstone version: 2.70w|3.06
Modified for Greenstone version: 2.87|3.08

Section tagging for HTML documents

  1. In a browser, visit the Greenstone demo collection and have a look at it. Browse to one of the documents. This collection is based on HTML files, but they appear structured in the collection. This is because these HTML files were tagged by hand into sections.

  1. Using a text editor (e.g. WordPad) open up one of the HTML files from the demo collection: Greenstone → collect → demo → import → fb33fe → fb33fe.htm . You will see some HTML comments which contain section information for Greenstone. They look like:

    <!--
    <Section>
    <Description>
    <Metadata name="Title">Farming snails 1: Learning about snails;
    Building a pen; Food and shelter plants</Metadata>
    </Description>
    -->

    <!--
    </Section>
    <Section>
    <Description>
    <Metadata name="Title">Dew and rain</Metadata>
    </Description>
    -->

    When Greenstone encounters a <Section> tag in one of these comments, it will start a new subsection of the document. This will be closed when a </Section> tag is encountered. Metadata can also be added for each section—in this case, Title metadata has been added for each section. In the browser, find the Farming snails 1 document in the demo collection (through the Titles browser). Look at its table of contents and compare it to the <Section> tags in the HTML document.

  1. Add a new Section into this document. For example, lets add a new subsection into the Introduction chapter. In the text editor, add the highlighted text just after the tag for the Introduction section:

    <!--
    <Section>
    <Description>
    <Metadata name="Title">Introduction</Metadata>
    </Description>
    -->
    <!--
    <Section>
    <Description>
    <Metadata name="Title">Snails are good to eat.</Metadata>
    </Description>
    -->

    Then just before the next section tag (What do you need to start?), add the highlighted section:

    <!--
    </Section>
    -->

    <!--
    <Section>
    <Description>
    <Metadata name="Title">What do you need to start?</Metadata>
    </Description>
    -->

    Save the edited file and close it. The effect of these changes is to make a new subsection inside the Introduction chapter.

  1. Open the Greenstone demo collection in the Librarian Interface. In the Document Plugins section of the Design panel, note that HTMLPlugin has the description_tags option set. This option is needed when <Section> tags are used in the source documents.

  1. Build and preview the collection. Look at the Farming snails 1 document again and check that your new section has been added.


Copyright © 2005-2016 by the New Zealand Digital Library Project at the University of Waikato, New Zealand
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled “GNU Free Documentation License.”