plugin:shy
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
plugin:shy [2007-01-18 13:32] – created; mw Matthias | plugin:shy [2018-06-05 23:45] (current) – [Installation] Klap-in | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Shy Syntax PlugIn ====== | ||
+ | ---- plugin ---- | ||
+ | description: | ||
+ | author | ||
+ | email : support@mwat.de | ||
+ | type : syntax | ||
+ | lastupdate : 2007-08-15 | ||
+ | compatible : 2005-07-13+ | ||
+ | depends | ||
+ | conflicts | ||
+ | similar | ||
+ | tags : html, hyphen, utf-8 | ||
+ | downloadurl: | ||
+ | ---- | ||
+ | |||
+ | " | ||
+ | It's a very handy feature in wordprocessors starting in the very early days of PC textprocessing((and made its way even into bloated monsters like M$-Office)) where it can be inserted into the text usually by shortkeys like '' | ||
+ | |||
+ | Using soft hyphens is a great way get a smoother word breaking and line wrap. | ||
+ | This is important especially (but not only) when using a justified layout/ | ||
+ | |||
+ | As far as (X)HTML is involved, the ''& | ||
+ | But, alas, not all browsers actually implement the standards((one notable example for ignoring soft hyphens is '' | ||
+ | Some browsers just get it plain wrong by treating soft hyphens like ordinary ones((older versions of '' | ||
+ | |||
+ | Personally I don't care much for browsers which do the wrong thing. | ||
+ | But, of course, your point of view may be different. | ||
+ | Anyway, this plugin offers the opportunity to use soft hyphens with you wiki pages. | ||
+ | |||
+ | ===== Usage ===== | ||
+ | |||
+ | To add a soft hyphen insert '' | ||
+ | For example: | ||
+ | Soft hyphens are a great way get smoo\-ther word brea\-kings. | ||
+ | |||
+ | This plugin will replace your '' | ||
+ | |||
+ | For demonstration purposes I’ve inserted quite a few soft hyphens in this document. If your browser supports enlarging the font size/ | ||
+ | |||
+ | Watch for the line endings. If your current browser got it right you should see somewhere((Because the actual location of such a change depends on many facts (such as screen width and resolution, | ||
+ | |||
+ | ===== Installation ===== | ||
+ | Search and install the plugin using the [[plugin: | ||
+ | |||
+ | * http:// | ||
+ | |||
+ | ===== Plugin Source ===== | ||
+ | |||
+ | Here comes the [[http:// | ||
+ | Since I'm working with different programming languages it's a great ease to have one tool that handles the docs for all of them.)) for those who'd like to scan it before actually installing it: | ||
+ | <code php> | ||
+ | <?php | ||
+ | if (! class_exists(' | ||
+ | if (! defined(' | ||
+ | if (! defined(' | ||
+ | define(' | ||
+ | } // if | ||
+ | define(' | ||
+ | } // if | ||
+ | // Include parent class: | ||
+ | require_once(DOKU_PLUGIN . ' | ||
+ | |||
+ | /** | ||
+ | * < | ||
+ | * a < | ||
+ | * | ||
+ | * <p> | ||
+ | * Usage:< | ||
+ | * < | ||
+ | * to insert a socalled "soft hyphen" | ||
+ | * </ | ||
+ | | ||
+ | | ||
+ | | ||
+ | * </ | ||
+ | * <div class=" | ||
+ | * This program is free software; you can redistribute it and/or modify | ||
+ | * it under the terms of the GNU General Public License as published by | ||
+ | * the Free Software Foundation; either | ||
+ | * <a href=" | ||
+ | * License, or (at your option) any later version.< | ||
+ | * This software is distributed in the hope that it will be useful, | ||
+ | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
+ | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. | ||
+ | * See the GNU General Public License for more details. | ||
+ | * </ | ||
+ | * @author <a href=" | ||
+ | * @version < | ||
+ | * @since created 05-Jan-2007 | ||
+ | */ | ||
+ | class syntax_plugin_shy extends DokuWiki_Syntax_Plugin { | ||
+ | |||
+ | /** | ||
+ | * @publicsection | ||
+ | */ | ||
+ | //@{ | ||
+ | |||
+ | /** | ||
+ | * Tell the parser whether the plugin accepts syntax mode | ||
+ | * < | ||
+ | * | ||
+ | * @param $aMode String The requested syntaxmode. | ||
+ | * @return Boolean < | ||
+ | * @public | ||
+ | * @see getAllowedTypes() | ||
+ | */ | ||
+ | function accepts($aMode) { | ||
+ | return FALSE; | ||
+ | } // accepts() | ||
+ | |||
+ | /** | ||
+ | * Connect lookup pattern to lexer. | ||
+ | * | ||
+ | * @param $aMode String The desired rendermode. | ||
+ | * @public | ||
+ | * @see render() | ||
+ | */ | ||
+ | function connectTo($aMode) { | ||
+ | // Only match markup inside words: | ||
+ | $this-> | ||
+ | $aMode, plugin_shy); | ||
+ | } // connectTo() | ||
+ | |||
+ | /** | ||
+ | * Get an associative array with plugin info. | ||
+ | * | ||
+ | * <p> | ||
+ | * The returned array holds the following fields: | ||
+ | * <dl> | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * < | ||
+ | * (eg. syntax description)</ | ||
+ | * </dl> | ||
+ | * @return Array Information about this plugin class. | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getInfo() { | ||
+ | return array( | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | ' | ||
+ | } // getInfo() | ||
+ | |||
+ | /** | ||
+ | * Where to sort in? | ||
+ | * | ||
+ | * @return Integer < | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getSort() { | ||
+ | return 176; | ||
+ | } // getSort() | ||
+ | |||
+ | /** | ||
+ | * Get the type of syntax this plugin defines. | ||
+ | * | ||
+ | * @return String < | ||
+ | * @public | ||
+ | * @static | ||
+ | */ | ||
+ | function getType() { | ||
+ | return ' | ||
+ | } // getType() | ||
+ | |||
+ | /** | ||
+ | * Handler to prepare matched data for the rendering process. | ||
+ | * | ||
+ | * <p> | ||
+ | * The < | ||
+ | * which triggered the call to this method. | ||
+ | * </p> | ||
+ | * @param $aMatch String The text matched by the patterns. | ||
+ | * @param $aState Integer The lexer state for the match. | ||
+ | * @param $aPos Integer The character position of the matched text. | ||
+ | * @param $aHandler Object Reference to the Doku_Handler object. | ||
+ | * @return Integer The given < | ||
+ | * @public | ||
+ | * @see render() | ||
+ | * @static | ||
+ | */ | ||
+ | function handle($aMatch, | ||
+ | return $aState; | ||
+ | } // handle() | ||
+ | |||
+ | /** | ||
+ | * Handle the actual output creation. | ||
+ | * | ||
+ | * <p> | ||
+ | * The method checks for the given < | ||
+ | * < | ||
+ | * contains a reference to the renderer object which is currently | ||
+ | * handling the rendering. The contents of < | ||
+ | * return value of the < | ||
+ | * </p> | ||
+ | * @param $aFormat String The output format to generate. | ||
+ | * @param $aRenderer Object A reference to the renderer object. | ||
+ | * @param $aData Integer The state value returned by < | ||
+ | * @return Boolean < | ||
+ | * @public | ||
+ | * @see handle() | ||
+ | */ | ||
+ | function render($aFormat, | ||
+ | if (DOKU_LEXER_SPECIAL == $aData) { | ||
+ | // No test of ' | ||
+ | // The raw UTF-8 character sequence is the same anyway. | ||
+ | $aRenderer-> | ||
+ | } // if | ||
+ | return TRUE; | ||
+ | } // render() | ||
+ | |||
+ | //@} | ||
+ | } // class syntax_plugin_shy | ||
+ | } // if | ||
+ | //Setup VIM: ex: et ts=2 enc=utf-8 : | ||
+ | ?> | ||
+ | </ | ||
+ | |||
+ | ==== Changes ==== | ||
+ | |||
+ | __2007-08-15__: | ||
+ | * added GPL link and fixed some doc problems; | ||
+ | |||
+ | __2007-01-06__: | ||
+ | + initial release; | ||
+ | |||
+ | // | ||
+ | |||
+ | ===== See also ===== | ||
+ | |||
+ | ==== Plugins by the same author ==== | ||
+ | |||
+ | * [[bomfix|BOMfix Plugin]] -- ignore Byte-Order-Mark characters in your pages | ||
+ | * [[code2|Code Syntax Plugin]] -- use syntax highlighting of code fragments in your pages | ||
+ | * [[deflist|Definition List Syntax Plugin]] -- use the only complete definition lists in your pages | ||
+ | * [[diff|Diff Syntax Plugin]] -- use highlighting of diff files (aka " | ||
+ | * [[hr|HR Syntax Plugin]] -- use horizontal rules in nested block elements of your pages | ||
+ | * [[lang|LANGuage Syntax Plugin]] -- markup different languages in your pages | ||
+ | * [[lists|Lists Syntax Plugin]] -- use the only complete un-/ordered lists in your pages | ||
+ | * [[nbsp|NBSP Syntax Plugin]] -- use Non-Breakable-Spaces in your pages | ||
+ | * [[nstoc|NsToC Syntax Plugin]] -- use automatically generated namespace indices | ||
+ | * [[shy|Shy Syntax Plugin]] -- use soft hyphens in your pages | ||
+ | * [[tip|Tip Syntax Plugin]] -- add hint areas to your pages | ||
+ | |||
+ | ===== Discussion ===== | ||
+ | Hints, comments, suggestions ... | ||
+ | |||
+ | \\ | ||
+ | |||
+ | Hi! I have a chemical name (((1-Methyl-2-(5-methyl-3-oxazolidinyl)**\-**ethoxy)**\-**methoxy)**\-**methoxy)**\-**methanol and I want to put soft hyphens in indicated places. Unfortunately it doesn' |