You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 26, 2020. It is now read-only.
<p>The Typography Class provides functions that help you format text.</p>
<h2>Initializing the Class</h2>
<p>Like most other classes in CodeIgniter, the Typography class is initialized in your controller using the <dfn>$this->load->library</dfn> function:</p>
<code>$this->load->library('typography');</code>
<p>Once loaded, the Typography library object will be available using: <dfn>$this->typography</dfn></p>
<h2>auto_typography()</h2>
<p>Formats text so that it is semantically and typographically correct HTML. Takes a string as input and returns it with
the following formatting:</p>
<ul>
<li>Surrounds paragraphs within <p></p> (looks for double line breaks to identify paragraphs).</li>
<li>Single line breaks are converted to <br />, except those that appear within <pre> tags.</li>
<li>Block level elements, like <div> tags, are not wrapped within paragraphs, but their contained text is if it contains paragraphs.</li>
<li>Quotes are converted to correctly facing curly quote entities, except those that appear within tags.</li>
<li>Apostrophes are converted to curly apostrophe entities.</li>
<li>Double dashes (either like -- this or like--this) are converted to em—dashes.</li>
<li>Three consecutive periods either preceding or following a word are converted to ellipsis…</li>
<li>Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.</li>
<p>There is one optional parameters that determines whether the parser should reduce more then two consecutive line breaks down to two. Use boolean <kbd>TRUE</kbd> or <kbd>FALSE</kbd>.</p>
<p>By default the parser does not reduce line breaks. In other words, if no parameters are submitted, it is the same as doing this:</p>
<pclass="important"><strong>Note:</strong> Typographic formatting can be processor intensive, particularly if you have a lot of content being formatted.
If you choose to use this function you may want to consider
<ahref="../general/caching.html">caching</a> your pages.</p>
<h2>format_characters()</h2>
<p>This function is similar to the <dfn>auto_typography</dfn> function above, except that it only does character conversion:</p>
<ul>
<li>Quotes are converted to correctly facing curly quote entities, except those that appear within tags.</li>
<li>Apostrophes are converted to curly apostrophe entities.</li>
<li>Double dashes (either like -- this or like--this) are converted to em—dashes.</li>
<li>Three consecutive periods either preceding or following a word are converted to ellipsis…</li>
<li>Double spaces following sentences are converted to non-breaking spaces to mimic double spacing.</li>