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; } static L<L<S>> rawTextFromODT_groupParagraphs(L<S> lines) { ret groupNonEmpty(lines, func(S line) { empty(line) }); }
Began life as a copy of #1005092
download show line numbers debug dex old transpilations
Travelled to 14 computer(s): aoiabmzegqzx, bhatertpkbcr, cbybwowwnfue, cfunsshuasjs, ddnzoavkxhuk, gwrvuhgaqvyk, ishqpsrjomds, lpdgvwnxivlt, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tslmcundralx, tvejysmllsmz, vouqrxazstgt
No comments. add comment
Snippet ID: | #1005101 |
Snippet name: | rawTextFromODT |
Eternal ID of this version: | #1005101/1 |
Text MD5: | 177340e4330c0cfa301ee0b695d4198a |
Author: | stefan |
Category: | javax / loading / a.i. |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2016-10-16 17:24:55 |
Source code size: | 979 bytes / 30 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 505 / 526 |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) |