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
04d945a1
Commit
04d945a1
authored
Jan 23, 2008
by
jepso
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixes #527
parent
c5e60f3e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
81 additions
and
57 deletions
+81
-57
Code.php
manual/lib/Text/Wiki/Render/Latex/Code.php
+12
-12
Code.php
manual/lib/Text/Wiki/Render/Xhtml/Code.php
+8
-2
basic.css
manual/styles/basic.css
+7
-3
Xhtml.php
vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php
+54
-40
No files found.
manual/lib/Text/Wiki/Render/Latex/Code.php
View file @
04d945a1
<?php
class
Text_Wiki_Render_Latex_Code
extends
Text_Wiki_Render
{
/**
*
*
* Renders a token into text matching the requested format.
*
*
* @access public
*
*
* @param array $options The "options" portion of the token (second
* element).
*
*
* @return string The text rendered from the token options.
*
*
*/
function
token
(
$options
)
{
$text
=
$options
[
'text'
];
$attr
=
$options
[
'attr'
];
$type
=
strtolower
(
$attr
[
'type'
]);
if
(
$type
==
'php'
)
{
if
(
substr
(
$options
[
'text'
],
0
,
5
)
!=
'<?php'
)
{
// PHP code example:
...
...
@@ -29,9 +29,9 @@ class Text_Wiki_Render_Latex_Code extends Text_Wiki_Render {
$text
=
"<?php
\n\n
"
.
$options
[
'text'
]
.
"
\n\n
?>"
;
// <?php
}
}
$text
=
"
\\
begin
{
lstlisting}
\n$text\n\\end{lstlisting
}
\n\n
"
;
$text
=
"
\\
begin
{
lstlisting}
[caption={
}
{
}]\n$text\n\\end{lstlisting
}
\n\n
"
;
if
(
$type
!=
''
)
{
$text
=
"
\\
lstset
{
language=$type
}
\n
"
.
$text
;
}
else
{
...
...
manual/lib/Text/Wiki/Render/Xhtml/Code.php
View file @
04d945a1
...
...
@@ -30,7 +30,8 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
'css_code'
=>
null
,
// class for generic <code>
'css_php'
=>
null
,
// class for PHP <code>
'css_html'
=>
null
,
// class for HTML <code>
'css_filename'
=>
null
// class for optional filename <div>
'css_filename'
=>
null
,
// class for optional filename <div>
'code_begin_callback'
=>
null
);
/**
...
...
@@ -47,7 +48,7 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
*/
function
token
(
$options
)
{
{
$text
=
$options
[
'text'
];
$attr
=
$options
[
'attr'
];
$type
=
strtolower
(
$attr
[
'type'
]);
...
...
@@ -104,6 +105,11 @@ class Text_Wiki_Render_Xhtml_Code extends Text_Wiki_Render {
$attr
[
'filename'
]
.
'</div>'
.
$text
;
}
$callback
=
$this
->
getConf
(
'code_begin_callback'
);
if
(
$callback
)
{
$text
=
call_user_func
(
$callback
)
.
$text
;
}
return
"
\n
$text
\n\n
"
;
}
}
...
...
manual/styles/basic.css
View file @
04d945a1
...
...
@@ -46,6 +46,10 @@ p, ul, ol, dl {
font-size
:
small
;
}
p
.caption
{
font-style
:
italic
;
}
dd
{
margin-bottom
:
0.5em
;
}
...
...
@@ -110,7 +114,7 @@ pre {
color
:
black
;
background-color
:
#f7f7f7
;
border
:
1px
solid
#d7d7d7
;
/* Pup's Box Flow Hack, Rev 2 */
overflow
/**/
:
auto;
\
height
:
1%
;
...
...
@@ -120,9 +124,9 @@ pre {
pre
,
x
:-moz-any-link
{
/* overflow: auto causes artefacts */
overflow
:
hidden
;
/* prevents text to be hidden by wrapping it */
white-space
:
-moz-pre-wrap
!important
;
white-space
:
-moz-pre-wrap
!important
;
}
pre
.default
{
...
...
vendor/Sensei/Sensei/Doc/Renderer/Xhtml.php
View file @
04d945a1
...
...
@@ -34,28 +34,32 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
{
/**
* Available options
*
*
* (Sensei_Doc_Section|null) section :
* Section to be rendered. If null all sections will be rendered.
*
* (string) url_prefix :
* All URLs pointing to sections will be prefixed with this.
* All URLs pointing to sections will be prefixed with this.
*/
protected
$_options
=
array
(
'section'
=>
null
,
'url_prefix'
=>
''
);
private
$_chapter
;
private
$_codeListingsIndex
;
public
function
__construct
(
Sensei_Doc_Toc
$toc
,
array
$options
=
array
())
{
parent
::
__construct
(
$toc
,
$options
);
$this
->
_wiki
->
setRenderConf
(
'xhtml'
,
'Doclink'
,
'url_callback'
,
array
(
&
$this
,
'makeUrl'
));
$this
->
_wiki
->
setRenderConf
(
'xhtml'
,
'Code'
,
'code_begin_callback'
,
array
(
&
$this
,
'codeListingsNumberingCallback'
));
}
/**
* Renders table of contents as nested unordered lists.
*
*
* @return string rendered table of contents
*/
public
function
renderToc
()
...
...
@@ -72,7 +76,7 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
protected
function
_renderToc
(
$section
)
{
$output
=
''
;
if
(
$section
instanceof
Sensei_Doc_Toc
)
{
$class
=
' class="tree"'
;
}
elseif
(
$section
!==
$this
->
_options
[
'section'
])
{
...
...
@@ -80,27 +84,27 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
}
else
{
$class
=
''
;
}
$output
.=
'<ul'
.
$class
.
'>'
.
"
\n
"
;
$output
.=
'<ul'
.
$class
.
'>'
.
"
\n
"
;
for
(
$i
=
0
;
$i
<
$section
->
count
();
$i
++
)
{
$child
=
$section
->
getChild
(
$i
);
$text
=
$child
->
getIndex
()
.
' '
.
$child
->
getName
();
$href
=
$this
->
makeUrl
(
$child
);
$output
.=
'<li><a href="'
.
$href
.
'">'
.
$text
.
'</a>'
;
if
(
$child
->
count
()
>
0
)
{
$output
.=
"
\n
"
;
$output
.=
$this
->
_renderToc
(
$child
);
}
$output
.=
'</li>'
.
"
\n
"
;
}
$output
.=
'</ul>'
.
"
\n
"
;
return
$output
;
}
...
...
@@ -113,29 +117,29 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
public
function
render
()
{
$section
=
$this
->
_options
[
'section'
];
if
(
$section
instanceof
Sensei_Doc_Section
)
{
$content
=
$this
->
_renderSection
(
$section
);
}
else
{
// No section was set, so let's render all sections
// No section was set, so let's render all sections
$content
=
''
;
for
(
$i
=
0
;
$i
<
count
(
$this
->
_toc
);
$i
++
)
{
$content
.=
$this
->
_renderSection
(
$this
->
_toc
->
getChild
(
$i
));
}
}
$output
=
$this
->
_options
[
'template'
];
$output
=
str_replace
(
'%TITLE%'
,
$this
->
_options
[
'title'
],
$output
);
$output
=
str_replace
(
'%AUTHOR%'
,
$this
->
_options
[
'author'
],
$output
);
$output
=
str_replace
(
'%SUBJECT%'
,
$this
->
_options
[
'subject'
],
$output
);
$output
=
str_replace
(
'%KEYWORDS%'
,
$this
->
_options
[
'keywords'
],
$output
);
$output
=
str_replace
(
'%TOC%'
,
$this
->
renderToc
(),
$output
);
$output
=
str_replace
(
'%CONTENT%'
,
$content
,
$output
);
return
$output
;
}
...
...
@@ -148,21 +152,23 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
protected
function
_renderSection
(
Sensei_Doc_Section
$section
)
{
$output
=
''
;
$title
=
$section
->
getIndex
()
.
' '
.
$section
->
getName
();
$level
=
$section
->
getLevel
();
if
(
$level
===
1
)
{
$class
=
' class="chapter"'
;
$title
=
'Chapter '
.
$title
;
$this
->
_chapter
=
$section
->
getIndex
();
$this
->
_codeListingsIndex
=
0
;
}
else
{
$class
=
' class="section"'
;
}
$output
.=
'<div'
.
$class
.
'>'
.
"
\n
"
;
$output
.=
"<h
$level
>"
;
if
(
!
(
$this
->
_options
[
'section'
]
instanceof
Sensei_Doc_Section
)
||
(
$level
>
$this
->
_options
[
'section'
]
->
getLevel
()))
{
$anchor
=
$this
->
makeAnchor
(
$section
);
...
...
@@ -171,22 +177,22 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
}
else
{
$output
.=
$title
;
}
$output
.=
"</h
$level
>"
;
// Transform section contents from wiki syntax to XHTML
$output
.=
$this
->
_wiki
->
transform
(
$section
->
getText
());
// Render children of this section recursively
for
(
$i
=
0
;
$i
<
count
(
$section
);
$i
++
)
{
$output
.=
$this
->
_renderSection
(
$section
->
getChild
(
$i
));
}
$output
.=
'</div>'
.
"
\n
"
;
return
$output
;
return
$output
;
}
public
function
makeUrl
(
$section
)
{
if
(
$section
instanceof
Sensei_Doc_Section
)
{
...
...
@@ -194,22 +200,22 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
}
else
{
$path
=
$section
;
}
$url
=
$this
->
_options
[
'url_prefix'
];
if
(
$this
->
_options
[
'section'
]
instanceof
Sensei_Doc_Section
)
{
$level
=
$this
->
_options
[
'section'
]
->
getLevel
();
$url
.=
implode
(
':'
,
array_slice
(
explode
(
':'
,
$path
),
0
,
$level
));
}
$anchor
=
$this
->
makeAnchor
(
$section
);
if
(
$anchor
!==
''
)
{
$url
.=
'#'
.
$anchor
;
}
return
$url
;
}
public
function
makeAnchor
(
$section
)
{
if
(
$section
instanceof
Sensei_Doc_Section
)
{
...
...
@@ -217,7 +223,7 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
}
else
{
$path
=
$section
;
}
if
(
$this
->
_options
[
'section'
]
instanceof
Sensei_Doc_Section
)
{
$level
=
$this
->
_options
[
'section'
]
->
getLevel
();
return
implode
(
':'
,
array_slice
(
explode
(
':'
,
$path
),
$level
));
...
...
@@ -225,4 +231,12 @@ class Sensei_Doc_Renderer_Xhtml extends Sensei_Doc_Renderer
return
$path
;
}
}
public
function
codeListingsNumberingCallback
()
{
$this
->
_codeListingsIndex
++
;
$html
=
'<p class="caption">Listing '
.
$this
->
_chapter
.
'.'
.
$this
->
_codeListingsIndex
.
"</p>
\n
"
;
return
$html
;
}
}
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