Help:Layout

Wikisource provides a system called Dynamic Layouts, which allows editors and readers to choose how they read texts here. Readers can select the layout that works best for them, and editors can recommend "default" layouts on a work-by-work basis (which readers can choose to use, or not).

Example: The Solar System/Chapter 1. Check the "Layout x" link in the margin and see how the text properties are adapted to each layout.

For these texts, users can choose between different layouts in the "Display Options" menu.

How to use dynamic layouts
A reader can cycle through the available dynamic layouts by selecting the first link under "Display options" in the sidebar menu. This link will have the name of the current layout, by default this will be "Layout 1." Each click will cycle to the next layout in sequence; when the final layout is reached, layout 1 will be the next option. This setting will persist across page loads: you do not need to change it again for each page you visit.

Default layouts
A specific dynamic layout can be set for a page with the default layout template. When a page is opened, it will open on the specified layout instead of the user's current default layout (which is Layout 1, unless they have changed it). The reader can still cycle through other layouts with the "Display options" menu.


 * For example:  will set the default layout for a page to Layout 2.

There is no need set a default for Layout 1 as this is already the default layout for the entire project.

Readers can turn off the use of default layouts with the second link in the menu, labelled. When default layouts are "off", the user's previously-selected layout will be used (as if the page did not have a default layout template at all).

Available layouts
 The following table shows the default layouts available for all users. 

Font control
The display options also allow you to change between and sans-serif fonts. This option will apply to the entire "main content" of the page.

If you are using the accessible fonts provided by the ULS font system (e.g. OpenDyslexic or Comic Neue), using dynamic serif fonts will override that setting. Use the default sans-serif setting to allow ULS to set these fonts.

Good editing practices
Dynamic layouts assume a separation between form and content. Thus, your text should not make any assumption about the layout that will be used to render it. In particular, you should not wrap the tag, or transclusions using the Page template, inside a container div, or inside a table.

Things to remember:
 * even if you set a default layout, the user can opt for any other layout according to their needs and preferences
 * Dynamic Layouts apply only at Wikisource: the works should still be formatted correctly and legible when exported

How to write dynamic layouts
Dynamic layouts are defined in a javascript variable called.

This variable is a dictionary-like object, where each item is a list of CSS class names and a display name. When selected, that class will be prepended with  and applied to the page's parent element.

Users can define their own layouts, by adding elements to  in their user JavaScript and matching CSS to their user CSS.

Example

 * common.js


 * common.css

Templates
Templates can be adapted to dynamic layouts. For example, sidenotes created with Right sidenote are rendered in a way that depends on the layout.

If a template makes assumption about the layout, then it must be adapted to dynamic layouts.