CI / go (Media) (push) Successful in 13m40s
CI / go (Server) (push) Failing after 23m20s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 10m35s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / desktop (ubuntu-latest) (push) Failing after 3h4m42s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
CI / mobile (push) Failing after 9m19s
CI / docker (push) Successful in 2h2m57s
- Columns: /columns puts 2 to 4 columns side by side, with widths dragged between them; they stack on phones. HTML export and import keep them (also Notion column lists and Confluence page layouts). - Suggesting mode: edits become suggested insertions and deletions that editors accept or reject one by one or all at once. Text only. - Verified pages: editors verify a page for a while or without end; the verifier is notified when it runs out (migration 1764700000). - Scanned PDFs attached to pages are read by AI for search where a workspace turns it on. - The server writes error messages, emails, digests and phone notifications in English, Polish, German, French and Spanish; the apps send their language with each request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.8 KiB
Go
53 lines
1.8 KiB
Go
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
package convert
|
|
|
|
import (
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
func suggestedDoc() Node {
|
|
ins := Mark{Type: markSuggestInsert, Attrs: map[string]any{"id": "s1", "author": "ana", "name": "Ana", "at": 5.0}}
|
|
del := Mark{Type: markSuggestDelete, Attrs: map[string]any{"id": "s2", "author": "ana", "name": "Ana", "at": 6.0}}
|
|
return Node{Type: "doc", Content: []Node{{Type: "paragraph", Content: []Node{
|
|
{Type: "text", Text: "The "},
|
|
{Type: "text", Text: "slow ", Marks: []Mark{ins}},
|
|
{Type: "text", Text: "quick ", Marks: []Mark{del, {Type: "bold"}}},
|
|
{Type: "text", Text: "fox"},
|
|
}}}}
|
|
}
|
|
|
|
func TestSuggestionsRoundTripThroughHTML(t *testing.T) {
|
|
out := HTML(suggestedDoc(), Options{})
|
|
if !strings.Contains(out, `<ins class="dw-suggest-ins" data-suggestion="s1" data-author="ana" data-name="Ana" data-at="5">slow </ins>`) {
|
|
t.Fatalf("html: %s", out)
|
|
}
|
|
back, err := FromHTML(out)
|
|
if err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
p := back.Content[0]
|
|
if len(p.Content) != 4 || !hasMark(p.Content[1], markSuggestInsert) || !hasMark(p.Content[2], markSuggestDelete) || !hasMark(p.Content[2], "bold") {
|
|
t.Fatalf("back: %+v", p.Content)
|
|
}
|
|
if p.Content[1].Marks[0].attr("id") != "s1" || p.Content[1].Marks[0].attr("name") != "Ana" {
|
|
t.Fatalf("attrs: %+v", p.Content[1].Marks)
|
|
}
|
|
// Plain <ins> and <del> stay underline and strikethrough.
|
|
plain, _ := FromHTML("<p><ins>a</ins><del>b</del></p>")
|
|
if !hasMark(plain.Content[0].Content[0], "underline") || !hasMark(plain.Content[0].Content[1], "strike") {
|
|
t.Fatalf("plain: %+v", plain.Content[0].Content)
|
|
}
|
|
}
|
|
|
|
func TestExportsLeaveOpenSuggestionsOut(t *testing.T) {
|
|
md := Markdown(suggestedDoc(), Options{})
|
|
if strings.TrimSpace(md) != "The **quick** fox" {
|
|
t.Fatalf("markdown: %q", md)
|
|
}
|
|
if _, err := DOCX("", suggestedDoc(), DOCXOptions{}); err != nil {
|
|
t.Fatal(err)
|
|
}
|
|
}
|