User:Robbiemuffin/Templates/Contents Block

From Wikibooks, open books for an open world
Jump to navigation Jump to search
Your contents would go here

Documentation[edit] [history] [purge]

{{User:Robbiemuffin/Templates/Content Block}} — Content Block


To separate substance from style in Book Contents. The intended use is (for example) for the book to handle loosely organized (or even unorganized) pages with category tags, where the category is transcluded through a list formatter into the contents, TOC, and index.

Technical Details[edit]


<div style="
  float: {{#if:{{{float|}}}|{{{float|}}}|right}}; 
  position: relative; 
  padding: 1em 1.25em 3em 1.25em; 
  border-radius: 2em; -webkit-border-radius: 2em; -moz-border-radius: 2em;">

    <div style="
      width: 100%; 
      margin-left: auto; margin-right: auto; 
      text-align: center; 
      font-variant: small-caps; 
      letter-spacing: 0.3em">

<div style="line-height: 1em"> </div>

    <div style="
      padding: 1em; 
      background-color: rgba(255,255,255,0.35); 
      {{#if:{{{maxwidth|}}}|max-width: {{{maxwidth|}}};|}} 
        |border-radius: 0.5em; -webkit-border-radius: 0.5em; -moz-border-radius: 0.5em;
            | <span style="font-family: monospace">
                Your contents would go here
{{#if:{{{clear|}}}|<div style="clear:both; font-size: 1px; line-height: 1px;"> </div>|}}


{{User:Robbiemuffin/Templates/Contents Block | title=my_title | contents=my_cat' | maxwidth=max_width' | float=left_or_right' | bgc=rgb_color' | withback=t_or_f'}}

title Title text for the Contents block. Defaults to "Contents"
contents Required value. The category page where you are writing out your contents, as displayed in the title text on that page.
maxwidth If set, passes a max-width CSS tag with the value set here to the div for the actual content.
float Float left or float right for content block. Defaults to right.
bgc Background color for content block. Defaults to #eef.
withback Lighter background for the actual content. Defaults to true. (Set to "f" to override.)
clear Postpend contents with a clear:both div.




First, you need to make a page that lists your contents. In this example we use: User:Robbiemuffin/Templates/Contents Block/doc/SampleContents, but normally you would have some form of transclusion and category automatically generate the list.


{{User:Robbiemuffin/Templates/Contents Block
|title='''''What's Inside'''''
|contents=User:Robbiemuffin/Templates/Contents Block/doc/SampleContents
|clear=yes please

note that the content tag is actually space- and case-sensitive!


What's Inside
Chapter 1 Overview of China
Chapter 2 Etymology
Chapter 3 History
Chapter 4 Timeline

See also[edit]

this page was brought to you by an Ajax hacker