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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Docx to Native] Support landscape during the convertion with another extension #8054

Closed
fsoedjede opened this issue May 2, 2022 · 1 comment

Comments

@fsoedjede
Copy link
Sponsor

Hello,
Thanks for developing this tool.

Describe your proposed improvement and the problem it solves.

I would like to know if it's possible to support keeping landscape when converting docx to native.

Currently, when converting from Docx to native, there is no way to keep the information.

In my use case, the docx editor cannot have access to the markdown file. That's why I'm asking here.

Docx example : test-landscape.docx

Current output

Native output with command pandoc --from=docx --to=native --output=test-landscape.native test-landscape.docx:

[ Header
    2
    ( "test-document-for-landscape" , [] , [] )
    [ Str "Test"
    , Space
    , Str "document"
    , Space
    , Str "for"
    , Space
    , Str "landscape"
    ]
, Header
    3
    ( "page-not-in-landscape" , [] , [] )
    [ Str "Page"
    , Space
    , Str "not"
    , Space
    , Str "in"
    , Space
    , Str "landscape"
    ]
, Para [ Str "Pellentesque" , Space , Str "\8230" ]
, Header
    3
    ( "page-in-landscape" , [] , [] )
    [ Str "Page" , Space , Str "in" , Space , Str "landscape" ]
, Para
    [ Str "Lorem" , Space , Str "ipsum" , Space , Str "\8230" ]
, Header
    3
    ( "page-not-in-landscape-1" , [] , [] )
    [ Str "Page"
    , Space
    , Str "not"
    , Space
    , Str "in"
    , Space
    , Str "landscape"
    ]
, Para [ Str "Vivamus" , Space , Str "\8230" ]
]

Markdown output with command pandoc --from=docx --to=markdown --output=test-landscape.md test-landscape.docx:

## Test document for landscape

### Page not in landscape

Pellentesque ...

### Page in landscape

Lorem ipsum ...

### Page not in landscape

Vivamus ...

Proposal

We could use fenced_divs to do this.

Native output will be:

[ Header
    2
    ( "test-document-for-landscape" , [] , [] )
    [ Str "Test"
    , Space
    , Str "document"
    , Space
    , Str "for"
    , Space
    , Str "landscape"
    ]
, Header
    3
    ( "page-not-in-landscape" , [] , [] )
    [ Str "Page"
    , Space
    , Str "not"
    , Space
    , Str "in"
    , Space
    , Str "landscape"
    ]
, Para [ Str "Pellentesque" , Space , Str "\8230" ]
, Div
    ( "" , [ "landscape" ] , [] )
    [ Header
        3
        ( "page-in-landscape" , [] , [] )
        [ Str "Page" , Space , Str "in" , Space , Str "landscape" ]
    , Para
        [ Str "Lorem" , Space , Str "ipsum" , Space , Str "\8230" ]
    ]
, Header
    3
    ( "page-not-in-landscape-1" , [] , [] )
    [ Str "Page"
    , Space
    , Str "not"
    , Space
    , Str "in"
    , Space
    , Str "landscape"
    ]
, Para [ Str "Vivamus" , Space , Str "\8230" ]
]

Markdown output will be:

## Test document for landscape

### Page not in landscape

Pellentesque ...

:::landscape
### Page in landscape

Lorem ipsum ...
:::

### Page not in landscape

Vivamus ...

As this may break things for some users, I suggest we add a new extension named landscape (for example)
which enables this change.

Describe alternatives you've considered.

I don't see another way to keep the information from docx to native.

With my current knowledge of lua filters, It's not possible to use them to keep information from Docx to native.

I'm open if you have any suggestion if it's not possible to do it like I suggest

@mb21
Copy link
Collaborator

mb21 commented May 7, 2022

From https://pandoc.org/MANUAL.html#description

Pandoc attempts to preserve the structural elements of a document, but not formatting details such as margin size

... or pages or whether a page is in landscape or portrait.

Thus this is out of scope for pandoc.

@mb21 mb21 closed this as completed May 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants