-
Notifications
You must be signed in to change notification settings - Fork 0
/
object.go
46 lines (31 loc) · 992 Bytes
/
object.go
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
package main
import (
"fmt"
"golang.org/x/net/html"
"github.com/PuerkitoBio/goquery"
)
/*
this file was dedicated to try to guess find a user-predefined sequence that is part of the context of an image/table ie. captions or
a title but yet not properly defined through HTML tags.
It needs instruction that are tailored made to how figures appear in the document and therefore was full of hardcoded stuff.
Need rewriting from scratch
*/
type ObjectT struct {
Type, Origin string
PosRefNode, Scope int
Nodes []*html.Node
Selec *goquery.Selection
}
/*
UsingRef <table> (NODE) || <div> title (NODE)
FromSuperior <table> (NODE) || <img> (NODE)
InlineCaptionInspector <div> caption (NODE)
InIMGCaptionInspector <img> (NODE)
*/
func (Object ObjectT) Fmt() (str string) {
str = fmt.Sprintf("<section class=\"capillary\" origin=\"%s\" scope=\"%d\">", Object.Origin, Object.Scope)
tmp, _ := goquery.OuterHtml(Object.Selec)
str += tmp
str += "</section>\n\n"
return
}