[ 
https://issues.apache.org/jira/browse/COR-11?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14314661#comment-14314661
 ] 

Peter Kelly commented on COR-11:
--------------------------------

The workflow you've described is pretty close. Here's the steps taken when 
editing a .docx file in UX Write:

1. DocFormats converts d1.docx to d1.html
2. User edits the HTML file (in the JS editor), and saves to d2.html
3. DocFormats creates a new file d2.docx, based on the content of d1.docx and 
d2.html

Step 3 is really the hard part. Conceptually what it does is re-create d1.html, 
and recurse through the DOM tree figuring out what has changed, and then 
translating those changes to equivalent transformations to the .docx XML files.

In practice it isn't so clean; the change detection and application of those 
translations in a docx-specific manner are intertwined extremely closely right 
now. The ODF filter, if implemented according to the same technique, would have 
to repeat the same work. Additionally, change detection depends heavily on the 
presence of id attributes in the d1.html and d2.html to infer "alignment" - 
that is, which elements correspond to each other in the two files.

What I'd embarked on a few weeks ago was an attempt to separate the change 
detection out of the docx filter, so that we could have a "list of changes" 
data structure (basically a diff). Each filter would then take the list of 
changes as a parameter, rahter than an update a document. So then the 
instructions it would get would be things like "delete paragraph 4", and "make 
the third word of the last paragraph bold". Once presented with these changes, 
a given filter would work out how to do those things in a suitable manner for 
the file format in question.

The change detection problem however is quite tricky. This is kind of getting 
off-topic for this thread so I'll write more about this separately shortly.

> Make interface between docformat and webkit (prepare for e.g. Qt).
> ------------------------------------------------------------------
>
>                 Key: COR-11
>                 URL: https://issues.apache.org/jira/browse/COR-11
>             Project: Corinthia
>          Issue Type: New Feature
>          Components: DocFormats - API
>         Environment: source
>            Reporter: jan iversen
>            Priority: Blocker
>             Fix For: 0.5
>
>
> We need a API to the library



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to