跳至内容
白说
用户工具
登录
站点工具
搜索
工具
显示页面
Copy this page
修订记录
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
fontsize_plugin
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== FontSize Plugin ====== ---- plugin ---- description: Allow different font sizes author : Jesús A. Álvarez email : zydeco@namedfork.net type : syntax lastupdate : 2008-04-25 compatible : !Hogfather depends : conflicts : similar : tags : !broken, style, typography downloadurl: https://trello.com/1/cards/5b05a6ddb3dd6d590cd2dac7/attachments/5b05a6f0f970d45e5a5e2f72/download/fontsize.zip bugtracker : sourcerepo : donationurl: screenshot_img: ---- ===== Description ===== This plugin allows to write text in different sizes. ===== Syntax ===== Enclose the text in ''%%##%%'' tags to make it larger, and in ''%%,,%%'' to make it smaller. Add more ''#'' or '','' to increase or decrease the size in steps of 20%. ##this text is shown at 120% of the base size##, ###this is 140%### ####and this is 160%#### ,,this is smaller, at 80%,, and ,,,this is at 60%,,, ,,if I were to put a comma after a small text,,%%,%% I would need to enclose the comma in double percent signs ===== Source Code ===== Create a directory ''fontsize'' in ''/wiki/lib/plugins'' and save the code in a ''syntax.php'' file there. <code php syntax.php> <?php /** * Font Size Plugin: Allow different font sizes * * @license GPL 3 (http://www.gnu.org/licenses/gpl.html) * @author Jesús A. Álvarez <zydeco [at] namedfork [dot] net> */ class syntax_plugin_fontsize extends DokuWiki_Syntax_Plugin { function getInfo(){ return array( 'author' => 'Jesús A. Álvarez', 'email' => 'zydeco@namedfork.net', 'date' => '2008-04-25', 'name' => 'Font Size Plugin', 'desc' => 'Allow different font sizes.', 'url' => 'https://www.dokuwiki.org/plugin:fontsize', ); } function getType() { return('formatting'); } function getSort() { return 131; } function connectTo($mode) { $this->Lexer->addEntryPattern('##+(?=.*##+)',$mode,'plugin_fontsize'); $this->Lexer->addEntryPattern(',,+(?=.*,,+)',$mode,'plugin_fontsize'); } function postConnect() { $this->Lexer->addExitPattern('##+', 'plugin_fontsize'); $this->Lexer->addExitPattern(',,+', 'plugin_fontsize'); } function handle($match, $state, $pos, Doku_Handler $handler){ switch ($state) { case DOKU_LEXER_ENTER: if ($match{1} == '#') $size = (strlen($match)*20)+80 .'%'; else $size = 120-(strlen($match)*20) . '%'; return array($state, $size); case DOKU_LEXER_UNMATCHED: return array($state, $match); case DOKU_LEXER_EXIT: return array($state, ''); } return array(); } function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { list($state, $match) = $data; switch ($state) { case DOKU_LEXER_ENTER: $renderer->doc .= "<span style='font-size:$match;'>"; break; case DOKU_LEXER_UNMATCHED: $renderer->doc .= $renderer->_xmlEntities($match); break; case DOKU_LEXER_EXIT: $renderer->doc .= '</span>'; break; } return true; } return false; } } //Setup VIM: ex: et ts=4 enc=utf-8 : </code> ===== Discussion ===== Hi. Is is me or I can't get the system to recognize a link if it's put in smalltext? <code> ,, [[http://www.giocoestudio.it|programma]] ,, </code> this does not work... Tnx! ------- Work neither with H1, H2, H3 etc titles :( <code> ====== ##########big title for blind ppl########## ====== </code> Too bad. ------- Hi! You can solve this problem by patching the plugin with the function below: <code php> function getAllowedTypes() { return array('formatting', 'substition'); } </code> See also [[devel:syntax_plugins#synopsis]] for ''getAllowedTypes()''. ------- Hi! I have fontsize2 up and working, but fontsize does not. Have the syntax.php in the plugins folder, but the plugin does not work and does not appear in plugins in the config. Why :-? ------- I can not seem to get this to work for a page of text. All the line breaks stop working. Maybe because I'm using the xbr plugin? ------- Patching plugin works, thank you! -------- I wanted to link to a larger text, like <code> [[fs|####test####]] </code> but the number-signs are not resolved. I tried adding the patch above in syntax.php, but it did not work. Outside of the links, it works fine. Any idea? ---- 24/06/2020 15:42:46 Does not seems to work with HogFather 5.3 ---- 25/09/2020 08:05 I fixed this plugin for usage with HogFather, shown below: <file php fontsize-hogfather.patch>--- syntax-before.php 2020-09-25 08:09:45.294662375 -0500 +++ syntax.php 2020-09-25 08:08:40.477774548 -0500 @@ -36,7 +36,7 @@ $this->Lexer->addExitPattern(',,+', 'plugin_fontsize'); } - function handle($match, $state, $pos, &$handler){ + function handle($match, $state, $pos, Doku_Handler $handler){ switch ($state) { case DOKU_LEXER_ENTER: if ($match{1} == '#') @@ -50,7 +50,7 @@ return array(); } - function render($mode, &$renderer, $data) { + function render($mode, Doku_Renderer $renderer, $data) { if ($mode == 'xhtml') { list($state, $match) = $data; switch ($state) { </file> Apply using the following command: \\ ''patch syntax.php < fontsize-hogfather.patch'' ---- 2024-12-23 This plugin does not work with "Kaos" and will corrupt your conf\local.php file. https://www.dokuwiki.org/plugin:fontsize 2024年12月27日14:46:14
fontsize_plugin.txt
· 最后更改: 2024/12/27 14:46 由
jackboo
页面工具
显示页面
修订记录
Copy this page
回到顶部