Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
3ff2e4e3
Commit
3ff2e4e3
authored
May 28, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improved PDF version of the guide
- better title page, - book style, - improved internal linking using labels and references
parent
c51b9956
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
106 additions
and
14 deletions
+106
-14
IndexFileAnalyzer.php
extensions/apidoc/helpers/IndexFileAnalyzer.php
+31
-11
GuideRenderer.php
extensions/apidoc/templates/pdf/GuideRenderer.php
+5
-1
main.tex
extensions/apidoc/templates/pdf/main.tex
+70
-2
No files found.
extensions/apidoc/helpers/IndexFileAnalyzer.php
View file @
3ff2e4e3
...
...
@@ -13,6 +13,9 @@ use cebe\markdown\Markdown;
class
IndexFileAnalyzer
extends
Markdown
{
public
$title
;
public
$introduction
;
private
$_chapter
=
0
;
private
$_chapters
=
[];
...
...
@@ -25,22 +28,39 @@ class IndexFileAnalyzer extends Markdown
protected
function
renderHeadline
(
$block
)
{
$this
->
_chapters
[
++
$this
->
_chapter
]
=
[
'headline'
=>
$block
[
'content'
],
'content'
=>
[],
];
if
(
$this
->
_chapter
===
0
)
{
$this
->
title
=
$block
[
'content'
];
$this
->
introduction
=
''
;
$this
->
_chapter
++
;
}
else
{
$this
->
_chapter
++
;
$this
->
_chapters
[
$this
->
_chapter
]
=
[
'headline'
=>
$block
[
'content'
],
'content'
=>
[],
];
}
return
parent
::
renderHeadline
(
$block
);
}
protected
function
renderParagraph
(
$block
)
{
if
(
$this
->
_chapter
<
1
)
{
$this
->
introduction
.=
implode
(
"
\n
"
,
$block
[
'content'
]);
}
return
parent
::
renderParagraph
(
$block
);
}
protected
function
renderList
(
$block
)
{
foreach
(
$block
[
'items'
]
as
$item
=>
$itemLines
)
{
if
(
preg_match
(
'~\[([^\]]+)\]\(([^\)]+)\)(.*)~'
,
implode
(
"
\n
"
,
$itemLines
),
$matches
))
{
$this
->
_chapters
[
$this
->
_chapter
][
'content'
][]
=
[
'headline'
=>
$matches
[
1
],
'file'
=>
$matches
[
2
],
'teaser'
=>
$matches
[
3
],
];
if
(
$this
->
_chapter
>
0
)
{
foreach
(
$block
[
'items'
]
as
$item
=>
$itemLines
)
{
if
(
preg_match
(
'~\[([^\]]+)\]\(([^\)]+)\)(.*)~'
,
implode
(
"
\n
"
,
$itemLines
),
$matches
))
{
$this
->
_chapters
[
$this
->
_chapter
][
'content'
][]
=
[
'headline'
=>
$matches
[
1
],
'file'
=>
$matches
[
2
],
'teaser'
=>
$matches
[
3
],
];
}
}
}
return
parent
::
renderList
(
$block
);
...
...
extensions/apidoc/templates/pdf/GuideRenderer.php
View file @
3ff2e4e3
...
...
@@ -69,9 +69,13 @@ class GuideRenderer extends \yii\apidoc\templates\html\GuideRenderer
$output
.=
'\chapter{'
.
$chapter
[
'headline'
]
.
"}
\n
"
;
foreach
(
$chapter
[
'content'
]
as
$content
)
{
if
(
isset
(
$fileData
[
$content
[
'file'
]]))
{
$md
->
labelPrefix
=
$content
[
'file'
]
.
'#'
;
$output
.=
'\label{'
.
$content
[
'file'
]
.
'}'
;
$output
.=
$md
->
parse
(
$fileData
[
$content
[
'file'
]])
.
"
\n\n
"
;
}
else
{
$output
.=
'\newpage\textbf{Error: not existing file: '
.
$content
[
'file'
]
.
'}\newpage'
.
"
\n
"
;
$output
.=
'\newpage'
;
$output
.=
'\label{'
.
$content
[
'file'
]
.
'}'
;
$output
.=
'\textbf{Error: not existing file: '
.
$content
[
'file'
]
.
'}\newpage'
.
"
\n
"
;
}
if
(
$this
->
controller
!==
null
)
{
...
...
extensions/apidoc/templates/pdf/main.tex
View file @
3ff2e4e3
\documentclass
[a4paper, 10pt]
{
book
}
\documentclass
[a4paper,11pt,twoside]
{
book
}
% english and utf8
%\usepackage[T1]{fontenc}
...
...
@@ -75,10 +74,79 @@
% http://tex.stackexchange.com/questions/23711/strikethrough-text
\usepackage
{
ulem
}
\newcommand
{
\centeronpage
}{
% Horizontal adjustment of image
\ifodd\value
{
page
}
\hspace*
{
\dimexpr\evensidemargin
-
\oddsidemargin
}
\else\hspace*
{
-
\dimexpr\evensidemargin
-
\oddsidemargin
}
\fi
%
}
\title
{
The definitive Guide to Yii 2.0
}
\author
{
Qiang Xue,
Alexander Makarov,
Carsten Brandt,
Klimov Paul
and
many contributors from the Yii community
}
%\setlength{\oddsidemargin}{15.5pt}
%\setlength{\evensidemargin}{15.5pt}
% uncomment for debugging layout issues
%\usepackage{showframe}
\begin{document}
\frontmatter
\begin{titlepage}
% ensure centering the title page by ignoring odd and even margin
\setlength
{
\oddsidemargin
}{
-1in
}
\setlength
{
\evensidemargin
}{
-1in
}
\setlength
{
\textwidth
}{
\paperwidth
}
\vspace*
{
\fill
}
% typesetting the title line
\noindent
\parbox
{
\textwidth
}{
\centering
\bfseries
\Huge
The Definitive Guide
}
\vspace
{
.5cm
}
\parbox
{
\textwidth
}{
\centering
\bfseries
\Huge
to
}
\vspace
{
.5cm
}
\parbox
{
\textwidth
}{
\centering
\bfseries
\Huge
Yii 2.0
}
\vfill
% typesetting authors
\noindent
\parbox
{
\textwidth
}{
\centering
\Large
Qiang Xue,
\\
Alexander Makarov,
\\
Carsten Brandt,
\\
Klimov Paul
\\
and
\\
the Yii community
}
\vspace*
{
\fill
}
\noindent
\parbox
{
\textwidth
}{
\centering
Copyright 2014 Yii Software LLC.
}
\end{titlepage}
%Take a blank Page
\pagebreak
\thispagestyle
{
empty
}
\cleardoublepage
\setcounter
{
tocdepth
}{
1
}
\tableofcontents
\mainmatter
\include
{
guide
}
\end{document}
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