Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

infobox element



The "infobox" element in articles allows to add an infobox with a specified template at the top-right corner of the associated article. The content of this element will specify the key/value pairs for the properties of the infobox, and the properties will be presented as cells of a table in their order of their definition in the template.
  • If a value is set for the "name" property, then the associated value will be used for the infobox caption
  • Every properties which have an associated value will be presented as a key/value pair in the infobox

Attributes

The attributes of this element are:
  • "id": the id of the infobox template which is used for this infobox
  • "package" or "pack": The optional package attribute allows to reference the template in another package

Setting the infobox properties

There are two types of properties:

Setting the value of a regular infobox property

The value depend on the type of the property type:
  • The property named name refer to the name of the infobox which will be used in the infobox caption. This property does not need to be defined in the template
  • If the type is text (the default type for an infobox property), then the value will be used directly. For example:
      <property key="prop1" value="my value" />
    
  • If the type is url, then the value must refer to an external link. For example:
      <property key="prop3" value="http://docs.oracle.com/javase/8/docs/api/index.html" />
    
  • If the type is url, then the value must to an image. For example:
      <property key="prop4" value="image1" />
    

Setting the value of an enumeration property

In that case the value lmust be one of the states defined for the property in the template.

Examples

Infobox definition and usage

For the following definition:
   <infoboxDefinition id="infobox1">
      <property key="prop1" desc="property 1" keyRef="article2" />
      <property key="prop2" desc="property 2" />
      <property key="prop3" desc="property 3" type="url" />
      <property key="prop4" desc="property 4" type="image" />
   </infoboxDefinition>
If we have the following instance:
   <article desc="article20">
      <infobox id="infobox1">
         <property key="name" value="the name" />
         <property key="prop1" value="my value" />
         <property key="prop2">The text</property>
         <property key="prop3" value="http://docs.oracle.com/javase/8/docs/api/index.html" />
         <property key="prop4" value="image1" />
      </infobox>
   a text.
   </article>
The result will be:
infobox

Another infobox definition with an enumeration property

For the following definition:
   <infoboxDefinition id="infobox1">
      <property key="prop1" desc="property 1" keyRef="article2" />
      <enumProperty key="prop2" desc="property 2">
         <state value="one" desc="the first value" />
         <state value="two" desc="the second value" />
      </enumProperty>
   </infoboxDefinition>
We can have the following instance:
   <article desc="article20">
      <infobox id="infobox1">
         <property key="name" value="the name" />
         <property key="prop1" value="my value" />
         <property key="prop2" value="one"</property>
      </infobox>
   a text.
   </article>

Another infobox definition with an enumeration property and a default state

Infobox usage with an enumeration property and a default state

For the following definition:
   <infoboxDefinition id="infobox1">
      <property key="prop1" desc="property 1" keyRef="article2" defaultState="two" />
      <enumProperty key="prop2" desc="property 2">
         <state value="one" desc="the first value" />
         <state value="two" desc="the second value" />
      </enumProperty>
   </infoboxDefinition>
If we have the following instance:
   <article desc="article20">
      <infobox id="infobox1">
         <property key="name" value="the name" />
         <property key="prop1" value="my value" />
      </infobox>
   a text.
   </article>
The result will be equivalent to:
   <article desc="article20">
      <infobox id="infobox1">
         <property key="name" value="the name" />
         <property key="prop1" value="my value" />
         <property key="prop2" value="two"</property>
      </infobox>
   a text.
   </article>

See also


Categories: syntax

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.