SourceFormat Type
Provides a base implementation for all code formatters.
To display the formatted code on your web site, the web page must refer to a stylesheet that defines the formatting for the different CSS classes generated by CSharpFormat: .csharpcode, pre, .rem, .kwrd, .str, .op, .preproc, .alt, .lnum.
Note that if you have multi-line comments in your source code (like /* ... */), the "line numbers" or "alternate line background" options will generate code that is not strictly HTML 4.01 compliant. The code will still look good with IE5+ or Mozilla 0.8+.
Constructors
Constructor |
Description
|
Full Usage:
SourceFormat()
|
|
Instance members
Instance member |
Description
|
Full Usage:
this.Alternate
|
Enables or disables alternating line background. |
Full Usage:
this.CodeRegex
|
The regular expression used to capture language tokens. |
Full Usage:
this.EmbedStyleSheet
|
Enables or disables the embedded CSS style sheet. |
Full Usage:
this.FormatCode
Parameters:
Stream
-
Source code stream.
Returns: string
A string containing the HTML formatted code.
|
Transforms a source code stream to HTML 4.01.
|
Full Usage:
this.FormatCode
Parameters:
string
Returns: string
A string containing the HTML formatted code.
|
Transforms a source code string to HTML 4.01.
|
Full Usage:
this.FormatSubCode
Parameters:
string
Returns: string
|
Allows formatting a part of the code in a different language, for example a JavaScript block inside an HTML file.
|
Full Usage:
this.LineNumbers
|
Enables or disables line numbers in output. |
Full Usage:
this.TabSpaces
|
Gets or sets the tabs width. |
Static members
Static member |
Description
|
Full Usage:
SourceFormat.EscapeHtml(str, tabSpaces)
Parameters:
string
tabSpaces : int
Returns: string
|
TBD
|
|
|
Full Usage:
SourceFormat.GetCssString()
Returns: string
A string containing the CSS definitions.
|
Gets the CSS stylesheet as a string.
|