Module:BookCSS
Jump to navigation
Jump to search
This module has been deprecated. Please see Help:Page styles instead. |
This module depends on the following other modules: |
Usage
[edit]This template includes mw:TemplateStyles CSS that applies to a specific work (or group of works). This allows the use of more semantically-correct markup rather than purely stylistic markup[1].
- 1 the stylesheet to use. If this is not given, a stylesheet related to the Index name is used.
- For example, the stylesheet for Index:Sandbox.djvu is at Template:BookCSS/Sandbox.djvu.css.
- This parameter is always needed in mainspace.
In Page: namespace
[edit]Place {{BookCSS}} in the header.
If you have a CSS that is not specific to the Index name (for example, a common CSS shared by a series), use {{BookCSS|Title of CSS}}, which will use Template:BookCSS/Title of CSS.css
.
In main namespace
[edit]For the Main namespace, place {{BookCSS}} just before the transclusions:
{{BookCSS|Sandbox.djvu}} <pages index="Sandbox.djvu" from=1 to=2 />
Index of styles
[edit]Notes
[edit]When phab:T226275 is complete, it may be possible to deprecate this template and use Index page parameters instead.- Wikisource:Scriptorium/Archives/2021-03#New toys in 1.36.0-37 - work-specific CSS and fixed DjVu paragraphs
- A remaining advantage of {{BookCSS}} is that as a removable template, it can be applied selectively to certain pages and chapters, rather than to an entire book.
- Wikisource:Scriptorium/Archives/2021-03#New toys in 1.36.0-37 - work-specific CSS and fixed DjVu paragraphs
- ↑ For example, the use of
=== Heading ===
rather than{{center|{{x-larger|'''Heading'''}}}}
, or the ability to add styles to certain lists.
local export = {}
function export.bookCss(frame)
local bookFileName = frame:getParent().args[1]
if not bookFileName then
bookFileName = string.gsub(mw.title.getCurrentTitle().baseText, '/.+', '')
end
local bookCssName = 'Template:BookCSS/' .. bookFileName .. '.css'
local bookCss = mw.title.new(bookCssName).exists and frame:extensionTag{
name = "templatestyles", args = { src = bookCssName }
} or ''
return bookCss
end
return export