1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87
|
using System;
using System.IO;
using System.Text;
using System.Xml;
using System.Collections.Generic;
using Monodoc;
using Monodoc.Generators;
namespace Monodoc.Generators.Html
{
// Input is expected to be already HTML so just return it
public class MonoBook2Html : IHtmlExporter
{
public string CssCode {
get {
return @" h3 {
font-size: 18px;
padding-bottom: 4pt;
border-bottom: 2px solid #dddddd;
}
.api {
border: 1px solid;
padding: 10pt;
margin: 10pt;
}
.api-entry {
border-bottom: none;
font-size: 18px;
}
.prototype {
border: 1px solid;
background-color: #f2f2f2;
padding: 5pt;
margin-top: 5pt;
margin-bottom: 5pt;
}
.header {
border: 1px solid !important;
padding: 0 0 5pt 5pt !important;
margin: 10pt !important;
white-space: pre !important;
font-family: monospace !important;
font-weight: normal !important;
font-size: 1em !important;
}
.code {
border: 1px solid;
padding: 0 0 5pt 5pt;
margin: 10pt;
white-space: pre;
font-family: monospace;
}
";
}
}
public string Export (Stream input, Dictionary<string, string> extraArgs)
{
if (input == null)
return null;
return FromXmlReader (XmlReader.Create (input));
}
public string Export (string input, Dictionary<string, string> extraArgs)
{
if (string.IsNullOrEmpty (input))
return null;
return FromXmlReader (XmlReader.Create (new StringReader (input)));
}
public string FromXmlReader (XmlReader reader)
{
if (!reader.ReadToDescendant ("head"))
return null;
if (!reader.ReadToNextSibling ("body"))
return null;
return reader.ReadInnerXml ();
}
}
}
|