diff options
| author | Shulhan <ms@kilabit.info> | 2022-07-17 17:33:48 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2022-07-17 17:33:48 +0700 |
| commit | 5a88e6cc970c315958d044d78e776a3b02bc0c14 (patch) | |
| tree | 5bff7241f4121095bf004010e183f5ceb3daa038 /document_parser.go | |
| parent | 62d968c8aef49e2ce4fd476e5518c1a8fae26e96 (diff) | |
| download | asciidoctor-go-5a88e6cc970c315958d044d78e776a3b02bc0c14.tar.xz | |
all: move Parse and parse functions to document
Since the Parse return a *Document it should grouped into document.go
to make the code consistent.
Diffstat (limited to 'document_parser.go')
| -rw-r--r-- | document_parser.go | 27 |
1 files changed, 0 insertions, 27 deletions
diff --git a/document_parser.go b/document_parser.go index 9992d75..608b95c 100644 --- a/document_parser.go +++ b/document_parser.go @@ -6,7 +6,6 @@ package asciidoctor import ( "bytes" "fmt" - "strconv" "github.com/shuLhan/share/lib/debug" ) @@ -19,13 +18,6 @@ type documentParser struct { kind int } -// Parse the content into a Document. -func Parse(content []byte) (doc *Document) { - doc = newDocument() - parse(doc, content) - return doc -} - func newDocumentParser(doc *Document, content []byte) (docp *documentParser) { docp = &documentParser{ doc: doc, @@ -37,25 +29,6 @@ func newDocumentParser(doc *Document, content []byte) (docp *documentParser) { return docp } -func parse(doc *Document, content []byte) { - var ( - docp *documentParser = newDocumentParser(doc, content) - - sectLevel string - ok bool - ) - - docp.parseHeader() - docp.doc.postParseHeader() - - sectLevel, ok = doc.Attributes[metaNameSectNumLevel] - if ok { - doc.sectLevel, _ = strconv.Atoi(sectLevel) - } - - docp.parseBlock(doc.preamble, 0) -} - func parseSub(parentDoc *Document, content []byte) (subdoc *Document) { var ( docp *documentParser |
