Library of Formatting Examples talk:Main: Difference between revisions

From Test Wiki
Jump to navigation Jump to search
No edit summary
Line 1: Line 1:
This page describes how to build an LOFE example page using the templates.
This page explains how to build an LOFE example page using the templates.


==The Example Wrapper==
This new format has, so far, been applied to examples through Italics/06A


Each example is wrapped in a div tag with one of three classes. Most examples should be wrapped in:
==The Navigation Bar==


    <div class=lofe-examples>
Each example page starts with the navigation bar. (To be documented)
    </div>


This creates a flexible layout. For examples where you want to force a side by side layout regardless of screen width, instead use:
==The Start Template==


    <div class=lofe-examples-side-by-side>
The start template takes a number of required arguments, and uses them to display the example image and set up for the formatted text display. Call it like so:
    </div>
 
There is a third type with a floating image and no formatted text that hasn't yet been implemented.
 
==Building the example==
 
There are three templates used to build the example: one at the start of the example, one in the middle, and one at the end. The section below explains how each template works and what goes in between them.
 
===The Start Template===
 
The start template is the most complex and takes a number of arguments. Call it with:


  <nowiki>{{LOFE:Example start |argument=value...}}</nowiki>
  <nowiki>{{LOFE:Example start |argument=value...}}</nowiki>


The start template takes the following arguments:
The arguments are:


;image-filename:the wiki filename of the page image. Do not include "File:".
;image-filename:the wiki filename of the page image. Do not include "File:". Required.
;image-max:a class ID representing the maximum image size, in ems.
;iw:the width of the image file; see discussion below. Required.
;text-max:a class ID representing the maximum size in ems for the formatted text block
;tw:the width of the formatted text example; see discussion below. Required.
;text-min:a class ID representing the minimum size in ems for the formatted text block
;size:add "size=small" to use a smaller text size in the correctly formatted text; useful in side-by-side display. Optional; default is "normal" (100%).
;size:add "size=small" to use a smaller text size in the correctly formatted text; useful in side-by-side display. Default is "normal."


The permitted values for the -min and -max values are:
The image and text width may be set to any multiple of 5 between 20 and 70 (20, 25, 30, etc.) In setting the widths:


/* minimums with m */
* Set the text width so that the lines of text do not wrap when displayed in a standard monospace font.
* Set the image width so that the text in the image appears about the same size as the example text, or a little bit larger. This will normally mean a slightly lower setting for iw compared to tw.
div.lofe-m20 {min-width:20em;}
div.lofe-m30 {min-width:30em;}
div.lofe-m35 {min-width:35em;}
div.lofe-m40 {min-width:40em;}
div.lofe-m45 {min-width:45em;}
div.lofe-m50 {min-width:50em;}
div.lofe-m60 {min-width:60em;}
/* maximums with x */
div.lofe-x20 {max-width:20em;}
div.lofe-x30 {max-width:30em;}
div.lofe-x40 {max-width:40em;}
div.lofe-x50 {max-width:50em;}


By default, the text block will have a minimum width of 35em, and both elements will have a maximum width of 50em.
==The Marked-Up Text Example==


===Correctly Formatted Text===
After the start template comes the correctly formatted text example. Start the correctly formatted text, then make the following changes:
 
After the start template comes the correctly formatted text example. Start with just the correctly formatted text, then make the following changes:


* Add once space to the front of each line, including blank lines, in the source editor to create a single block of monospace text. You cannot use pre tags or any other method to achieve this; it will cause the required templates not to work.
* Add once space to the front of each line, including blank lines, in the source editor to create a single block of monospace text. You cannot use pre tags or any other method to achieve this; it will cause the required templates not to work.
Line 62: Line 33:
* Replace any HTML-style tags that appear in the text with the <nowiki> {{LOFE:Tag}}</nowiki> template. Remember to replace both opening and closing tags:
* Replace any HTML-style tags that appear in the text with the <nowiki> {{LOFE:Tag}}</nowiki> template. Remember to replace both opening and closing tags:


  {{LOFE:Tag|sc}}Tools and Appliances{{LOFE:Tag|/sc}}
<nowiki>{{LOFE:Tag|sc}}Tools and Appliances{{LOFE:Tag|/sc}}</nowiki>
 
looks like this:
 
{{LOFE:Tag|sc}}Tools and Appliances{{LOFE:Tag|/sc}}


* Where there is a short comment directly related to a specific line of text, use the <nowiki>{{LOFE:Comment}}</nowiki> template to add a comment.
* Where there is a short comment directly related to a specific line of text, use the <nowiki>{{LOFE:Comment}}</nowiki> template to add a comment.
<nowiki>{{LOFE:Comment|This line is Mixed-small-caps; mark it}}</nowiki>
looks like this:


  {{LOFE:Comment|This line is Mixed-small-caps; mark it}}
  {{LOFE:Comment|This line is Mixed-small-caps; mark it}}


* In the original LOFE, all discussion was placed in the example as comments. Here, comments should only be used where they relate to a specific line; general discussion of the topic should instead go in the discussion section, below.
* In the original LOFE, all discussion was placed in the example as comments. Here, comments should only be used where they relate to a specific line; general discussion of the topic should instead go in the discussion section, described below.


===The Middle Template===
===The Middle Template===
Line 74: Line 53:
After the formatted text, call the middle template with:
After the formatted text, call the middle template with:


    <nowiki>{{LOFE:Example middle}}</nowiki>
<nowiki>{{LOFE:Example middle}}</nowiki>


This template does not need any arguments or customisation. It will close the formatted text block and set up for the discussion section.
This template does not need any arguments or customisation. It will close the formatted text block and set up for the discussion section.
Line 80: Line 59:
===Discussion===
===Discussion===


At this point, there should be a brief discussion of the example. This starts with level 1 subhead summarizing the primary issue:
At this point, there should be a brief discussion of the example. This starts with a three-equals-sign heading summarizing the primary issue:


  <nowiki>=== Complete sentences ===</nowiki>
  <nowiki>=== Complete sentences ===</nowiki>
with lower-level subheadings as appropriate.


Some examples are used to demonstrate more than one type of formatting--for example, [[https://wiki.hapka.com/wiki/index.php?title=Library_of_Formatting_Examples:Small_Caps/16A|this example]] discusses both small caps and front matter. In that case:
Some examples are used to demonstrate more than one type of formatting--for example, [[https://wiki.hapka.com/wiki/index.php?title=Library_of_Formatting_Examples:Small_Caps/16A|this example]] discusses both small caps and front matter. In that case:


* List the issue related to the current section first (so under Front Matter the front matter section will come first);
* List the issue related to the current section first (so in the Front Matter example the front matter section will come first, but in the Small Caps example the section on small caps will come first);
* Use a new level 1 subheading for the separate topic; and
* Use a new three-equals-sign subheading for the separate topic; and
* Include links to the section and the specific discussion related to any other topic.
* Include links to the section and the specific discussion related to any other topic.



Revision as of 07:58, 3 November 2025

This page explains how to build an LOFE example page using the templates.

This new format has, so far, been applied to examples through Italics/06A

The Navigation Bar

Each example page starts with the navigation bar. (To be documented)

The Start Template

The start template takes a number of required arguments, and uses them to display the example image and set up for the formatted text display. Call it like so:

{{LOFE:Example start |argument=value...}}

The arguments are:

image-filename
the wiki filename of the page image. Do not include "File:". Required.
iw
the width of the image file; see discussion below. Required.
tw
the width of the formatted text example; see discussion below. Required.
size
add "size=small" to use a smaller text size in the correctly formatted text; useful in side-by-side display. Optional; default is "normal" (100%).

The image and text width may be set to any multiple of 5 between 20 and 70 (20, 25, 30, etc.) In setting the widths:

  • Set the text width so that the lines of text do not wrap when displayed in a standard monospace font.
  • Set the image width so that the text in the image appears about the same size as the example text, or a little bit larger. This will normally mean a slightly lower setting for iw compared to tw.

The Marked-Up Text Example

After the start template comes the correctly formatted text example. Start the correctly formatted text, then make the following changes:

  • Add once space to the front of each line, including blank lines, in the source editor to create a single block of monospace text. You cannot use pre tags or any other method to achieve this; it will cause the required templates not to work.
  • Where the number and spacing of blank lines is important, use the template {{LOFE:Blank}}.
  • Replace any HTML-style tags that appear in the text with the {{LOFE:Tag}} template. Remember to replace both opening and closing tags:
{{LOFE:Tag|sc}}Tools and Appliances{{LOFE:Tag|/sc}}

looks like this:

<sc>Tools and Appliances</sc>
  • Where there is a short comment directly related to a specific line of text, use the {{LOFE:Comment}} template to add a comment.
{{LOFE:Comment|This line is Mixed-small-caps; mark it}}

looks like this:

[** This line is Mixed-small-caps; mark it]
  • In the original LOFE, all discussion was placed in the example as comments. Here, comments should only be used where they relate to a specific line; general discussion of the topic should instead go in the discussion section, described below.

The Middle Template

After the formatted text, call the middle template with:

{{LOFE:Example middle}}

This template does not need any arguments or customisation. It will close the formatted text block and set up for the discussion section.

Discussion

At this point, there should be a brief discussion of the example. This starts with a three-equals-sign heading summarizing the primary issue:

=== Complete sentences ===

Some examples are used to demonstrate more than one type of formatting--for example, [example] discusses both small caps and front matter. In that case:

  • List the issue related to the current section first (so in the Front Matter example the front matter section will come first, but in the Small Caps example the section on small caps will come first);
  • Use a new three-equals-sign subheading for the separate topic; and
  • Include links to the section and the specific discussion related to any other topic.

The End Template

Like the middle template, the

{{LOFE:Example end}}

Don't forget to place the closing tag for your div at the end of the document, after the end template.

Example