mirror of
https://github.com/documize/community.git
synced 2025-08-02 20:15:26 +02:00
wip
This commit is contained in:
parent
7db618dea0
commit
4a17acce11
19 changed files with 322 additions and 203 deletions
|
@ -94,11 +94,12 @@ func GetLinkCandidates(w http.ResponseWriter, r *http.Request) {
|
|||
|
||||
for _, f := range files {
|
||||
c := entity.LinkCandidate{
|
||||
RefID: util.UniqueID(),
|
||||
DocumentID: documentID,
|
||||
AttachmentID: f.RefID,
|
||||
LinkType: "file",
|
||||
Title: f.Filename,
|
||||
RefID: util.UniqueID(),
|
||||
DocumentID: documentID,
|
||||
AttachmentID: f.RefID,
|
||||
LinkType: "file",
|
||||
Title: f.Filename,
|
||||
AttachmentExtension: f.Extension,
|
||||
}
|
||||
|
||||
fc = append(fc, c)
|
||||
|
|
|
@ -346,23 +346,25 @@ type SitemapDocument struct {
|
|||
// Link defines a reference between a section and another document/section/attachment.
|
||||
type Link struct {
|
||||
BaseEntity
|
||||
OrgID string `json:"orgId"`
|
||||
UserID string `json:"userId"`
|
||||
SourceID string `json:"sourceId"`
|
||||
DocumentID string `json:"documentId"`
|
||||
PageID string `json:"pageId"`
|
||||
LinkType string `json:"linkType"`
|
||||
Orphan bool `json:"orphan"`
|
||||
OrgID string `json:"orgId"`
|
||||
UserID string `json:"userId"`
|
||||
LinkType string `json:"linkType"`
|
||||
SourceID string `json:"sourceId"`
|
||||
DocumentID string `json:"documentId"`
|
||||
PageID string `json:"pageId"`
|
||||
AttachmentID string `json:"attachmentId"`
|
||||
Orphan bool `json:"orphan"`
|
||||
}
|
||||
|
||||
// LinkCandidate defines a potential link to a document/section/attachment.
|
||||
type LinkCandidate struct {
|
||||
RefID string `json:"id"`
|
||||
OrgID string `json:"orgId"`
|
||||
DocumentID string `json:"documentId"`
|
||||
PageID string `json:"pageId"`
|
||||
AttachmentID string `json:"attachmentId"`
|
||||
LinkType string `json:"linkType"`
|
||||
Title string `json:"title"` // what we label the link
|
||||
Context string `json:"context"` // additional context (e.g. excerpt, parent)
|
||||
RefID string `json:"id"`
|
||||
OrgID string `json:"orgId"`
|
||||
LinkType string `json:"linkType"`
|
||||
DocumentID string `json:"documentId"`
|
||||
PageID string `json:"pageId"`
|
||||
AttachmentID string `json:"attachmentId"`
|
||||
AttachmentExtension string `json:"attachmentExtension"`
|
||||
Title string `json:"title"` // what we label the link
|
||||
Context string `json:"context"` // additional context (e.g. excerpt, parent)
|
||||
}
|
||||
|
|
|
@ -136,3 +136,30 @@ func (p *Persister) DeleteLink(id string) (rows int64, err error) {
|
|||
//
|
||||
// return
|
||||
// }
|
||||
//
|
||||
// package main
|
||||
//
|
||||
// import (
|
||||
// "fmt"
|
||||
// "regexp"
|
||||
// )
|
||||
//
|
||||
// var imgRE = regexp.MustCompile(`<a[^>]+\bhref=["']([^"']+)["']`)
|
||||
//
|
||||
// func findImages(htm string) []string {
|
||||
// imgs := imgRE.FindAllStringSubmatch(htm, -1)
|
||||
// out := make([]string, len(imgs))
|
||||
// for i := range out {
|
||||
// out[i] = imgs[i][1]
|
||||
// }
|
||||
// return out
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// fmt.Printf("%q", findImages(data))
|
||||
// }
|
||||
//
|
||||
// const data = `
|
||||
// <p>dfdfdf</p><a href="/link/section/34354"><x><z?>
|
||||
// <a czx zcxz href='/link/file/file.exe'><x><z?>
|
||||
// `
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue