Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Aligning Word output styles to pre-existing Word template? #26

Open
mhGLEIF opened this issue Mar 22, 2017 · 17 comments
Open

Aligning Word output styles to pre-existing Word template? #26

mhGLEIF opened this issue Mar 22, 2017 · 17 comments
Labels

Comments

@mhGLEIF
Copy link

mhGLEIF commented Mar 22, 2017

Thanks for the great work so far! 馃

I need to do one last tweak to the plugin before I can put in into production:

I have a Word template with highly customized styles.

These aren't always the styles used by the DITA-Word converter.

Which angle is best/simplest to start from in order to align them?

Edit the Word template to match whatever heading/numberedlist/bulletlist/emphasis etc. are already mapped in the plugin? Is there a full listing of these I can see?

Or edit some config file in the plugin (if so, which one please?) to match my existing Word setup (it is not too complex, it has numbered headings 1-9, bullet list, normal, I use the default Word HTML Code a lot... and that's almost everything)?

@jelovirt
Copy link
Owner

See https://github.com/jelovirt/com.elovirta.ooxml/wiki/Templates and https://github.com/jelovirt/com.elovirta.ooxml/wiki/Extending

There is no list of element to style mapping. We could add a mapping to the wiki documentation, but the problem is that the listing will quickly become out of date.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

Shouldn't we aim to have a fixed, 1:1 mapping of DITA element --> Word style?

@jelovirt
Copy link
Owner

No, because the mapping is always specific to Word template. We can create mapping from e.g. ul/li -> Bulleted list 1, but then you will have templates that use Company unordered list 1 style for that and you will need to override the default mapping.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

This is a very fair point. I would still welcome a default mapping with a caveat that it will need updating for every user's template - it would give a useful starting point especially for anyone implementing this as a solo project :-)

@jelovirt
Copy link
Owner

A default mapping already exists, but it's just not documented in the wiki, it's only in the stylesheets. Them mapping basically works so that for all structures that have a mapping, that's the one that's used; all other elements will fall back to using the default style.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

Thanks, that's clear; so some DITA elements may have no specific Word style target?

I would propose mapping as much as possible in basic DITA (ideally everything) to one of the default Word styles (no matter how bad ;-) ) just to make it easier for implementers to find something and change it in the publishing pipeline.

@jelovirt
Copy link
Owner

Yes, all elements will map to some style. In most cases it's Body Text for block-level element and and no style for inline-level elements.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

That's the problem :-) I'd like to find a table somewhere with a "comprehensive" (as practical) set of DITA styles that I can just change to fit my local template, rather than have to add new rows.

I'm happy to propose something if it helps...

@jelovirt
Copy link
Owner

We can document the current mapping in the wiki, but like I said, it will be out of date quickly. And, because all styles are read from the Word template, the mapping is always specific to the template. Thus, if you don't use the default template that comes with the plugin, you always have to map DITA structures to styles. So there is no way you can skip that step.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

I think we agree - I don't want to skip the step of mapping, it's just about how to do the mapping.

If there's already a fairly comprehensive mapping (even though it will always be wrong!) I can just edit the existing links instead of creating them from zero.

Maybe I didn't understand correctly?

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

As an implementer it's much less overhead for me to generate a couple of examples, compare the output with the current configs, and modify < - - > test a few times to get the correct setup.

@jelovirt
Copy link
Owner

Yes, I though you were talking about documentation, when you wanted to have a file with the mapping to edit.

You have to create a stylesheet to change the mapping. An example of such a customization should be in the wiki.

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

If most items on either end of the pipeline default to the same thing it's more work to track down what changes to make - but with a default mapping, even if the result is wrong at least it's different...

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

OK, I'lll take a look at the wiki and try to figure it out :-)

@mhGLEIF
Copy link
Author

mhGLEIF commented Mar 22, 2017

I will be honest - I am not understanding how to do this mapping. I can't understand how to read "this DITA element becomes that Word style" in the xsl (sorry!)...

Specifically, I can't find block-style and inline-style in https://github.com/jelovirt/com.elovirta.ooxml/blob/master/docx/word/document.xsl

@jelovirt
Copy link
Owner

jelovirt commented Mar 22, 2017

That file doesn't contain those mappings. See e.g. document.topic.xsl or document.pr-d.xsl

@rahulraykor
Copy link

Can't we do this like:
In topics/sections/paragraph there will be a element which will contain the style id.
If any custom template is used for conversion we can assign that style (specified in dita xml) to the element and if default template is used then we will use the style id's in default template.

Please note the person who is converting the document using template, it should be his responsiblity to make sure that all the styles are present in template he is using.

what is your thinking @jelovirt @mhGLEIF ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants