DokuWiki

It's better when it's simple

User Tools

Site Tools


plugin:divalign2

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
plugin:divalign2 [2019-01-05 16:19] – old revision restored (2019-01-05 15:17) turnermmplugin:divalign2 [2023-10-30 22:36] (current) Klap-in
Line 4: Line 4:
 description: Align content left, right, center, or justify description: Align content left, right, center, or justify
 author     : Luis Machuca Bezzaza author     : Luis Machuca Bezzaza
-email      : luis.machuca [at] gulix.cl+email      : lambalicious [at] tuta [dot] io
 type       : syntax type       : syntax
-lastupdate : 2013-08-12 +lastupdate : 2020-06-11 
-compatible : "Rincewind", "Weatherwax""Hrun"+compatible : Weatherwax, Binky, Ponder Stibbons, Hrun, Detritus, Elenor of Tsort, Frusterick Manners, Greebo, Hogfather
 depends    :  depends    : 
-conflicts  : divalign+conflicts  : divalign, emphasis
 similar    : divalign, wrap similar    : divalign, wrap
-tags       : style, typography, odt, toolbar, !experimental+tags       : style, typography, odt, toolbar
  
-downloadurl: http://ryan.gulix.cl/dw/_media/desarrollo/dokuwiki/dw-plugin-divalign2-3.0b.zip +downloadurl: https://notabug.org/lmachucabezzaza/dw-plugin-divalign2/archive/master.zip 
-bugtracker : # eg. https://github.com/ryan.chappelle/dokuwiki-plugin-noiewarning/issues +bugtracker : https://notabug.org/lmachucabezzaza/dw-plugin-divalign2/issues 
-sourcerepo : https://github.com/lmachucab/dw-plugin-divalign2 +sourcerepo : https://notabug.org/lmachucabezzaza/dw-plugin-divalign2/ 
-donationurl: +donationurl: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=T44AQDXJQJTJQ&source=url 
 +demourl:  http://ryan.gulix.cl/tests.doku/current_/doku.php/divalign2
 ---- ----
  
Line 34: Line 35:
 Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually. Search and install the plugin using the [[plugin:extension|Extension Manager]]. Refer to [[:Plugins]] on how to install plugins manually.
  
-The link above will always point to the latest **stable** version. Should you need a previous version, check the plugin's webpage.+The link above will always point to the <del>latest stable</del> current **release candidate**. Should you need an older, archived version, or a download right out from ''master'', check the plugin's webpage which contains the required links: http://ryan.gulix.cl/dw/desarrollo/dokuwiki/ .
  
 +:!: **Note**: As of June 2020, plugin is in release candidate stages to check compatibility with Hogfather. If you can test the plugin and report back, feedback is welcome!
 +
 +:!: **Note**: Versions of Dokuwiki previous to //Rincewind// are no longer supported.
  
-**Note**: Versions of Dokuwiki previous to //Rincewind// are no longer supported. 
  
 ==== Syntax ==== ==== Syntax ====
Line 86: Line 89:
 ==== Demo ==== ==== Demo ====
  
-**Want to see the plugin in action?** Demos are upcoming.+**Want to see the plugin in action?** http://ryan.gulix.cl/tests.doku/current_/doku.php/divalign2
  
-If you want to contribute with a demo of this plugin, contact me. 
  
 =====Other Details===== =====Other Details=====
Line 145: Line 147:
 ====Changelog==== ====Changelog====
  
