4using System.Threading.Tasks;
37 public string[]
ToContentTypes =>
new string[] { HtmlCodec.DefaultContentType };
53 using (StreamReader rd =
new StreamReader(State.
From))
55 Htmlx = await rd.ReadToEndAsync();
61 if (!
string.IsNullOrEmpty(
Head))
74 switch (E.LocalName.ToUpper())
77 string Rel = E.GetAttribute(
"rel");
78 if (Rel ==
"stylesheet")
80 string HRef = E.GetAttribute(
"href");
82 if (!
string.IsNullOrEmpty(HRef))
85 new KeyValuePair<string, string>(
"as",
"style"));
91 string Type = E.GetAttribute(
"type");
94 string Src = E.GetAttribute(
"src");
96 if (!
string.IsNullOrEmpty(Src))
99 new KeyValuePair<string, string>(
"as",
"script"));
124 await State.
To.WriteAsync(
Data, 0,
Data.Length);
125 State.ToContentType +=
"; charset=utf-8";
151 return Convert(Htmlx,
null, Session, FileName,
true);
166 return CssxToCss.
Convert(Htmlx,
"{{",
"}}", State, Session, FileName, LockSession);
Contains the state of a content conversion process.
Variables Session
Session states.
bool HasError
If an error should be returned.
Stream To
Stream pointing to where binary representation of content is to be sent.
string FromFileName
If the content is coming from a file, this parameter contains the name of that file....
ICodecProgress Progress
Optional interface for reporting progress during conversion.
Stream From
Stream pointing to binary representation of content.
static string GetHead(string Html)
Extracts the contents of the HEAD element in a HTML string.
Head Head
First HEAD element of document, if found, null otherwise.
Base class for all HTML elements.
bool HasChildren
If the element has children.
IEnumerable< HtmlNode > Children
Child nodes, or null if none.
Base class for all HTML nodes.
JavaScript encoder/decoder.
const string DefaultContentType
application/javascript
Static class managing the application event log. Applications and services log events on this static ...
static void Exception(Exception Exception, string Object, string Actor, string EventId, EventLevel Level, string Facility, string Module, params KeyValuePair< string, object >[] Tags)
Logs an exception. Event type will be determined by the severity of the exception.
Converts CSSX-files to CSS, by evaluating emebedded script and replacing it with results.
static Task< string > Convert(string Cssx, ConversionState State, string FileName)
Converts CSSX to CSS, using the current theme
Converts HTMLX-files to HTML, by evaluating emebedded script and replacing it with results.
async Task< bool > ConvertAsync(ConversionState State)
Performs the actual conversion.
Grade ConversionGrade
How well the content is converted.
static Task< string > Convert(string Htmlx, Variables Session, string FileName)
Converts HTMLX to HTML, using the current theme
string[] FromContentTypes
Converts content from these content types.
HtmlxToHtml()
Converts HTMLX-files to HTML, by evaluating emebedded script and replacing it with results.
static Task< string > Convert(string Htmlx, ConversionState State, string FileName)
Converts HTMLX to HTML, using the current theme
string[] ToContentTypes
Converts content to these content types.
Static class managing binary representations of strings.
static Encoding Utf8WithBom
UTF-8 encoding with Byte Order Mark (BOM)
Task HeaderProcessed()
Called when the header has been processed.
Task EarlyHint(string Resource, string Relation, params KeyValuePair< string, string >[] AdditionalParameters)
Reports an early hint of a resource the recipient may need to process, in order to be able to process...
Task BodyProcessed()
Called when the body has been processed.
Basic interface for Internet Content encoders. A class implementing this interface and having a defau...