Advertisement:

Navigation

SMF Mod Site

Mod Name:
Paragrapher
Created By:
Sesquipedalian
Type:
New Feature
First Created:
December 07, 2015, 03:34:28 PM
Last Modified:
March 31, 2019, 01:44:08 AM
Latest Version:
2.1
Compatible With:
2.0.11, 2.0.15, 2.1 RC1, 2.1 RC2
Total Downloads:
381

Download this mod

Paragrapher.tar.gz (16kB) [156]
Manual Install Instructions for SMF


Below are some preview images of what the mod looks like when being used

Description:

Paragrapher

Paragrapher reformats the HTML generated from user posts so that it uses semantically correct <p></p> elements rather than <br> elements.

Features

  • Intelligently converts line breaks into paragraphs.
  • Admin can choose whether to preserve the original visual layout or to normalize all line breaks into paragraphs.
  • The content of [code][/code] and [pre][/pre] BBCodes is always left untouched.
  • Does not modify the content of posts in the database.
  • Does not interfere with the editor.
  • Does not interfere with BBCode parsing.
  • Acts on posts and personal messages within the forum, in RSS feeds, and via SSI.
  • Can be extended and integrated with other mods and custom code with very little work.

Settings
  • Normalize layout when formatting paragraphs: Enabling this will collapse extra lines of white space between paragraphs, resulting in more consistent formatting in the output. Leave it disabled to preserve the original visual layout.
  • Allow single line breaks to create new paragraphs: If set to "Never" (default), users must always enter at least two line breaks to create a new paragraph. If set to "Always", one line break will be enough to create a new paragraph. If set to "Intelligently" (recommended), Paragrapher will attempt to analyze and adapt to the author's writing style when making this decision for each post.

Extending Paragrapher

Forum admins and even other mods can easily integrate Paragrapher into their code wherever they like.

If you want Paragrapher to process a string of text stored in a variable called $msg, paste the following into your code at an appropriate point in the relevant PHP file:
Code: [Select]
call_integration_hook('integrate_paragrapher_string', array(&$msg));
If you have the data for a post in an array called $post, and you want Paragrapher to process its 'body' element, use this:
Code: [Select]
call_integration_hook('integrate_paragrapher_post', array(&$post, 'body'));
If you have an array of posts (e.g. every post in a topic), and you want Paragrapher to process the 'body' element of every post in the array, use this:
Code: [Select]
call_integration_hook('integrate_paragrapher_posts', array(&$topic, 'body'));
License

Paragrapher uses code derived from WordPress, and is therefore released under the GPLv2 (or later).

Changelog

Version 2.1:
  • Added Latin Spanish translation.

Version 2.0:
  • New option to control handling of single line breaks
  • Improved handling of preserved line breaks when not using the "normalize layout" option
  • Improved handling of paragraphs inside list items
  • Support for SMF 2.1
  • Rewritten to use integration hooks everywhere
    • Uses standard integration hooks on SMF 2.1
    • Creates custom integration hooks on SMF 2.0
  • Declares several generic integration hooks to enable easy integration with other mods and custom code
  • Minor CSS improvements

Version 1.1:

Version 1.0.1:
  • Replaced "preserve layout" option with "normalize layout" option

Version 1.0:
  • Initial submission to simplemachines.org