Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
D
doctrine-dbal
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Tomáš Trávníček
doctrine-dbal
Commits
86f313c1
Commit
86f313c1
authored
Jul 20, 2007
by
jepso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
This was left out from previous commit
parent
9b619571
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
89 additions
and
0 deletions
+89
-0
Prefilter.php
manual/new/lib/Text/Wiki/Parse/Doc/Prefilter.php
+89
-0
No files found.
manual/new/lib/Text/Wiki/Parse/Doc/Prefilter.php
0 → 100644
View file @
86f313c1
<?php
/**
*
* "Pre-filter" the source text.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones <pmjones@php.net>
*
* @license LGPL
*
* @version $Id: Prefilter.php,v 1.4 2006/12/08 08:30:37 justinpatrin Exp $
*
*/
/**
*
* "Pre-filter" the source text.
*
* Convert DOS and Mac line endings to Unix, concat lines ending in a
* backslash \ with the next line, convert tabs to 4-spaces, add newlines
* to the top and end of the source text, compress 3 or more newlines to
* 2 newlines.
*
* @category Text
*
* @package Text_Wiki
*
* @author Paul M. Jones <pmjones@php.net>
*
*/
class
Text_Wiki_Parse_Prefilter
extends
Text_Wiki_Parse
{
/**
*
* Simple parsing method.
*
* @access public
*
*/
function
parse
()
{
// convert DOS line endings
$this
->
wiki
->
source
=
str_replace
(
"
\r\n
"
,
"
\n
"
,
$this
->
wiki
->
source
);
// convert Macintosh line endings
$this
->
wiki
->
source
=
str_replace
(
"
\r
"
,
"
\n
"
,
$this
->
wiki
->
source
);
// concat lines ending in a backslash
$this
->
wiki
->
source
=
str_replace
(
"
\\\n
"
,
""
,
$this
->
wiki
->
source
);
// convert tabs to four-spaces
$this
->
wiki
->
source
=
str_replace
(
"
\t
"
,
" "
,
$this
->
wiki
->
source
);
// add extra newline before code tags to prevent xhtml validation errors
$this
->
wiki
->
source
=
preg_replace
(
';^(<code(?:\s[^>]*)?>(?:.*?)</code>(?:\s|$));msi'
,
"
\n\\
1"
,
$this
->
wiki
->
source
);
// add extra newlines at the top and end; this
// seems to help many rules.
$this
->
wiki
->
source
=
"
\n
"
.
$this
->
wiki
->
source
.
"
\n\n
"
;
$this
->
wiki
->
source
=
str_replace
(
"
\n
----
\n
"
,
"
\n\n
----
\n\n
"
,
$this
->
wiki
->
source
);
$this
->
wiki
->
source
=
preg_replace
(
"/
\n
(
\\
+
{
1,6
}
)(.*)
\n
/m"
,
"
\n\n\\
1
\\
2
\n\n
"
,
$this
->
wiki
->
source
);
// finally, compress all instances of 3 or more newlines
// down to two newlines.
$find
=
"/
\n
{
3,
}
/m"
;
$replace
=
"
\n\n
"
;
$this
->
wiki
->
source
=
preg_replace
(
$find
,
$replace
,
$this
->
wiki
->
source
);
}
}
?>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment