Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Fix doc comments #256

Merged
merged 1 commit into from
Aug 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 30 additions & 17 deletions lib/parser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,10 @@ import 'src/tokenizer.dart';
import 'src/treebuilder.dart';
import 'src/utils.dart';

/// Parse the [input] html5 document into a tree. The [input] can be
/// a [String], [List<int>] of bytes or an [HtmlTokenizer].
/// Parse an html5 document into a tree.
///
/// The [input] can be a `String`, a `List<int>` of bytes, or an
/// [HtmlTokenizer].
///
/// If [input] is not a [HtmlTokenizer], you can optionally specify the file's
/// [encoding], which must be a string. If specified that encoding will be
Expand All @@ -44,9 +46,12 @@ Document parse(dynamic input,
return p.parse();
}

/// Parse the [input] html5 document fragment into a tree. The [input] can be
/// a [String], [List<int>] of bytes or an [HtmlTokenizer]. The [container]
/// element can optionally be specified, otherwise it defaults to "div".
/// Parse an html5 document fragment into a tree.
///
/// The [input] can be a `String`, a `List<int>` of bytes, or an
/// [HtmlTokenizer].
/// The [container] element can optionally be specified, otherwise it defaults
/// to "div".
///
/// If [input] is not a [HtmlTokenizer], you can optionally specify the file's
/// [encoding], which must be a string. If specified, that encoding will be used,
Expand Down Expand Up @@ -126,8 +131,13 @@ class HtmlParser {
late final _afterAfterBodyPhase = AfterAfterBodyPhase(this);
late final _afterAfterFramesetPhase = AfterAfterFramesetPhase(this);

/// Create an HtmlParser and configure the [tree] builder and [strict] mode.
/// The [input] can be a [String], [List<int>] of bytes or an [HtmlTokenizer].
/// Create and configure an HtmlParser.
///
/// The [input] can be a `String`, a `List<int>` of bytes, or an
/// [HtmlTokenizer].
///
/// The [strict], [tree] builder, and [generateSpans] arguments configure
/// behavior for any type of input.
///
/// If [input] is not a [HtmlTokenizer], you can specify a few more arguments.
///
Expand All @@ -141,16 +151,17 @@ class HtmlParser {
/// automatic conversion of element and attribute names to lower case. Note
/// that standard way to parse HTML is to lowercase, which is what the browser
/// DOM will do if you request `Element.outerHTML`, for example.
HtmlParser(dynamic input,
{String? encoding,
bool parseMeta = true,
bool lowercaseElementName = true,
bool lowercaseAttrName = true,
this.strict = false,
this.generateSpans = false,
String? sourceUrl,
TreeBuilder? tree})
: tree = tree ?? TreeBuilder(true),
HtmlParser(
dynamic input, {
TreeBuilder? tree,
this.strict = false,
this.generateSpans = false,
String? encoding,
bool parseMeta = true,
bool lowercaseElementName = true,
bool lowercaseAttrName = true,
String? sourceUrl,
}) : tree = tree ?? TreeBuilder(true),
tokenizer = input is HtmlTokenizer
? input
: HtmlTokenizer(input,
Expand All @@ -166,6 +177,7 @@ class HtmlParser {
bool get innerHTMLMode => innerHTML != null;

/// Parse an html5 document into a tree.
///
/// After parsing, [errors] will be populated with parse errors, if any.
Document parse() {
innerHTML = null;
Expand All @@ -174,6 +186,7 @@ class HtmlParser {
}

/// Parse an html5 document fragment into a tree.
///
/// Pass a [container] to change the type of the containing element.
/// After parsing, [errors] will be populated with parse errors, if any.
DocumentFragment parseFragment([String container = 'div']) {
Expand Down
2 changes: 1 addition & 1 deletion lib/src/html_input_stream.dart
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class HtmlInputStream {
/// HtmlInputStream(source, [encoding]) -> Normalized stream from source
/// for use by html5lib.
///
/// [source] can be either a [String] or a [List<int>] containing the raw
/// [source] can be either a `String` or a `List<int>` containing the raw
/// bytes.
///
/// The optional encoding parameter must be a string that indicates
Expand Down
2 changes: 1 addition & 1 deletion lib/src/list_proxy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ library;
import 'dart:collection';

abstract class ListProxy<E> extends ListBase<E> {
/// The inner [List<T>] with the actual storage.
/// The proxied list with actual storage.
final List<E> _list = <E>[];

@override
Expand Down