. . . . . . . . Wrap Plugin https://www.dokuwiki.org/plugin:wrap plugin Universal plugin which combines the functionality of many other plugins. Wrap wiki text inside containers (divs or spans) and give them a class (choose from a variety of preset classes), a width and/or a language with its associated text direction. Similar to bootnote, bootswrapper, box, button, class, clearfloat, color, columns, comment, commentsrc, div_span_shorthand, divalign, divalign2, emphasis, fontcolor, fontfamily, fontsize, fontsize2, hide, highlight, htmlcomment, important_paragraf, importanttext, lang, layout, ltr, noprint, note, outdent, pagebreak, side_note, spoiler, styler, tab, tablewidth, tip, typography, wpre Tagged with anchor, annotations, bookmark, boxes, columns, formatting, hide, highlight, icons, language, printing, style, tabs, typography By Anika Henke abc ipa blockquote loadskin purplenumbers wikipediasnippet ach unformattedcode fontface starter and 5 more One plugin to rule them all This plugin gives you the ability to wrap wiki text inside containers (divs or spans) and give them a certain class (with loads of useful preset classes) a width a language with its associated text direction It potentially replaces a lot of other plugins and is IMHO the better alternative for many. It fully replaces: class, clearfloat, div_span_shorthand, divalign2, divalign, emphasis, hide, important_paragraf, importanttext, lang, ltr, noprint, pagebreak, side_note, tip, wpre It partly replaces: box, button, color, columns, fontcolor, fontfamily, fontsize2, fontsize, highlight, layout, note, styler, tab, tablewidth, typography Installation Search and install the plugin using the Extension Manager. Refer to Plugins on how to install plugins manually. Syntax Basic Syntax: “big” content or “big” content or “big” content An uppercase (or alternatively <block> or ) creates a div and should be used for “big” containers, surrounding paragraphs, lists, tables, etc. “small” content or “small” content or “small” content A lowercase (or alternatively <inline> or <span>) creates a span and should be used for “small” containers, inside paragraphs, lists, tables, etc. Since version 2013-06-13 there is also a shorthand syntax (for wraps without content): or or
and
or or
s tabs if wrapped around a list of links, will show those as tabs hide hides the text per CSS (the text will still appear in the source code, in non-modern browsers and is searchable) noprint displays text on the screen, but not in print, similar to noprint onlyprint displays text only in print, but not on the screen pagebreak forces a new page in printouts (not visible on the screen), similar to pagebreak nopagebreak tries to avoid a pagebreak in printouts (not visible on the screen) spoiler shows white text on a white background, only to be revealed by highlighting it; similar to hide button when wrapped around a link, styles it like a button tablewidth sets widths of tables inside to whichever width the wrap gets, partly replaces tablewidth indent indents the text, could be used instead of tab outdent “outdents” the text, could partly be used instead of outdent prewrap wraps text inside pre-formatted code blocks, similar to wpre Known restrictions WRAPs export to ODT format but not everything works 100%
Round corners only work in modern browsers (no IE8 and below).
Multiple columns only work in modern browsers (no IE9 and below).
Width classes are experimental and only work in modern browsers (no IE8 and below).
Normal DokuWiki Headlines used to not work and a work-around was added. Now that headlines do work, the work-around is not needed anymore but kept for backwards-compatibility. It was deprecated in version 2018-04-22 and disabled by default. They can be enabled by using the emulatedHeadlines config option. The following syntax would then produce two different kinds of emulated headlines inside any wrap:
//**__Big Underlined Headline__**// (They will look a bit different in safety notes.)
//**Small Headline**//
You might need to adjust a few of the classes to your template's needs, especially hi, lo and em. If you have a dark or otherwise heavily coloured theme, please use the darkTpl config option. The classes are easily adjustable and extensible. Any wishes are welcome. Widths You can set any valid widths on any uppercase container: %, px, em, rem, ex, ch, vw, vh, pt, pc, cm, mm, in. Just set the width before or after or with the classes, e.g. … All except percentages will be reduced to have the maximum width available on smaller screens. You can also use the width keywords half, third, twothirds and quarter. To work correctly they need another wrap around them. E.g. <WRAP half column>...</WRAP> <WRAP half column>...</WRAP> will result in two columns next to each other, which will wrap underneath each other on smaller screens and mobile devices. Languages and Text Directions You can change the language and the direction of a container by simply adding a colon followed by the language code, like this: This text is explicitly marked as English. The text direction (rtl, right to left or ltr, left to right) will get inserted automatically and is solely dependent on the language. The list of currently supported languages is taken from: http://meta.wikimedia.org/wiki/Template:List_of_language_names_ordered_by_code If you like to mark a text with a different text direction than the default one, you should use divs, i.e. uppercase s. Otherwise the text alignment won't change as well. This makes it a better replacement of ltr (and lang). Demo You can see a demo of the plugin on demo.selfthinker.org. “Examples” (demo) in Russian (for v2011-05-15). Source. Configuration options Option Description Default value noPrefix Which (comma separated) class names should be excluded from being prefixed with “wrap_” (* and ? wildcards allowed) tabs, group restrictedClasses Restrict usage of plugin to these (comma separated) classes (* and ? wildcards allowed) (empty) restrictionType Restriction type, specifies if classes above shall be included or excluded 0 syntaxDiv Which syntax should be used in the toolbar picker for block wraps? WRAP (other choices: div, block) syntaxSpan Which syntax should be used in the toolbar picker for inline wraps? wrap (other choices: span, inline) darkTpl Optimise colours for dark templates? 0 emulatedHeadlines Use emulated headings? (deprecated) 0 ODT Support
Since version 2015-06-13 the Wrap plugin supports exporting most of its functionality/styling to ODT when using at least version 2015-06-29 of the ODT Plugin. By default, Wrap syntax will be exported to ODT using 'print' CSS styles. This means the exported Wrap elements will look the same when printing a wiki page. If you want to have the ODT exported Wrap elements look like displayed in the browser (i.e. with 'screen' CSS styles), then use the following ODT plugin configuration settings: add wrap to the 'usestyles' config setting set the 'media_sel' setting to 'screen' If you prefer a user defined CSS style for the Wrap ODT export, then simply place a file 'odt.css' into the Wrap plugin folder with your own CSS code (and set config setting 'media_sel' to 'print'). Here is what is currently not supported: columns: left/right/center/column is partly supported; they are positioned correctly, but content is not floating around them widths are not supported except % and half/third/quarter boxes and notes: hardly any formatting inside them is supported, therefore emulated headings also don't work tabs will just show a list of links noprint nopagebreak onlyprint only works on boxes languages are set correctly but do not seem to affect text alignment shorthand syntax Not supported because not relevant in ODT: clear, prewrap Toolbar picker The wrap picker in the editing toolbar adds the most common wrap syntaxes. “columns” creates a set of half columns “simple centered box” creates a standard box (60% wide, centered) “info, tip, important, alert, help, download, todo box” creates specifically themed boxes (also 60% wide, centered) “clear floats” creates a <WRAP clear/> “especially emphasised, highlighted, less significant” creates the respective marks Extend with custom styles If you like to add your own classes and styles to the plugin, you can simply add the styles for your class preceded by “wrap_” to your user styles. Please note, any classes need to be lower case. E.g. if you need a , you edit (or create if it doesn't exist) your conf/userstyle.css and add your .wrap_myclass{} with its style definitions to it. (If necessary, edit conf/userprint.css1) for the print view, conf/userrtl.css2) for RTL languages and conf/userall.css3) for all styles as well.) User permissions for every file used must be similar to original DokuWiki files. Since version 2010-03-14 you have the possibility to exclude certain class names from being prefixed with “wrap_”. Just add a comma separated list of class names into the config option “noPrefix” in the configuration manager. Examples in style.css .dokuwiki div.wrap_note{ /* added */ background-color: #eee; color: #000; padding: .5em .5em .5em .5em; margin-bottom: 1em; overflow: hidden; } call in DW-page: … Here are some useful Wrap extensions created by users of this plugin. Add former typography classes The old typography classes were removed in version 2011-05-15. If you need something similar, use the Block plugin instead. Or you can use your own and copy them to your own user styles (see above). How to use the helper From version 2011-05-15 on the plugin includes a helper plugin which you can use to add classes, width and lang/dir to any other plugin. Example how to get just one kind of attribute
get lang from wrap helper plugin
$lang = '; buildAttributes() expects the same string as above (“classes #id width :language”) and an optional string for additional classes, in case your plugin has CSS classes of its own which it needs to reuse. It returns a string with all the attributes prepared for HTML. Development Done Recent commits to Wrap Plugin (RSS feed) Merge pull request #184 from dokuwiki-translate/lang_update_925_15310… (2018-11-14 23:08) translation update (2018-07-08 09:45) Merge pull request #183 from dokuwiki-translate/lang_update_844_15264… (2018-05-29 12:15) translation update (2018-05-16 15:35) Merge pull request #179 from dokuwiki-translate/lang_update_812_15244… (2018-04-27 00:03) translation update (2018-04-23 10:15) Merge pull request #178 from selfthinker/update-travis (2018-04-22 19:19) Update travis script due to new DokuWiki release (2018-04-22 18:55) Localization You can help me with translations and update the language files. There are two files to translate: lang/en/lang.php is for the explaining titles on the picker images. lang/en/settings.php is for the configuration options. Credits The code reuses parts of the box plugin by Christopher Smith. The ODT support was implemented by LarsDW223. The images for the notes are taken from the Human-O2 icon set. The toolbar uses images from the Silk Icon Set and the Silk Companion Icon Set. Thanks to all contributors. See also Useful extensions for the Wrap Plugin Sub pages to Wrap Plugin Useful extensions for the Wrap Plugin These are some extensions to the Wrap Plugin created by users. Add these to your template’s screen.css. Padding Add padding to the top, bottom or both. — zioth 2015-10-14 .plugin_wrap .wrap_bottom_pad { padding-bottom: 40px; } .plugin_wrap .wrap_top_pad { padding-top: 40px; } .plugin_wrap .wrap_topbottom_pad { padding-bottom: 40px; padding-top: 40px; } Just add some vertical space to the page. — zioth 2015-10-14 .plugin_wrap .wrap_vert_space { height: 15px; } Usage: HTML5 columns Create multi-column layout for text. These look better than the built-in column support, but do not work in Internet Explorer 8 and below. — zioth 2015-10-14 .plugin_wrap.wrap_columns2 { clear: both; -webkit-column-count: 2; -moz-column-count: 2; column-count: 2; } .plugin_wrap.wrap_columns3 { clear: both; -webkit-column-count: 3; -moz-column-count: 3; column-count: 3; } .plugin_wrap.wrap_columns4 { clear: both; -webkit-column-count: 4; -moz-column-count: 4; column-count: 4; } .plugin_wrap.wrap_columns5 { clear: both; -webkit-column-count: 5; -moz-column-count: 5; column-count: 5; } Full width images Dokuwiki allows for fixed-width images, but what if you want a really large image to scale down to fill all available space? — zioth 2015-10-14 .plugin_wrap.wrap_full_width_img img { max-width: 100%; } Usage: OR Evenly spaced boxes Create multiple wrap boxes of equal height, spaced evenly across the page. This is less error-prone and better looking than using x%, left/right, half or third or quarter. It won't work in IE 9 or lower. — zioth 2018-11-08 &.wrap_even_widths { display: flex; .plugin_wrap { flex: 1; &:not(:last-child) { margin-right: 12px; } } } Usage: <div box>Box1</div> <div box>Box2</div> <div box>Box3</div> Content Nice Boxes Examples I've found a nice (I think) way to use WRAP to make content boxes suitable to make announcements, some types of alerts, floating notes, etc. The general look is rather like content boxes on the Wikipedia main page. Because it's rather long, I didn't want to paste it all here. Please refer to http://deseng.ryerson.ca/dokuwiki/wiki:content_blocks_with_wrap for full description including examples and CSS needed for WRAP. 24 Nov 2015: User Zioth spotted insufficient permissions on my page. Fixed. — FilSalustri 2015-11-24 02:12 userstyle.css /* CONTAINER CLASS FOR ANNOUNCEMENTS & DEFAULT COLOURS*/
.dokuwiki div.wrap_announcement {
padding: 10px 10px 0px;
margin-bottom: 1.5em;
overflow: hidden;
background-color: #eeeeee;
border: 2px solid #bbbbbb;
}
/* DEFAULT COLOURS & MODS FOR HEADINGS IN ANNOUNCEMENTS. */
.dokuwiki div.wrap_announcement h2,
.dokuwiki div.wrap_announcement h3,
.dokuwiki div.wrap_announcement h4,
.dokuwiki div.wrap_announcement h5,
.dokuwiki div.wrap_announcement h6 {
padding: 5px 10px 0px;
margin: -10px -10px 10px;
border: 0;
color: #000000;
background-color: #bbbbbb;
}
/* ANNOUNCEMENT COLORS */
.dokuwiki div.wrap_green {
background-color: #f6fff0;
border: 2px solid #DEF2CF;
}
.dokuwiki div.wrap_blue {
background-color: #f0f8ff;
border: 2px solid #D9E5FD;
}
.dokuwiki div.wrap_orange {
background-color: #fff9f6;
border: 2px solid #FEECBD;
}
.dokuwiki div.wrap_red {
background-color: #FFF5F5;
border: 2px solid #FED1CD;
}
.dokuwiki div.wrap_yellow {
background-color: #fffff0;
border: 2px solid #F8F8B4;
}
.dokuwiki div.wrap_purple {
background-color: #fff0ff;
border: 2px solid #FCD9F1;
}
.dokuwiki div.wrap_aqua {
background-color: #f0fffa;
border: 2px solid #CEE5EE;
}
/* COLOUR MODS FOR HEADINGS IN ANNOUNCEMENTS. */
.dokuwiki div.wrap_green h2,
.dokuwiki div.wrap_green h3,
.dokuwiki div.wrap_green h4,
.dokuwiki div.wrap_green h5,
.dokuwiki div.wrap_green h6
{ background-color: #DEF2CF; }
.dokuwiki div.wrap_blue h2,
.dokuwiki div.wrap_blue h3,
.dokuwiki div.wrap_blue h4,
.dokuwiki div.wrap_blue h5,
.dokuwiki div.wrap_blue h6
{ background-color: #D9E5FD; }
.dokuwiki div.wrap_orange h2,
.dokuwiki div.wrap_orange h3,
.dokuwiki div.wrap_orange h4,
.dokuwiki div.wrap_orange h5,
.dokuwiki div.wrap_orange h6
{ background-color: #FEECBD; }
.dokuwiki div.wrap_red h2,
.dokuwiki div.wrap_red h3,
.dokuwiki div.wrap_red h4,
.dokuwiki div.wrap_red h5,
.dokuwiki div.wrap_red h6
{ background-color: #FED1CD; }
.dokuwiki div.wrap_yellow h2,
.dokuwiki div.wrap_yellow h3,
.dokuwiki div.wrap_yellow h4,
.dokuwiki div.wrap_yellow h5,
.dokuwiki div.wrap_yellow h6
{ background-color: #F8F8B4; }
.dokuwiki div.wrap_purple h2,
.dokuwiki div.wrap_purple h3,
.dokuwiki div.wrap_purple h4,
.dokuwiki div.wrap_purple h5,
.dokuwiki div.wrap_purple h6
{ background-color: #FCD9F1; }
.dokuwiki div.wrap_aqua h2,
.dokuwiki div.wrap_aqua h3,
.dokuwiki div.wrap_aqua h4,
.dokuwiki div.wrap_aqua h5,
.dokuwiki div.wrap_aqua h6
{ background-color: #CEE5EE; }
— florious 2019-03-19 15:09 Change format of any ordered list https://forum.dokuwiki.org/thread/12782 1. 1.1 1.2 2. 2.1 2.2 3. 3.1 3.1.1 3.1.2
userstyle.css div.dokuwiki div.wrap_list-deep ol {
list-style-type: none;
}
div.dokuwiki div.wrap_list-deep > ol {
counter-reset: leva 0; /* set to one lower than intended value of first list item */
}
div.dokuwiki div.wrap_list-deep ol li div.li::before {
counter-increment: leva;
content: counter(leva) ". ";
color: inherit;
font-weight: bold;
}
/* ~~~~~~ */
div.dokuwiki div.wrap_list-deep ol ol {
list-style-type: none;
}
div.dokuwiki div.wrap_list-deep > ol ol {
counter-reset: levb 0; /* set to one lower than intended value of first list item */
}
div.dokuwiki div.wrap_list-deep ol li li div.li::before {
counter-increment: levb;
content: counter(leva) "." counter(levb) ". ";
color: inherit;
font-weight: bold;
}
/* ~~~~~~ */
div.dokuwiki div.wrap_list-deep ol ol ol {
list-style-type: none;
}
div.dokuwiki div.wrap_list-deep > ol ol ol {
counter-reset: levc 0; /* set to one lower than intended value of first list item */
}
div.dokuwiki div.wrap_list-deep ol ol ol div.li::before {
counter-increment: levc;
content: counter(leva) "." counter(levb) "." counter(levc) ". ";
color: inherit;
font-weight: bold;
}
Simpler boxes No icon, just colors. bloc simple bloc information bloc astuce bloc important bloc alerte bloc aide bloc téléchargement bloc à faire userstyle.css.snippet /*
* plugin wrap boxes (and plugin note compat mode of wrap)
*/
div.dokuwiki {
div.plugin_wrap {
&.wrap_center.wrap_round {
/* Inspired by hugo template seen on https://thomas-leister.de/en/mailserver-debian-stretch/ */
margin-left: 40px;
margin-right: 40px;
margin-top: 2rem;
margin-bottom: 2rem;
padding: 20px 25px;
border-radius: 3px;
text-align: left;
width: auto !important;
background-image: initial;
min-height: initial;
p:last-child {
margin: 0;
}
&.wrap_alert {
/* From hugo template seen on https://thomas-leister.de/en/mailserver-debian-stretch/ */
border-left: 10px solid #d9534f;
background: #fdf7f7;
color: #b52b27;
}
&.wrap_important {
/* From hugo template seen on https://thomas-leister.de/en/mailserver-debian-stretch/ */
border-left: 10px solid #fbaf43;
background: #fcf8f2;
color: #c97500;
}
&.wrap_download {
border-left: 10px solid #8dde4e;
background: #f4ffee;
color: #57aa16;
}
&.wrap_tip {
border-left: 10px solid #fff15a;
background: #fffded;
color: #b6a91a;
}
&.wrap_info {
border-left: 10px solid #4f8cdf;
background: #f5f7fa;
color: #195ab3;
}
&.wrap_help {
border-left: 10px solid #c489ef;
background: #f1eef4;
color: #7625b1;
}
&.wrap_todo {
border-left: 10px solid #4bd29c;
background: #f5f9f7;
color: #1aaf73;
}
}
}
}
— schplurtz 2019-08-21 14:54 Replace the Note Plugin If you want the wrap plugin to handle the syntax of the Note Plugin, then add this file in the syntax directory of the wrap plugin (lib/plugins/wrap/syntax/). When you're done, you can remove the note plugin. <note>…</note> will be handled by the wrap plugin. There is no need to rewrite your pages. syntax/divnote.php <?php
/**
* Alternate div syntax component for the wrap plugin
*
* Defines note plugin compatibility <note> ... </note> syntax
*
* @license GPL 2 (http://www.gnu.org/licenses/gpl.html)
* @author Schplurtz Le Déboulonné <schplurtz arob laposte dot net>
*/
require_once(dirname(__FILE__).'/div.php');
class syntax_plugin_wrap_divnote extends syntax_plugin_wrap_div {
protected $entry_pattern = '<note.*?>(?=.*?</note>)';
protected $exit_pattern = '</note>';
private $matches=array(
'/^<\/note>$/',
'/^<note\s*(?i:classi(?:c|que))?\s*>$/',
'/^<note\s+(?i:important(?:e?))\s*>$/',
'/^<note\s+(?i:tip|tuyaux|idée)\s*>$/',
'/^<note\s+(?i:warning|bloquante|critique)\s*>$/',
);
private $replacements=array(
'</div>',
'<div round center info 70%>',
'<div round center important 70%>',
'<div round center tip 70%>',
'<div round center alert 70%>',
);
function handle($match, $state, $pos, Doku_Handler $handler) {
if( $state === DOKU_LEXER_ENTER || $state === DOKU_LEXER_EXIT )
$match=preg_replace( $this->matches, $this->replacements, $match );
return parent::handle($match, $state, $pos, $handler);
}
}
// vim: ai:et:ts=4:sw=4:
Poems Nice display of poems — replace plaintext / poem — trailjeep 2019-08-24 line 1 line 2 line 3 span.wrap_poem { display: block; margin: 2em auto; padding: 1em 2em; width: max-content; max-width: 90%; white-space: pre-wrap; background-color: #333; color:#fff; border: unset; border-radius: 1em; text-align: center; } Bonus — if icons installed span.wrap_poem:before { font-family: fontawesome; font-size: 2em; content: "\f299"; float: left; } See also DokuWiki usecase: List of employees plugin/wrap/extensions.txt · Last modified: 2019-10-26 07:33 by nickel
|
| |