plugin:fontfamily
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
plugin:fontfamily [2012-08-06 00:12] – 77.34.99.12 | plugin:fontfamily [2023-12-16 18:49] (current) – Aleksandr | ||
---|---|---|---|
Line 1: | Line 1: | ||
- | ====== | + | ====== |
---- plugin ---- | ---- plugin ---- | ||
Line 6: | Line 6: | ||
email : thorsten.stratmann@web.de | email : thorsten.stratmann@web.de | ||
type : syntax | type : syntax | ||
- | lastupdate : 2012-08-03 | + | lastupdate : 2019-03-19 |
- | compatible : Anteater, Rincewind | + | compatible : Anteater, Rincewind, Angua, Adora Belle, Weatherwax, Binky, Ponder Stibbons, Greebo |
depends | depends | ||
conflicts | conflicts | ||
Line 13: | Line 13: | ||
tags : typography | tags : typography | ||
- | downloadurl: | + | downloadurl: |
+ | bugtracker : # https:// | ||
+ | sourcerepo : # https:// | ||
---- | ---- | ||
- | |||
- | |||
- | < | ||
- | Diese Plugin wird nicht weiterentwickelt !</ | ||
- | |||
===== Download and Installation ===== | ===== Download and Installation ===== | ||
- | Download | + | Search |
- | * <del>[[http://www.tstratmann.de/ftp/ | + | * ver. 2019: [[https://trello.com/ |
- | + | * ver. 2012 (0.3): [[https://trello.com/1/cards/604de5942d22aa21c6c1ac36/ | |
- | __**I made workable analogue of [[plugin:fontcolor]] and put it here [[http://comicslate.org/_media/wiki/fontfamily.tgz]]. MD5 sum d5cfa70394c9fb1a23088fa849cee8a8**__. __Fixed toolbar icon__ | + | |
===== Description ===== | ===== Description ===== | ||
- | Change | + | Select |
- | To change the fontfamily , mark the text that you would like to change. | + | The result is: |
- | Then click on the button fontfamily and choose one of the predefined styles. | + | |
- | The result is: <ff fontfamily> | + | |
+ | Code based on the [[plugin: | ||
- | ===== Code ===== | + | ===== Changelog |
- | code based on the [[plugin: | + | |
+ | * Version 2019-03-19: Fixed image paths, cropped images, added 19 translations and CSS width fixer; < | ||
+ | * Version 0.3: Fixed icon, reworked with fontsize2 example | ||
+ | * Version 0.1: Created | ||
- | ==== syntax.php==== | + | ===== Bugs ===== |
- | + | ||
- | Put this code into '' | + | |
- | + | ||
- | + | ||
- | <code php> | + | |
- | <?php | + | |
- | <?php | + | |
- | /** | + | |
- | * fontfamily Plugin: control the font-family of your text | + | |
- | * | + | |
- | * @license | + | |
- | * @author | + | |
- | * @link http:// | + | |
- | * @version | + | |
- | */ | + | |
- | + | ||
- | if(!defined(' | + | |
- | if(!defined(' | + | |
- | require_once(DOKU_PLUGIN.' | + | |
- | + | ||
- | /** | + | |
- | * All DokuWiki plugins to extend the parser/ | + | |
- | * need to inherit from this class | + | |
- | */ | + | |
- | class syntax_plugin_fontfamily extends DokuWiki_Syntax_Plugin { | + | |
- | + | ||
- | function getInfo(){ | + | |
- | return array( | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | ' | + | |
- | | + | |
- | ' | + | |
- | ); | + | |
- | } | + | |
- | + | ||
- | // What kind of syntax are we? | + | |
- | function getType(){ return ' | + | |
- | + | ||
- | // What kind of syntax do we allow (optional) | + | |
- | function getAllowedTypes() { | + | |
- | return array(' | + | |
- | } | + | |
- | + | ||
- | // What about paragraphs? (optional) | + | |
- | | + | |
- | + | ||
- | // Where to sort in? | + | |
- | function getSort(){ return 92; } | + | |
- | + | ||
- | + | ||
- | // Connect pattern to lexer | + | |
- | function connectTo($mode) { | + | |
- | $this-> | + | |
- | } | + | |
- | function postConnect() { | + | |
- | $this-> | + | |
- | } | + | |
- | + | ||
- | + | ||
- | // Handle the match | + | |
- | function handle($match, | + | |
- | { | + | |
- | switch ($state) | + | |
- | { | + | |
- | case DOKU_LEXER_ENTER : | + | |
- | preg_match("/ | + | |
- | if ( $this-> | + | |
- | break; | + | |
- | case DOKU_LEXER_MATCHED : | + | |
- | break; | + | |
- | case DOKU_LEXER_UNMATCHED : | + | |
- | return array($state, | + | |
- | break; | + | |
- | case DOKU_LEXER_EXIT : | + | |
- | break; | + | |
- | case DOKU_LEXER_SPECIAL : | + | |
- | break; | + | |
- | } | + | |
- | return array($state, | + | |
- | } | + | |
- | + | ||
- | // Create output | + | |
- | function render($mode, | + | |
- | if($mode == ' | + | |
- | list($state, | + | |
- | switch ($state) { | + | |
- | case DOKU_LEXER_ENTER : | + | |
- | $renderer-> | + | |
- | break; | + | |
- | case DOKU_LEXER_MATCHED : | + | |
- | break; | + | |
- | case DOKU_LEXER_UNMATCHED : | + | |
- | $renderer-> | + | |
- | break; | + | |
- | case DOKU_LEXER_EXIT : | + | |
- | $renderer-> | + | |
- | break; | + | |
- | case DOKU_LEXER_SPECIAL : | + | |
- | break; | + | |
- | } | + | |
- | return true; | + | |
- | } | + | |
- | return false; | + | |
- | } | + | |
- | function _isValid($c) { | + | |
- | + | ||
- | $c = trim($c); | + | |
- | + | ||
- | $pattern = "/ | + | |
- | + | ||
- | // if (preg_match($pattern, | + | |
- | return true; | + | |
- | } | + | |
- | } | + | |
- | </ | + | |
- | + | ||
- | ==== script.js==== | + | |
- | + | ||
- | Put this code into '' | + | |
- | + | ||
- | <code javascript> | + | |
- | /* JavaScript function to create fontfamily toolbar in DokuWiki */ | + | |
- | /* see http:// | + | |
- | + | ||
- | var plugin_fontfamily = { | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | " | + | |
- | }; | + | |
- | + | ||
- | if (isUndefined(user_fontfamily)) { | + | |
- | var user_fontfamily = { }; | + | |
- | } | + | |
- | + | ||
- | function plugin_fontfamily_make_fontfamily_button(name, | + | |
- | + | ||
- | var b_id = name; // picker id that we're creating | + | |
- | var b_ico = document.createElement(' | + | |
- | b_ico.src = DOKU_BASE + ' | + | |
- | var btn = document.createElement(' | + | |
- | + | ||
- | btn.className = ' | + | |
- | btn.value = value; | + | |
- | btn.title = name; | + | |
- | btn.style.height = ' | + | |
- | btn.style.padding = ' | + | |
- | btn.name = value; | + | |
- | btn.appendChild(b_ico); | + | |
- | + | ||
- | var open = "< | + | |
- | var close ="< | + | |
- | var sample = name + " Fontfamily"; | + | |
- | + | ||
- | btn.onclick = function(){ | + | |
- | insertTags(' | + | |
- | return false; }; | + | |
- | + | ||
- | return(btn); | + | |
- | + | ||
- | } | + | |
- | + | ||
- | function plugin_fontfamily_toolbar_picker() { | + | |
- | + | ||
- | // Check that we are editing the page - is there a better way to do this? | + | |
- | var edbtn = document.getElementById(' | + | |
- | if (!edbtn) return; | + | |
- | + | ||
- | var toolbar = document.getElementById(' | + | |
- | if (!toolbar) return; | + | |
- | + | ||
- | // Create the picker button | + | |
- | var p_id = ' | + | |
- | var p_ico = document.createElement(' | + | |
- | p_ico.src = DOKU_BASE + ' | + | |
- | var p_btn = document.createElement(' | + | |
- | p_btn.className = ' | + | |
- | p_btn.title = ' | + | |
- | p_btn.appendChild(p_ico); | + | |
- | p_btn.onclick = function() { | + | |
- | showPicker(p_id, | + | |
- | + | ||
- | // Create the picker < | + | |
- | var picker = document.createElement(' | + | |
- | picker.className = ' | + | |
- | picker.id = p_id; | + | |
- | picker.style.position = ' | + | |
- | picker.style.display = ' | + | |
- | + | ||
- | /// Add a button to the picker <div> for each of the colors | + | |
- | for( var ff in plugin_fontfamily ) { | + | |
- | if (!isFunction(plugin_fontfamily[ff])) { | + | |
- | var btn = plugin_fontfamily_make_fontfamily_button(ff, | + | |
- | plugin_fontfamily[ff]); | + | |
- | picker.appendChild(btn); | + | |
- | } | + | |
- | } | + | |
- | + | ||
- | + | ||
- | + | ||
- | var body = document.getElementsByTagName(' | + | |
- | body.appendChild(picker); | + | |
- | toolbar.appendChild(p_btn); | + | |
- | } | + | |
- | + | ||
- | addInitEvent(plugin_fontfamily_toolbar_picker); | + | |
- | + | ||
- | //Setup VIM: ex: et ts=2 sw=2 enc=utf-8 : | + | |
- | + | ||
- | </ | + | |
- | + | ||
- | ===== Images ===== | + | |
- | + | ||
- | Additionally you need the images, displayed by clicking the fontfamily button. | + | |
- | Please obtain this images from the installation packet. | + | |
- | + | ||
- | ===== Changelog ===== | + | |
- | + | ||
- | * Version 0.1: Created | + | |
- | ===== Question ===== | + | * Click on icon make automatic saving comment in Discussion plugin without adding fontfamily syntax |
+ | * Don't use toolbar in Discussion... | ||
- | < | ||
- | This happens in Release 2009-12-25c “Lemming” of DokuWiki.\\ | ||
- | Any ideas? | ||
- | Fixed. |
plugin/fontfamily.1344204767.txt.gz · Last modified: 2012-08-06 00:12 by 77.34.99.12