Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/docs
diff options
context:
space:
mode:
authorAlex Rønne Petersen <alpeters@microsoft.com>2017-11-22 14:26:51 +0300
committerAlex Rønne Petersen <alpeters@microsoft.com>2017-11-23 16:16:03 +0300
commit528e793ce395474ba116ecd9610fe04c959e3e57 (patch)
tree37a813e76a49cfe8cd8a5671e1e3f337ef4aca64 /docs
parentaa19b6aa18ec730c8cb4294ad3218308f72a1e3b (diff)
[exdoc] Support Doxygen-style code blocks.
This doesn't support the full syntax, but it's enough for our needs.
Diffstat (limited to 'docs')
-rw-r--r--docs/api-style.css10
-rw-r--r--docs/exdoc15
2 files changed, 23 insertions, 2 deletions
diff --git a/docs/api-style.css b/docs/api-style.css
index 1f6483919cf..f8f9c27a4ab 100644
--- a/docs/api-style.css
+++ b/docs/api-style.css
@@ -43,6 +43,16 @@
line-height: 0px;
}
+ .mapi-codeblock {
+ display: block;
+ padding: 5pt 5pt;
+ margin: 10pt;
+ white-space: pre;
+ font-family: monospace;
+ border: 1px solid rgba(233,233,233,1);
+ background-color: rgba(249,249,249,1);
+ }
+
.mapi-entry code {
border: none;
background-color: transparent;
diff --git a/docs/exdoc b/docs/exdoc
index 38321c19c8b..38f1cc5e1b1 100644
--- a/docs/exdoc
+++ b/docs/exdoc
@@ -124,6 +124,7 @@ sub process_function {
my $body = '';
my $returns = '';
my $prototype = '';
+ my $codeblock = 'false';
while (<$file>) {
@@ -180,8 +181,16 @@ sub process_function {
chomp;
s/^ +\*//;
- # Replace blank lines with paragraph breaks.
- $_ = '<p>' if /^\s*$/;
+ if (/\s*\\code$/) {
+ $codeblock = 'true';
+ } elsif (/\s*\\endcode$/) {
+ $codeblock = 'false';
+ }
+
+ # Replace blank lines with paragraph breaks if we're not in a code block.
+ if (/^\s*$/) {
+ $_ = '<p>' if $codeblock eq 'false';
+ }
if ($section == $PARAMETER_SECTION) {
if (/\s*\\param +(\w+)(.*)/) {
@@ -249,6 +258,8 @@ sub process_formatting {
warn "$file_path:$current_line: Old-style monodoc notation '`code`' used\n"
if s{\`((?!api:)[:.\w\*]+)\`}{<code>$1</code>}g && $WARNINGS;
s{\\c +(\S+(?<![.,:;]))}{<code>$1</code>}g;
+ s{\\code}{<pre><code class="mapi-codeblock">}g;
+ s{\\endcode}{</code></pre>}g;
$$content = $_;
}