Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

Editing Snippet ID: #1005101
Snippet name:
Category, Type:
Content:
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
static L<S> rawTextFromODT(File odt) {
  // unwrapContainerTags makes editable lists
  L<L<S>> paragraphs = unwrapContainerTags(paragraphsFromODT(odt));
  
  paragraphs = map(paragraphs, func(L<S> p) {
    dropListPrefix(p, "", "<text:soft-page-break/>")
  });
  
  for i over paragraphs: {
    L<S> p = paragraphs.get(i);
    int idx;
    while ((idx = p.indexOf("<text:line-break/>")) >= 0) {
      paragraphs.add(i+1, newSubList(p, idx+1));
      removeSubList(p, 0, idx+1);
    }
  }
  
  // nb: we might need to remove formatting if user used any
  // (not doing that yet)
  L<S> lines = map(paragraphs, func(L<S> p) { join(" # ", p) });
  lines = map(lines, func(S s) { trim(htmldecode(s)) });
  
  paragraphs = rawTextFromODT_groupParagraphs(lines);
  lines = map(paragraphs, func(L<S> p) { fromLines(p) });
  ret lines;
}
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Comment:
Public (visible to everyone):
Created: 2016-10-16 17:24:55

This page without fancy editor.