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

* There is no abstract outputed into docx with command option "--metadata=abstract:METADATA"? #4900

Closed
mgcyung opened this issue Sep 14, 2018 · 11 comments · Fixed by #4905
Closed

Comments

@mgcyung
Copy link

mgcyung commented Sep 14, 2018

The command option "--metadata=toc-title:toc" works fine. But there is no abstract outputed into docx with command option "--metadata=abstract:METADATA".

@mb21
Copy link
Collaborator

mb21 commented Sep 14, 2018

What version of pandoc are you using? Can you provide exact command?

@mgcyung
Copy link
Author

mgcyung commented Sep 14, 2018 via email

@mb21
Copy link
Collaborator

mb21 commented Sep 14, 2018

Ah, this is because when setting metadata with the command line, the values are strings, instead of MetaBlocks or MetaInlines. We could quickly fix this case by considering this case in https://github.com/jgm/pandoc/blob/master/src/Text/Pandoc/Writers/Docx.hs#L763

But more generally, we should probably solve this as part of #1960.

@jgm, should I try to rebase #4604?

@mgcyung
Copy link
Author

mgcyung commented Sep 14, 2018

As string abstract in command line can not be identified, is there a way to set the abstract in the orgmode file?

@mb21
Copy link
Collaborator

mb21 commented Sep 14, 2018

Not that I know of... for your usecase, I would just put the abstract in the body text... that's effectively what the docx writer does as well. If you need the proper style, see http://pandoc.org/MANUAL.html#custom-styles-in-docx

@mgcyung
Copy link
Author

mgcyung commented Sep 14, 2018 via email

@mb21
Copy link
Collaborator

mb21 commented Sep 14, 2018

Ah, I'm not sure how to do that in org-mode... @tarleb ?

@jgm
Copy link
Owner

jgm commented Sep 14, 2018

@mb21 - yes, we should fix this in the Docx writer (as you identified). And go ahead and rebase #4604!

@tarleb
Copy link
Collaborator

tarleb commented Sep 14, 2018

Incidentally, somebody recently asked a question on how to add an abstract in the ox-pandoc project. TL;DR: either set it via #+ABSTRACT: or use a (Lua) filter.

@mgcyung
Copy link
Author

mgcyung commented Sep 15, 2018

The lua filter works for me. Thanks.

@mgcyung mgcyung closed this as completed Sep 15, 2018
@mgcyung
Copy link
Author

mgcyung commented Sep 15, 2018

A little change to the filter in Org Abstract Block Export to make it identify more than one abstract

-- file: abstract-div-to-meta.lua
local abstract = {}

function Div (div)
   if div.classes:includes 'ABSTRACT' then
      if abstract == {} then
         abstract = div.content
      else
         for i=1,#div.content do
            abstract[#abstract+1] = div.content[i]
         end
      end
    return {}
  end
end

function Meta (meta)
  meta.abstract = pandoc.MetaBlocks(abstract)
  return meta
end

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

Successfully merging a pull request may close this issue.

4 participants