-FIXME The changelog will be updated later. In short:+See the repository page or [[https://notabug.org/lmachucabezzaza/dw-plugin-divalign2/raw/master/divalign2/ChangeLog|here]].
  
-**2013** 
- 
-  * Removed multiple-paragrapgh misfeature. 
-  * Refactored code. 
-  * Still pending: toolbar update. 
- 
- 
-**2011** 
- 
-  * ''[[:devel:syntax_plugins|PType]]=='stack%%'%%'' is fixed and now generates the correct code for DW releases 2010-11-07 and hopefully later. 
-  * a small fix that imitates the same behaviour with DW versions previous to 2010-11-07, hopefully fixing the generation of invalid XHTML code. 
-  * new toolbar icons courtesy of //faraday//. 
-  * the "blank line at the end" requirement for multiple paragraphs is removed for DW releases 2010-11-07 and hopefully later. 
  
 ==== Source Code ==== ==== Source Code ====
  
 Unzipping the file from the download link above will give you the source code, as will do checking the source repo. It is free, in the GPL definition of the word. Unzipping the file from the download link above will give you the source code, as will do checking the source repo. It is free, in the GPL definition of the word.
- 
-==== Legalese ==== 
- 
-This plugin ("divalign2") © [[#The Author]].  
- 
-"divalign2" is developed part-for-fun, part-for-learning, of The Author's free will and during his spare time. It is released "as-is" under the terms of the GPL 2 License. The Author is not affiliated to the core DokuWiki staff, he just knows the guys and likes them (er... their work). The Author takes no responsibility for damages caused by inadequate use of "divalign2", but tries to stay available for a nice chat if particular issues related to "divalign2"'s domain are presented. Insert standard lorem-ipsum like legal disclaimer and/or waiver of warranties here and you know the drill.  
- 
-Credits are given to Jason Byrne for the original implementation of this plugin, which you will find under [[plugin:divalign]]. Also to C. Smith, W. Torres, Teto and Krat (all registered user of this wiki) for the suggestions provided to the original plugin, which triggered this development; and to Benjamin Schiller for testing with the more recent DokuWiki versions. 
- 
----- 
  
 ===== Discussion ===== ===== Discussion =====
  
-Feel free to :?: ask questions here. However, please __check the [[plugin:divalign|original plugin page]]__ before doing so. Greetings.+:?: [[plugin:divalign2:discussion|Ask questions here]]. Also includes the discussion archive before this revision.
  
  
----- 
- 
->Hello, Since a few months I've been workign on a docuwiki and text-alignment certainly fails... I've found your plugin but it doesn't seem to work on Deterius. Is there a possibility to fix the compattability for the newer version of Dokuwiki too? I've noticed that the last update was in 2013 (3 years ago). 
- 
-> All the best, 
-> --- User unknown //2016/06/26// 
- 
-If you do not get this plugin to work you might also like to try the [[wrap]] plugin. It supports alignment too, I think. 
- --- [[user>LarsDW223|LarsDW223]] //2016/06/26// 
- 
----- 
- 
-Hi! 
- 
-You can simplify your code by writing one class that extends the DokuWiki_Syntax_Plugin class. And let next all your other syntax classes extend this first pluginsyntaxclass. So you can use parent::method() to access the parent methods you like to reuse. And when methods are the same in the subclasses, you can leave then even out, because they inherited automatically.  
- 
-Good luck! 
- --- [[user>Klap-in|Klap-in]] //2013/01/23// 
----- 
- 
-The option ### for justify don't work. To make it work change in ///lib/plugins/divalign2/syntax/justify.php// the line 81 from: <code> $renderer->doc .= '<div class="divalign-2'.$align.'">'; </code> to <code> $renderer->doc .= '<div class="divalign-'.$align.'">'; </code> 
-><del>Acknowledged, and will be corrected shortly. Thanks.</del> Corrected in the new version 2.0.  --- //[[luis.machuca@gulix.cl|Luis Machuca B.]] 2009/08/22 06:13// 
- 
-FROM: Michel\\  
-Nice to be able to align text the way you want!  
-Is there a way to make it work with tables? 
->Hi. I haven't studied the possibility of making it work with tables because the wikitext parsing for tables differs from that of normal wikitext (with things such as, no paragraphs, flow-on linebreak, forced start- and end-line delimiters, etc). The only way I //think// this plugin can work with tables is via the extended syntax that is made available by the [[plugin:exttab2]] plugin. --  --- //[[luis.machuca@gulix.cl|Luis Machuca B.]] 2009/04/11 08:23// 
- 
----- 
- 
-Just installed this. The icon on the toolbar shows X but the other align symbols show up when the X is clicked. Used plugin manager. How do I fix it? Thanks. peterennis (at) yahoo (dot) com //2009/09/29// 
->Yeah, that was a mistake I made with the path to the icon file. In ''script.js'', you can check the following line:  
-><code js>"icon" : "../plugins/divalign2/images/pleft.png",</code> 
->and change as follows: 
-><code js>"icon" : "../../plugins/divalign2/images/pleft.png",</code> 
-><del>I'll upload a fixed version of the script file with the next release. --  --- //[[luis.machuca@gulix.cl|Luis Machuca Bezzaza]] 2009/10/08 19:58//</del> Corrected as of the latest version. 
- 
----- 
- 
-winky 2010/02/17 
-IMHO the Toolbar-Buttons are broken. For example, if I click "center" I get: 
- 
-<code> 
-;#;\n;#;\n 
-</code> 
- 
-instead 
- 
-<code> 
-;#; 
- 
-;#; 
-</code> 
- 
->Hi. I've taken note of this issue, but can only reproduce it with the latest version of DokuWiki. Let me check for a while before releasing a patch or something. --  --- //[[luis.machuca@gulix.cl|Luis]] 2010/02/17 22:14// 
- 
-Hi Luis, the following mod fixed it for me: 
-<code> 
-diff script.js script.js.org 
-13,15c13,15 
-< align_da2_arr['#;;\n\n#;;\n'   = 'pleft.png'; 
-< align_da2_arr[';#;\n\n;#;\n'   = 'pcenter.png'; 
-< align_da2_arr[';;#\n\n;;#\n'   = 'pright.png'; 
---- 
-> align_da2_arr['#;;\\n#;;\\n'   = 'pleft.png'; 
-> align_da2_arr[';#;\\n;#;\\n'   = 'pcenter.png'; 
-> align_da2_arr[';;#\\n;;#\\n'   = 'pright.png'; 
-</code> 
- 
-thx a lot for this plugin. another problem exists with the toolbar-icon (will not be displayed correctly). if i have some time i try to fix it too. 
- --- //[[winky@disregard.de|winky]] 2010/03/05 11:30// 
- 
-OK, that was quite simple ... to fix the toolbar-icon you have only correct the path from ''../'' to ''../../'': 
- 
-<code> 
-20c20 
-<                     "icon":"../../plugins/divalign2/images/pleft.png", 
---- 
->                     "icon":"../plugins/divalign2/images/pleft.png", 
-24c24 
-<                     "icobase":"../../plugins/divalign2/images"}; 
---- 
->                     "icobase":"../plugins/divalign2/images"}; 
-</code> 
- 
- --- //[[winky@disregard.de|winky]] 2010/03/05 12:24// 
- 
->Thanks for the clarification, winky. The plugin should now load the correct graphics.  --- //[[luis.machuca@gulix.cl|Luis]] 2010/03/30 19:34// 
- 
-Hi Luis, the following mod fixed the broken Toolbar-Buttons for me: 
-<code> 
-original: 
-align_da2_arr['#;;\\n#;;\\n'   = 'pleft.png'; 
-align_da2_arr[';#;\\n;#;\\n'   = 'pcenter.png'; 
-align_da2_arr[';;#\\n;;#\\n'   = 'pright.png'; 
---- 
-change to: 
-align_da2_arr['#;;\n' + '\n' + '#;;\n'   = 'pleft.png'; 
-align_da2_arr[';#;\n' + '\n' + ';#;\n'   = 'pcenter.png'; 
-align_da2_arr[';;#\n' + '\n' + ';;#\n'   = 'pright.png'; 
-</code> 
-and it works fine. 
- 
---- // slowbu 2010/03/17 14:42// 
- 
- 
----- 
- 
-Since troubles seem unsolved (at least for me) here my complete script.js, that fixed icon and usage errors: 
- 
-<code> 
-var align_da2_arr = new Array();  
-align_da2_arr['#;;\n' + '\n' + '#;;\n'   = 'pleft.png'; 
-align_da2_arr[';#;\n' + '\n' + ';#;\n'   = 'pcenter.png'; 
-align_da2_arr[';;#\n' + '\n' + ';;#\n'   = 'pright.png'; 
- 
-if(window.toolbar!=undefined){ 
-  toolbar[toolbar.length] = { "type":"picker", 
-                    "title":"Alignment", 
-                    "icon":"../../plugins/divalign2/images/pleft.png", 
-                    "key":"", 
-                    "list": align_da2_arr, 
-                    /* subdir of lib/images/ where images found.*/ 
-                    "icobase":"../plugins/divalign2/images"}; 
- } 
-</code> 
- 
-Remark the ../../ for the icon path but only ../ for the icobase path. 
- 
---- //[[mathias.lindner@web.de|mathias]] 2010/03/30 16:05// 
- 
->Thanks for the clarification, Mathias. The plugin should now load the correct graphics. Moreso, it should also output the syntax with the buttons correctly (the issue seems to be that apparently DokuWiki doesn't like to have no words between syntaxes, so I just add the word "Paragraph" =) ). I'd like to hear from you testing this though.  --- //[[luis.machuca@gulix.cl|Luis]] 2010/03/30 19:34// 
- 
-I don't like the buttons, so i worked out my own. Just click and download them, if u like them: {{http://img96.imageshack.us/img96/4881/justify.png?10|}} {{http://img714.imageshack.us/img714/2557/righte.png?10|}} {{http://img59.imageshack.us/img59/8075/leftfk.png?10|}} {{http://img267.imageshack.us/img267/2442/center.png?10|}}. Additionally i work on a new version of this, because there are many problems i get. But the basic idea is very good! 
- 
- --- //[[weichei01@gmx.net|faraday]] 2010/06/07 11:44// 
->Looks nice, maybe I can use them. Also, what problems? Could be of help to get some pointers to improve development.  --- //[[luis.machuca@gulix.cl|Luis]] 2010/06/07 14:50// 
->>Thx. My problem: i renamed the tags into ''<left></left>'', ''<justify></justify>'' and so on. Works nice and because of this i dont get any problems. BUT: I have got many problems with the <p>-Tag in HTML (-> Paragraphs). Sometimes there are only line breaks and sometimes there are other mysterious paragraph-problems. For example: I made up this code: 
->> 
->><code>Du kannst einen Text 
-<left>linksbündig,</left> 
-<right>rechtsbündig</right> 
-<center>zentriert,</center> 
-<justify>oder im Blocksatz</justify> 
-anzeigen lassen. 
- 
-  Du kannst einen Text 
-  <left>linksbündig,</left> 
-  <right>rechtsbündig</right> 
-  <center>zentriert,</center> 
-  <justify>oder im Blocksatz</justify> 
-  anzeigen lassen.</code> 
->>And i get many problems. With the original php plugin code, i get something like this: {{http://img707.imageshack.us/img707/5608/exampleyo.jpg?200|}} The last line is only a line break, although i built in a paragraph (dokuwiki-style). I compared it with the [[plugin:wrap]]-plugin and it works perfectly with it. i dunno where is the significant difference. 
->> 
->>>That seems to me you haven't paid attention to the [[#Syntax details]] or the demo page; there I made a warning that unlike the original divalign, this plugin **requires** the syntax markings at the beginning of their own lines, instead of in a run-in fashion. That was a decision I took when trying to make the plugin mark multiple paragraphs in a row (if I did it the other way, that is simply using PType="block" and throwing the paraghraphs all together, the plugin would break XHTML compliance, not to mention eat info with the ODT renderer and the like).\\ If you don't need ODT compatibility for multiple paragraphs, or don't mark multiple paragraphs at a time with align syntax at all, it should suffice to remove the ''%%\n%%'''s in each of the regexes in the syntax files, and change the plugin PType to "block" in common.php, to bring back original!Divalign's component behaviour. Check your use case [[http://ryan.gulix.cl/doku/doku.php/playground:divalign|here]].\\ I hope I can solve the issue one day for all sides.  Also I'll be crediting you for the buttons in the next major release. --- //[[luis.machuca@gulix.cl|Luis]] 2010/06/08 00:58// 
->>> 
->>> 
->>>>I wrote a new plugin, which solves any problem with the paragraphs. In my opinion it is very clear too. Here you can find it: [[plugin:alignment]] 
- 
----- 
- 
-Plugin download link is down?? --- //Garrett 2010/08/27 12:48// 
-><del>The server is going to be replaced so I'm looking for another place (server & domain) to host the download page.  --- //[[luis.machuca@gulix.cl|Luis]] 2010/08/29 06:05//</del> **Corrected** 
- 
----- 
- 
-Would you add a way change text width? 
- 
-A lot of blogs use 500-600px text column width. But Dokuwiki text is too long horizontally. 
- 
-ex. <DivAlign2 500px> 
- 
->I've thought about this, but it would be difficult to guarantee that the sizes are correct (parsing units, not exceeding the viewport and what not). Considering that such cases would work site-wide, I think customizing ''$DOKU_CONF/userstyle.css'' is better fit for such tasks.  --- [[user>ryan.chappelle]] //2011/02/02 18:50// 
----- 
- 
-I updated the action.php file to make the toolbar works with Angua version of DokuWiki \\ 
-//2012/02/28 19:13// \\ 
-<file php action.php> 
-<?php 
-/** 
- * @file       divalign2/action.php 
- * @brief      Action component for the divalign2 plugin. 
- * @license    GPLv2 (http://www.gnu.org/licenses/gpl.html) 
- * @version    2.3 
- * @date       2010-11-11 
- * @author     Luis Machuca Bezzaza <luis [dot] machuca [at] gulix [dot] cl> 
-**/ 
- 
-if(!defined('DOKU_INC')) die(); 
-if(!defined('DOKU_PLUGIN')) define('DOKU_PLUGIN',DOKU_INC.'lib/plugins/'); 
-require_once(DOKU_PLUGIN.'action.php'); 
-require_once(DOKU_PLUGIN. 'divalign2/common.php'); // for common functions 
- 
-class action_plugin_divalign2 extends DokuWiki_Action_Plugin { 
- 
-    /** 
-     * return some info 
-     */ 
-    function getInfo(){ 
-        return DW_common_divalign2::getInfo('action'); 
-    } 
- 
-function register(Doku_Event_Handler $controller) { 
-    // detect DokuWiki version 
-   /* $v= file_get_contents(DOKU_INC. 'VERSION'); 
-    if ($v===false) return; 
-    // else 
-    $v= substr($v, 0, strpos($v, ' ')); 
-    $v_is_old= intval ($v < '2010-11-07'); 
-    //echo "<pre> Version: $v : $v_is_old</pre>"; 
-    if ($v_is_old) { 
-        $res= $controller->register_hook('TPL_CONTENT_DISPLAY', 'BEFORE', $this, 'fix_par_stack', array ()); 
-        } 
-    if (0) $res= $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'divalign_toolbar', array ());*/ 
-    $controller->register_hook('TOOLBAR_DEFINE', 'AFTER', $this, 'divalign_toolbar', array ()); 
- 
-    } 
- 
-function divalign_toolbar(& $event, $param) { 
-  $event->data[] = array ( 
-            'type' => 'picker', 
-            'title' => 'Alignement', 
-            'icon' => '../../plugins/divalign2/images/pleft.png', 
-            'list' => array( 
-                array( 
-                    'type'   => 'format', 
-                    'title'  => 'Left', 
-                    'sample' => '#;;\n Left\n#;;', 
-                    'icon'   => '../../plugins/divalign2/images/pleft.png', 
-                    'open'   => '#;;\n', 
-                    'close'  => '\n#;;', 
-                ), 
-                array( 
-                    'type'   => 'format', 
-                    'title'  => 'Center', 
-                    'sample' => ';#;\n Center\n;#;', 
-                    'icon'   => '../../plugins/divalign2/images/pcenter.png', 
-                    'open'   => ';#;\n', 
-                    'close'  => '\n;#;', 
-                ), 
-                array( 
-                    'type'   => 'format', 
-                    'title'  => 'Right', 
-                    'sample' => ';;#\n Right\n;;#', 
-                    'icon'   => '../../plugins/divalign2/images/pright.png', 
-                    'open'   => ';;#\n', 
-                    'close'  => '\n;;#', 
-                ), 
-                array( 
-                    'type'   => 'format', 
-                    'title'  => 'Justify', 
-                    'sample' => '###\n Justify\n###', 
-                    'icon'   => '../../plugins/divalign2/images/pjustify.png', 
-                    'open'   => '###\n', 
-                    'close'  => '\n###', 
-                ),                
-            ) 
-        ); 
-    } 
- 
-} 
-//... and that's all 
- 
-</file> 
plugin/divalign2.1546701584.txt.gz · Last modified: 2019-01-05 16:19 by turnermm

Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 4.0 International
CC Attribution-Share Alike 4.0 International Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki