Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
CMake
CMake
Commits
2c7a05ed
Commit
2c7a05ed
authored
Feb 14, 2003
by
Brad King
Browse files
ENH: Improved formatting of documentation.
parent
04d604ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Source/cmDocumentation.cxx
View file @
2c7a05ed
...
...
@@ -100,7 +100,7 @@ void cmDocumentation::PrintManSection(std::ostream& os,
{
os
<<
".TP
\n
"
<<
".B "
<<
op
->
name
<<
"
\n
"
<<
op
->
brief
<<
"
\n
"
;
<<
op
->
brief
<<
"
\n
\n
"
;
if
(
op
->
full
)
{
os
<<
op
->
full
<<
"
\n
"
;
}
}
else
...
...
@@ -126,6 +126,7 @@ void cmDocumentation::PrintHelpSection(std::ostream& os,
if
(
op
->
full
)
{
os
<<
"
\n
"
<<
"
\n
"
<<
" "
;
this
->
PrintColumn
(
os
,
70
,
" "
,
op
->
full
);
}
...
...
@@ -148,6 +149,7 @@ void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text)
{
"<"
,
"<"
,
0
},
{
">"
,
">"
,
0
},
{
"&"
,
"&"
,
0
},
{
"
\n
"
,
"<br>"
,
0
},
{
0
,
0
,
0
}
};
for
(
const
char
*
p
=
text
;
*
p
;
++
p
)
...
...
@@ -168,6 +170,50 @@ void cmDocumentation::PrintHTMLEscapes(std::ostream& os, const char* text)
}
}
//----------------------------------------------------------------------------
void
cmDocumentation
::
PrintHTMLFull
(
std
::
ostream
&
os
,
const
char
*
text
)
{
const
char
*
line
=
text
;
while
(
*
line
)
{
// Any lines starting in a space are treated as a preformatted
// section.
std
::
string
preformatted
;
while
(
*
line
==
' '
)
{
for
(
char
ch
=
*
line
;
ch
&&
ch
!=
'\n'
;
++
line
,
ch
=
*
line
)
{
preformatted
.
append
(
1
,
ch
);
}
if
(
*
line
)
{
++
line
;
preformatted
.
append
(
1
,
'\n'
);
}
}
if
(
preformatted
.
length
())
{
os
<<
"<pre>"
;
this
->
PrintHTMLEscapes
(
os
,
preformatted
.
c_str
());
os
<<
"</pre>"
;
}
std
::
string
normal
;
for
(
char
ch
=
*
line
;
ch
&&
ch
!=
'\n'
;
++
line
,
ch
=
*
line
)
{
normal
.
append
(
1
,
ch
);
}
if
(
*
line
)
{
++
line
;
normal
.
append
(
1
,
'\n'
);
}
if
(
normal
.
length
())
{
this
->
PrintHTMLEscapes
(
os
,
normal
.
c_str
());
}
}
}
//----------------------------------------------------------------------------
void
cmDocumentation
::
PrintHelpHTMLSection
(
std
::
ostream
&
os
,
const
cmDocumentationEntry
*
section
,
...
...
@@ -192,8 +238,8 @@ void cmDocumentation::PrintHelpHTMLSection(std::ostream& os,
this
->
PrintHTMLEscapes
(
os
,
op
->
brief
);
if
(
op
->
full
)
{
os
<<
"
"
;
this
->
PrintHTML
Escapes
(
os
,
op
->
full
);
os
<<
"
<br>
"
;
this
->
PrintHTML
Full
(
os
,
op
->
full
);
}
os
<<
"
\n
"
;
os
<<
" </li>
\n
"
;
...
...
@@ -332,7 +378,13 @@ void cmDocumentation::PrintColumn(std::ostream& os, int width,
const
char
*
l
=
text
;
int
column
=
0
;
bool
newSentence
=
false
;
bool
first
=
true
;
bool
firstLine
=
true
;
// Count leading blanks in the text.
int
blanks
=
0
;
for
(
const
char
*
b
=
l
;
*
b
==
' '
;
++
b
)
{
++
blanks
;
}
// Loop until the end of the text.
while
(
*
l
)
{
// Parse the next word.
...
...
@@ -364,7 +416,16 @@ void cmDocumentation::PrintColumn(std::ostream& os, int width,
{
// First word on line. Print indentation unless this is the
// first line.
os
<<
(
first
?
""
:
indent
);
os
<<
(
firstLine
?
""
:
indent
);
// Further indent by leading blanks from the text on this
// line.
for
(
int
i
=
0
;
i
<
blanks
;
++
i
)
{
os
<<
" "
;
++
column
;
}
blanks
=
0
;
}
// Print the word.
...
...
@@ -378,7 +439,10 @@ void cmDocumentation::PrintColumn(std::ostream& os, int width,
os
<<
"
\n
"
;
++
r
;
column
=
0
;
first
=
false
;
firstLine
=
false
;
// Count leading blanks in the text.
for
(
const
char
*
b
=
r
;
*
b
==
' '
;
++
b
)
{
++
blanks
;
}
}
else
{
...
...
@@ -390,7 +454,7 @@ void cmDocumentation::PrintColumn(std::ostream& os, int width,
{
// Word does not fit on this line. Start a new line.
os
<<
"
\n
"
;
first
=
false
;
first
Line
=
false
;
if
(
r
>
l
)
{
os
<<
indent
;
...
...
Source/cmDocumentation.h
View file @
2c7a05ed
...
...
@@ -49,6 +49,7 @@ private:
const
char
*
name
);
void
PrintHelpSection
(
std
::
ostream
&
os
,
const
cmDocumentationEntry
*
section
);
void
PrintHTMLEscapes
(
std
::
ostream
&
os
,
const
char
*
text
);
void
PrintHTMLFull
(
std
::
ostream
&
os
,
const
char
*
text
);
void
PrintHelpHTMLSection
(
std
::
ostream
&
os
,
const
cmDocumentationEntry
*
section
,
const
char
*
header
);
...
...
Write
Preview
Supports
Markdown
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