Table of Contents
Spreadout Plugin
Compatible with DokuWiki
- 2022-07-31 "Igor" yes
- 2020-07-29 "Hogfather" yes
- 2018-04-22 "Greebo" unknown
- 2017-02-19 "Frusterick Manners" unknown
A simple plugin that allows for two spaces between content sentences if the user types two spaces rather than one
Similar to replace, strreplace
Requirements
PHP 7+ required.
Installation
Install the plugin using the Plugin Manager and the download URL above, which points to latest version of the plugin. Refer to Plugins on how to install plugins manually.
Configuration
There is no configuraton required.
Usage
Edit your Dokuwiki pages as you normally would. If you only use single spaces, then nothing changes whatsoever.
If you enter more than one space after a sentence then the text will be replaced by a space followed by a nonbreaking space entity (
) so that two spaces will be rendered in the final text.
Currently, the spaces are placed after the following characters followed by two or more spaces:
- .
- ?
- !
- :
potentially followed by the characters:
- )
- ]
- }
- "
- '
Note that the colon may not precede a closing parenthesis, only the other symbols.
The follow-up characters are important because if you enter a parenthetical and it is the end of a sentence, you still want double spacing after it. Also, in Dokuwiki syntax you often have square or curly braces around text to denote links or styling, and they may fall at the end of a sentence.
The name "Spreadout"
I find it's far easier to skim text if I have better clues about where sentences begin and end with extra whitespace, but HTML takes that away from me by collapsing multiple spaces into a single space unless I specifically make a non-breaking space entity or character. Since I have several wikis I maintain, I figured it'd be nice if I could “spread out” the sentences to make the content easier to look over at a glance.
Development
Change Log
- 2022-08-02: Removed some superfluous comments and code from
syntax.php
. - 2022-07-27: I left a typo in the files in the repo. Fortunately, I think I am the only one using this plugin at this time
Also found that there was a conflict with the EditTable plugin, so I check for this and work around it. - 2022-07-25: Fixed a bug where installing this plugin disabled the ability of section editing to do its job.
- 2022-07-23: We already picked up our first feature, which was handling additional common text block items after the end of the text, but to do it properly I had to burn down
typography
to save it. (Basically, no matter what you put in thetypography
configuration, I set it to zero after saving another copy to$conf
, and then handle the generation of curly quotes in an event handler on my side using whatever you had originally set. Hideous hack, but it works.)
Why am I working on this when there are open items on my other plugin? Well, sometimes I get a wild hair to do something! - 2022-07-22: Initial release in a fitful rage of “why doesn't this already exist?! How can this not already exist?!”
Future plans
- Currently there's no support for bold, italics, underlines etc, at the end of the sentence. That may change.
- Make each of the options configurable in the configuration settings (you may want it after colons, but not sentences, or vice versa, or after links but not curly braces).
Known Bugs and Issues
None known.
If you find a bug, please submit a bug at the project's github.