divalign2 plugin

divalign2 plugin by Luis Machuca Bezzaza
Align content left, right, center, or justify

Last updated on 2009-08-22. Provides Syntax.
No compatibility info given!

Conflicts with divalign!
Similar to divalign, wrap.

Tagged with odt, style, toolbar, typography.

    This plugin is a fork of the plugin:divalign plugin by Jason Byrne.
    :!: 2009-08: Now with toolbar and ODT Plugin compatibility!

    Download and Installation

    File for Plugin Manager. Or you can check the Plugin Demo Page. Note the language is Spanish, but online translators shall do short mince of it.

    Some years ago, Jason Byrne contributed with his first plugin, divalign, which allowed a simple, unobtrusive syntax to use a feature that the original DokuWiki engine lacked: paragraph alignment.

    At some moment at Dec. 2008, I tried to contact the original author of the plugin, in order to see if the newest fixes and suggestions could be integrated. As I received no answer and I was too interested in having those fixes available, I decided to fork the plugin to at least provide some of the requests. Here are the results.

    Thanks to Jason Byrne (the original Author). Also C. Smith, W. Torres, Teto and Krat (all registered users of this wiki) for the suggestions provided to the original plugin.

    Download link: https://informatica.temuco.udelmar.cl/~lmachuca/dokuwiki-lucho/_media/desarrollo/dokuwiki/dw-plugin-divalign2-latest.zip

    Syntax

    :!: Note: as of v2.0, a blank line is required to end the alignment syntax mode.

    Align Left:

    #;;
    This is aligned left.
    
    #;;

    Align Right:

    ;;#
    This is aligned right.
    
    ;;#

    Align Center:

    ;#;
    This is aligned center.
    
    ;#;

    Align Justify:

    ###
    This texts is justified.
    
    ###

    Demo

    Check the link provided above for a demo page.

    Notes

    Edit Toolbar

    The plugin now incorporates a Toolbar Picker Button for the alignment mode. You click it, and are presented with three buttons to set left, center or right alignment (I admit: I forgot about justify).

    Syntax details

    Because it uses the same syntax, this plugin is marked as both similar and conflicting with the original Divalign.

    The following is a list of features added with respect to the original plugin:

    • Support for Plugin Manager (a download link is provided).
    • Code separation (CSS styling, and four syntax files).

    Unlike the original plugin, divalign2 requires that the enter/exit syntax take place at the beginning/end of their lines, respectively. Thus, the following should not work:

    ;;#
    This text will not be aligned right. ;;#

    Also, if you want to wrap two or more paragraphs inside an aligned section, you must do this by providing a blank line after the entering syntax, like this:

    ;;#
    
    This is a small preamble aligned right.
    
    And this is some more text aligned right. This paragraph, and any other following, 
    would follow the right alignment, until a line containing the string ';;#' is found again.
    
    ;;#

    Changelog

    Version 2.0 (2009-08-14)

    • Compatibility with the text renderer1)
    • Partial compatibility with the ODT renderer2)
    • Fixed a CSS issue that prevented align:justify from working.
    • Adds script.js with a Toolbar Picker for the edit mode.

    Version 1.0 (2009-02-11)

    • Left, right and center alignment.
    • Justified alignment was back-added later.

    Future Development

    • to check the alignment modes for the ODT plugin
    • a syntax mode for margins?

    Other Developments

    Discussion

    Feel free to :?: ask questions here. However, please check the original plugin page before doing so. Greetings.

    The option ### for justify don't work. To make it work change in /lib/plugins/divalign2/syntax/justify.php the line 81 from:

     $renderer->doc .= '<div class="divalign-2'.$align.'">'; 

    to

     $renderer->doc .= '<div class="divalign-'.$align.'">'; 
    Acknowledged, and will be corrected shortly. Thanks. Corrected in the new version 2.0. — 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 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:
    "icon" : "../plugins/divalign2/images/pleft.png",


    and change as follows:

    "icon" : "../../plugins/divalign2/images/pleft.png",


    I'll upload a fixed version of the script file with the next release. – — Luis Machuca Bezzaza 2009/10/08 19:58


    winky 2010/02/17 IMHO the Toolbar-Buttons are broken. For example, if I click “center” I get:

    ;#;\n;#;\n
    

    instead

    ;#;
    
    ;#;
    
    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 2010/02/17 22:14

    Hi Luis, the following mod fixed it for me:

    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';
    

    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 2010/03/05 11:30

    OK, that was quite simple … to fix the toolbar-icon you have only correct the path from ../ to ../../:

    20c20
    <                     "icon":"../../plugins/divalign2/images/pleft.png",
    ---
    >                     "icon":"../plugins/divalign2/images/pleft.png",
    24c24
    <                     "icobase":"../../plugins/divalign2/images"};
    ---
    >                     "icobase":"../plugins/divalign2/images"};
    

    winky 2010/03/05 12:24

    Hi Luis, the following mod fixed the broken Toolbar-Buttons for me:

    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';
    

    and it works fine.

    slowbu 2010/03/17 14:42

    1) it simply removes the syntax hooks, there is not much else to do…
    2) using ODT auto-styles; left and right work OK but center may present some problems
     
    plugin/divalign2.txt · Last modified: 2010/03/17 14:44 by 62.176.236.53
     
    Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
    Imprint Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki
    WikiForumIRCBugsGitXRefTranslate