aboutsummaryrefslogtreecommitdiff
path: root/document.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2024-10-13 23:50:54 +0700
committerShulhan <ms@kilabit.info>2024-10-13 23:50:54 +0700
commit37563af4c7e82fab352f4ab9137f808058e483e2 (patch)
treee1758abaf802d1e94aad393e71c9b0b5fd0ede37 /document.go
parent013bf4d56baf977244c670a77048ca6d946c1f56 (diff)
downloadasciidoctor-go-37563af4c7e82fab352f4ab9137f808058e483e2.tar.xz
all: fix reading include file when parent path is absolute
Previously, if the parent document is opened using absolute path and it contains include directive, the included file will fail to read because the parent path is joined with current working directory.
Diffstat (limited to 'document.go')
-rw-r--r--document.go8
1 files changed, 0 insertions, 8 deletions
diff --git a/document.go b/document.go
index 78eea2a..cfa3eeb 100644
--- a/document.go
+++ b/document.go
@@ -8,7 +8,6 @@ import (
"fmt"
"io"
"os"
- "path/filepath"
"strconv"
"strings"
"time"
@@ -96,7 +95,6 @@ func newDocument() (doc *Document) {
func Open(file string) (doc *Document, err error) {
var (
fi os.FileInfo
- wd string
raw []byte
)
@@ -110,13 +108,7 @@ func Open(file string) (doc *Document, err error) {
return nil, fmt.Errorf(`Open %s: %w`, file, err)
}
- wd, err = os.Getwd()
- if err != nil {
- return nil, fmt.Errorf(`Open %s: %w`, file, err)
- }
-
doc = newDocument()
- doc.fpath = filepath.Join(wd, file)
doc.file = file
doc.Attributes.Entry[docAttrLastUpdateValue] = fi.ModTime().Round(time.Second).Format(`2006-01-02 15:04:05 Z0700`)