Formatting For Wiki Pages Used As Thdl Content

THL Toolbox > Developers' Zone > Web Development > Formatting for Wiki Pages Used as THL Content

Formatting for Wiki Pages Used as THL Content

Topics: Floated Images | Images in Teasers | Resource links |Links Within Wiki Text | Encrypted E-mail | Example Markup | Flexible Tibetan Display

Note: This page describes only how to code the content of wiki pages that are included as the content of a teaser box and so forth. The description of how to create such a teaser box on a PHP page is found at Creating Teaser Boxes that Use Wiki Content.

In order for the wiki-import code to work, the wiki pages that are absorbed into the THL look-and-feel have to be formatted in the same way. There are two ways that wikis are imported into a THL page: into highlight (or teaser) boxes or as the complete contents of the page. However, the same basic rules apply to both instances. The basic rules for formatting wiki pages for inclusion in THL pages are:

  1. All breadcrumbs must be in h6 header and there must be a blank-line between the breadcrumbs (h6) and the page header (h1). Also, do not use an anchor tag at the top of the document, such as {anchor:top}.
  2. Title of the page is in a wiki h1 Header. This becomes the title of the teaser box in all instances except introductory blurbs (tzr-intro-1) and paragraphs. For whole wiki pages, this becomes the title of the browser page.
  3. Secondary headers are in h2 and tertiary headers in h3. (In teaser boxes these will become the sub and sub-sub headers respectively.
  4. Any credits to author of the wiki page should be in an wiki h5 header. (This will not be included in teaser boxes.)
  5. Images that are to be floated right or left should be wrapped in divs with a class of either "img-right-shadow" or "img-left-shadow".
  6. Links to THL resources need to be written in a special way as detailed below.
  7. Links within that same wiki page need to be [Label|#sectionname]. This will link to an area in the page where there is an anchor tag: {anchor:sectionname}.
  8. Text must be in a straight paragraph style - the initial text cannot be a list of any type
  9. If you want to render characters that are used as wiki instructions in the wikis themselves, such as {, }, [, ], #, *, etc., they need to be preceded by a \ (i.e. one backslash). Thus, the code would be \{, \[, etc. Backslashes themselves are encoded by three backslashes, \\\.
  10. For THL links that use the hash within the link URL, the pound-sign (#) must be replaced by # so that a link to EWTS would be: Links to other wiki pages, of course, are done simply through using the square brackets and the global name for the page and do not need to use this method.
  11. In {code} sections, the following entities must be used instead of the straight characters:
    • For the open-tag bracket (<) use: <
    • For the close-tag bracket (>) use: >
    • Thus for <tt>text</tt>, you need to do it as &amp;lt;tt&amp;gt;text&amp;lt;/tt&amp;gt; in order for it to appear as &lt;tt&gt;text&lt;/tt&gt;
    • To start a new line (i.e. paragraph return) use: &amp;#xd;
    • To indent use two space entities as follows: &amp;#x20;&amp;#x20;
    • For characters with diacritics use the character entities formed by appending ampersand (&amp;), pound (#), "x" to their Unicode hexadecimal value. (Leading zeros may be excluded.)

Two rules apply only to the use of wiki for spotlight boxes (tzr-box-1 and tzr-1):

  1. Following the paragraph of descriptive text, a link to the resource may be included within a div class="resource-link".
  2. If there is an image in the box, the URL to the image should be included after the link above with the text of the link set to "image".

The following sections deal with other topics relating to the markup of wiki pages for inclusion (via AJAX) into THL pages. Each topic is linked to from the topic list above for easy reference. Further topics will be added as the occasions arise.

Back to Top {anchor:fltimg}

Floated Images in Wiki Page

Images in wikis can be floated within a THL page by wrapping them in a div with either the class "img-right-plain" or "img-left-plain". To do this, one uses the code {block:img-…-plain}…{block} code. An example of this using an image in collab:

{block:img-right-plain}{image:worksite:/THDL Toolbox Images/lamawriting.gif|lamawriting.gif}{block}

An example using an image on quandu:

{block:img-left-plain}
     {image:|/places/monasteries/sera/people/images/sera-ticket.jpg}Figure 1: 
     A Sera Entrance Ticket from 2002.
{block}

Back to Top

Images for Teaser Boxes

The teaser boxes, such as tzr-box1, often have small images at the top right-hand quadrant of the box. The URL for these images should be included at the bottom of the wiki page, marked up in the wiki as a link with the text of the link as "image" and the URL of the link as the URL for the image. For the time being, images are stored in the appropriate images folder on the regular THL site, and not in the wiki's resource section. In the future, once the Media Management System (MMS) is integrated into THL, all images can be stored there and the URLs will be configured accordingly. A caption that appears when the cursor is hovered over an image can be added in a caption block after the image. An example of an image wiki in a teaser box wiki would be:

{link:image|/encyclopedias/literary/images/sm-stacked-texts.jpg}
{block:caption}A cabinet containing a collection of Tibetan texts{block}

The general size for such images should be around 120 x 120 px. Once the MMS is in action, the URL can ask for a specific size image.

Back to Top

Links to THL Resources in Wikis

Should you want the spotlight box or other teaser box to link to a resource other than the wiki page, the URL for that resource can be included at the bottom of the page within a block (div) whose class is set to "resource-link". This is done by including the link within {block:resource-link} … {block} wiki codes.

For either teaser boxes or whole wiki pages embedded in a THL context, URLs for resource links or images can be either absolute to the "http://www.thlib.org/…" site or relative to the staging site, external link: http://staging.thlib.org/…". To include a relative link without using the {link: …} syntax you can simply use the word "DOMAIN" in place of the www.thlib.org as in:

{block:resource-link}
     http://DOMAIN/places/monasteries/sera/
{block}

Relative THL links can also be coded. Example:

{block:resource-link}
     {link:/places/monasteries/sera/}
{block}

To link to a specific Place Dictionary record:

{block:resource-link}
    http://DOMAIN/places/polities/&#x23;iframe=http://places.thlib.org/features/15483
{block}

{link:image|/places/polities/images/A2189.jpg}

PLEASE NOTE THAT IF THE LINK IS A DOMAIN LIKE PLACES.THLIB.ORG, YOU HAVE TO USE TWO SLASH MARKS (//) INSTEAD OF ONE AFTER LINK:!!


For links to wiki pages included within the THL page, use "WIKI", as in:

{block:resource-link}
     http://WIKI/access/wiki/site/881b357c-7a1a-49ce-80b5-009e07d50d63/mailing%20lists.html
{block}

Note: if the URL for the wiki has spaces in it at the end, such as mailing lists, then replace the white space with %20 (as in the example above).
Note: if the URL for the wiki has an ampersand in it, such as /site/c06fa8cf-c49c-4ebc-007f-482de5382105/community & communication.html, then replace the ampersand with %26. This would then be:

{block:resource-link}
     http://WIKI/access/wiki/site/c06fa8cf-c49c-4ebc-007f-482de5382105/community%20%26%20communication.html
{block}

Note that in the wiki page itself this link won't work, but when you open the thlib.org page into which the wiki content is delivered, the page will display (and in the URL the %26 will become |amp|).


For links to essay pages included within the THL page, use "ESSAY", as in:

{block:resource-link}
     http://ESSAY/cabezon/sera/monks/
{block}

Note: this will link to an essay page and change the links in the side column to the TOC for the essay. Should you want just the text of the essay in the body of the page without changing the side column links to the essay's toc, use "ESSAYPG", as in:

{block:resource-link}
     http://ESSAYPG/cabezon/sera/monks/
{block}


To link to an MMS page (the media management repository): the only way to do such links right now (Sept 26, 2011) is to link directly to production so


To link to an MMS page (the media management repository) and keep the banner of the page you are linking from: the only way to do such links right now (Sept 26, 2011) is to link directly to production so

{link:Sera Hermitages|/places/monasteries/&#x23;iframe=http://mms.thlib.org/media_objects?category_id=4176&type=Picture}


To link to a page in SPT (the THL bibliographic repository), use "SPT" as the wiki constant, as in:

{link:PIATS 1|http://SPTHOME/SPT--BrowseResources.php?ParentId=1151}.

Note: this is how the Wiki page will display. However, in the actual code in the wiki page you need to insert a backslash before each of the two dashes.


Finally, the "Explore!" text used for these links can be customized by adding the custom text to the resource-link in the wiki. This is done by using the {link:text|url} wiki-command, and placing the desired link-text followed by a vertical bar (|) prior to the URL of the link. Example:

{block:resource-link}
     {link:View Degé Kangyur|/encyclopedias/literary/canons/dege-kangyur-cat.php}
{block}

Back to Top

Links in Wiki Teaser Text

Should a wiki teaser contain links to a variety of resources, such links would be included within the text of the wiki that is used as the content for the teaser box. These take the normal wiki link form of:

{link:Link Text|URL of link}

such as:

{link:Monasteries Home|/places/monasteries/}

To get such links to open in a new window, append "|THLIB-NEWWIN/places/maps/" to the beginning of the URL as in:

{link:Monasteries Home|THLIB-NEWWIN/places/monasteries/}

Note: This is only for links within the text of a teaser box. As described elsewhere, the way to get a teaser box to link to a new window is by adjusting the PHP link to the teaser wiki and adding a class "o4" to it. See the page on Creating Teaser Boxes that Use Wiki Content.

Back to Top

Encrypting Email Address

Using the THL e-mail encryptor, one first creates the encrypted e-mail string and then adds a link such as:

{link:send e-mail|javascript:linkTo_UnCryptMailto('nbjmup;uimAdpmmbc/jud/wjshjojb/fev');}

Try this external link: test e-mail link. For more information, see encrypted email links.

Back to Top

Wiki Example

An example of a properly marked-up wiki page to be included in a spotlight is:

h6 [About THL | home] > [Features & Spotlights] >  Spotlights in the Literary Encyclopedia

h1 Spotlight in the Literary Encyclopedia

h2 Tibetan Literature: Studies in Genre

h3 ~ Essays in Honor of Geshe Lhundup Sopa

A collection of essays by leading scholars that address an array of topics concerning Tibetan literature, 
including history, biography, canonical texts, philosophical and ritual literature, literary arts, 
non-literary arts and sciences, and guidebooks and reference works. 

{block:resource-link}
http://www.thdl.org/collections/literature/genres/book/show.php
{block}

{link:image|/encyclopedias/literary/images/sm-stacked-texts.jpg}

See our [Archive of Spotlights in the Literary Encyclopedia].

Back to Top

Marking up Tibetan Language Items in Wiki pages for Flexible Display

In certain areas of the THL site, such as the catalogs, an option form is provided to display or not display certain languages or transliterations. In order for this to work properly on wiki pages included in such areas, the languages need to be marked up properly. This refers only to alternative languages included in parentheses after the initial term or title.

The basic principles of the wiki markup for such situations are:

  1. surround each language with a span tag whose class is set to the language abbreviation (tib, wyl, san, eng).
  2. After each language (except the last) put the marked up separator string: {span:sep}, {span}. (Here, "sep" means separator. The text inside this tag is generally a comma and a space, but in some situations other separators, semicolon, dash, etc. may be used.)
  3. surround the references to text ids with the {span:textnum}…{span} markup.
  4. the main text (outside the parentheses) needs not specific markup unless it is an italicized title etc.

Thus, when you have something like "The Foundations of Monastic Conduct (འདུལ་བ་གཞི་, ’dul ba gzhi, vinayavastu, D.0001)":

  • Around the Unicode Tibetan, place the markup {span:tib}འདུལ་བ་གཞི་{span}
  • Follow this with {span:sep}, {span}
  • Around the Wylie, place the markup {span:wyl}’dul ba gzhi{span}
  • Follow this with {span:sep}, {span}
  • Around the Sanskrit, place the markup {span:san}vinayavastu{span}
  • Follow this with {span:sep}, {span}
  • Around the text number put {span:textnum}D.0001{span}

Thus, the markup for the above example is:

Foundations of Monastic Conduct ({span:tib}འདུལ་བ་གཞི་{span}{span:sep}, {span}
{span:wyl}’dul ba gzhi{span}{span:sep}, {span}
{span:san}vinayavastu{span}{span:sep}, {span}
{span:textnum}D.0001{span})

Back to Top