nyyManni / ejira

Emacs JIRA integration
GNU General Public License v3.0
255 stars 36 forks source link

Add {noformat} to parser #46

Open d-miketa opened 2 years ago

d-miketa commented 2 years ago

Hi and thanks for all your work on this plugin!

One small and easily fixable bug I've noticed is the lack of treatment of {noformat} (https://jira.atlassian.com/browse/CONFCLOUD-68503) in text fields. In the meantime I've fixed it on my end with

(push
   '("^{noformat}\\(.*\\(?:
.*\\)*?\\)?
?{noformat}"
    . (lambda ()
        (let ((body (match-string 1))
              (md (match-data)))
          (prog1
              (concat
               "#+BEGIN_SRC\n"
               (replace-regexp-in-string "^" "  " body)
               "\n#+END_SRC")

            ;; Auto-detecting language alters match data, restore it.
            (set-match-data md)))))
   ejira-parser-patterns)

which is just a straightforward adaptation of your existing code for {quote} blocks.

nyyManni commented 2 years ago

Hi and thanks for the feedback!

Handling {noformat} is indeed missing from the current parser. However, it might not be the best option to map it into a #+BEGIN_SRC -block, since if one wants to modify the description via the org-file and push the changes back to JIRA, those {noformat}-blocks will permanently become {code}-blocks.

Some other block from org-mode could be used with {noformat} instead, though.

d-miketa commented 2 years ago

Ah, I see, and that did not occur to me. I’ve swapped to BEGIN_EXAMPLE for now.