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

Add criticmarkup in pre/post commit #24

Open
kguidonimartins opened this issue Nov 26, 2019 · 0 comments
Open

Add criticmarkup in pre/post commit #24

kguidonimartins opened this issue Nov 26, 2019 · 0 comments
Assignees

Comments

@kguidonimartins
Copy link
Owner

From Noam' gist: https://gist.github.com/noamross/12e67a8d8d1fb71c4669cd1ceb9bbcf9

-- a lua filter for panodoc
-- run pandoc your_word_doc.docx --track-change=all -t markdown --lua-filter=criticmarkup.lua
-- TODO: Detect substitutions in adjacent insertion/deletions
-- TODO: capture whole comment hightlight rather than just start point of comment
function Span(elem)
  if elem.classes[1] and elem.classes[1] == "insertion" then
    local opener = { pandoc.RawInline(FORMAT, "{++ ") }
    local closer = { pandoc.RawInline(FORMAT, " ++}") }
    return opener .. elem.content .. closer
  elseif
    elem.classes[1] and elem.classes[1] == "deletion" then
    local opener = { pandoc.RawInline(FORMAT, "{-- ") }
    local closer = { pandoc.RawInline(FORMAT, " --}") }
    return opener .. elem.content .. closer
  elseif
    elem.classes[1] and elem.classes[1] == "comment-start" then
    if elem.t == nil then
      return pandoc.RawInline(FORMAT, "")
    end
    local opener = { pandoc.RawInline(FORMAT, "{>> ") }
    local closer = { pandoc.RawInline(FORMAT, " ("), pandoc.RawInline(FORMAT, elem.attributes.author), pandoc.RawInline(FORMAT, ")<<}")}
    return opener .. elem.content .. closer
  elseif
    elem.classes[1] and (elem.classes[1] == "comment-end" or elem.classes[1] == "paragraph-insertion") then
    return pandoc.RawInline(FORMAT, "")
  else
    return nil
  end
end
@kguidonimartins kguidonimartins self-assigned this Apr 4, 2020
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

No branches or pull requests

1 participant