Ajutor:Aspect
| Un contribuitor lucrează în acest moment la completarea acestei lucrări.
Din această cauză este posibil să existe deficiențe în formatare sau conținut. Vă rugăm să nu faceți modificări în timp ce este afișat acest anunț. În schimb, puteți face sugestii în pagina de discuții a articolului. Puteți șterge acest anunț și interveni în articol dacă vedeți că au trecut mai mult de 3 zile de la ultima modificare. |

Wikisource oferă un sistem numit Aspecte dinamice (din engleză dinamic layouts), care permite editorilor și cititorilor să aleagă modul în care citesc textele de pe platformă. Cititorii pot selecta aspectul care funcționează cel mai bine pentru ei, iar editorii pot recomanda un aspect „implicit” pentru fiecare lucrare în parte (pe care cititorii pot alege să îl folosească sau nu).
Exemplu: Fauna României/Mamifere. Apăsați pe linkul „Aspect x” din bara din stânga și urmăriți felul în care proprietățile textului se adaptează pentru fiecare aspect ales.
Pentru aceste texte, utilizatorii pot alege între diferite aspecte din meniul „Opțiuni de afișare”.
Cum să utilizați aspecte dinamice
[modifică]
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
[modifică]A specific dynamic layout can be set for a page with the Format:Tl 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:
{{default layout|Layout 2}}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 Default layouts on/off. When default layouts are "off", the user's previously-selected layout will be used (as if the page did not have a Format:Tl template at all).
Available layouts
[modifică]The following table shows the default layouts available for all users.
| Nume aspect | Descriere |
|---|---|
| Aspect 1 | The default layout as seen by a user with no options already set. The text spans across the page, sidenotes are enclosed in a bordered box. |
| Aspect 2 | The text is justified and enclosed in a centered fixed-width column (36em). Sidenotes are displayed in empty margins of the page, on the left and right. Similar to the style used on the French and Italian Wikisources. |
| Aspect 3 | Header is displayed on the right of the pages, the text content on the left, justified. Sidenotes are shown in the space under the header. Similar to the style at German Wikisource. |
| Aspect 4 | Equivalent to Layout 2 (central fixed-width column, justified) |
Font control
[modifică]Format:See also The display options also allow you to change between Format:Serif 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
[modifică]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 <pages/> tag, or transclusions using the Format:Tl template, inside a container div, or inside a table.
Things to remember:
- even if you set a Format:Tl, 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
[modifică]Dynamic layouts are defined in a javascript variable called self.WSLayouts.
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 dynlayout- and applied to the page's parent element.
Users can define their own layouts, by adding elements to self.WSLayouts in their user JavaScript and matching CSS to their user CSS.
Example
[modifică]- common.js
mw.hook( 'ws.layouts.register' ).add( function ( cfg ) {
cfg.layouts.push( {
name: 'My layout', // what you see in the menu
id: 'my_layout' // the name of the layout's class
} );
} );
- common.css
.dynlayout-my_layout {
color: red;
}
Templates
[modifică]Templates can be adapted to dynamic layouts. For example, sidenotes created with Format:Tl 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.
See also
[modifică]- Help:Fonts for more ways to customise fonts