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

Some fixes and extra support #52

Open
wants to merge 4 commits into
base: trunk
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 16 additions & 4 deletions ox-jira.el
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
(diary-sexpexample-block . (lambda (&rest args) (ox-jira--not-implemented 'diary-sexpexample-block)))
(drawer . (lambda (&rest args) (ox-jira--not-implemented 'drawer)))
(dynamic-block . (lambda (&rest args) (ox-jira--not-implemented 'dynamic-block)))
(entity . (lambda (&rest args) (ox-jira--not-implemented 'entity)))
(entity . ox-jira-entity)
(example-block . ox-jira-example-block)
(export-block . (lambda (&rest args) (ox-jira--not-implemented 'export-block)))
(export-snippet . (lambda (&rest args) (ox-jira--not-implemented 'export-snippet)))
Expand All @@ -119,7 +119,7 @@
(keyword . (lambda (&rest args) ""))
(latex-environment . (lambda (&rest args) (ox-jira--not-implemented 'latex-environment)))
(latex-fragment . (lambda (&rest args) (ox-jira--not-implemented 'latex-fragment)))
(line-break . (lambda (&rest args) (ox-jira--not-implemented 'line-break)))
(line-break . (lambda (&rest args) "\n\n"))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

According to https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=breaks \\ should create a linebreak. I think that might be more accurate than \n\n, which appears to be a paragraph break?

(link . ox-jira-link)
(node-property . (lambda (&rest args) (ox-jira--not-implemented 'node-property)))
(options . (lambda (&rest args) (ox-jira--not-implemented 'options)))
Expand All @@ -145,7 +145,7 @@
(timestamp . ox-jira-timestamp)
(underline . ox-jira-underline)
(verbatim . ox-jira-verbatim)
(verse-block . (lambda (&rest args) (ox-jira--not-implemented 'verse-block))))
(verse-block . ox-jira-verse-block))
:filters-alist '((:filter-parse-tree . ox-jira-fix-multi-paragraph-items))
:options-alist '((:src-collapse-threshold nil nil ox-jira-src-collapse-threshold))
:menu-entry
Expand Down Expand Up @@ -194,6 +194,12 @@ CONTENTS is nil. INFO is a plist used as a communication
channel."
(format "{{%s}}" (org-element-property :value code)))

(defun ox-jira-entity (entity _contents info)
"Transcode a CODE object from Org to JIRA.
CONTENTS is nil. INFO is a plist used as a communication
channel."
(org-element-property :utf-8 entity))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 What does this actually do? A test would really help here, as I don't know what this is for.


(defun ox-jira-example-block (example-block contents info)
"Transcode an EXAMPLE-BLOCK element from Org to Jira.
CONTENTS is nil. INFO is a plist holding contextual
Expand Down Expand Up @@ -344,6 +350,12 @@ CONTENTS is nil. INFO is a plist used as a communication
channel."
(format "{{%s}}" (org-element-property :value verbatim)))

(defun ox-jira-verse-block (_verse-block contents info)
"Transcode a VERSE object from Org to Jira.
CONTENTS is verse block contents. INFO is a plist holding
contextual information."
(replace-regexp-in-string "^\\\(.*\\\)$" "{{\\1}}" contents))
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I understand correctly this will render each line in monospaced font. WDYT about an explicit linebreak (using \\ at the end of each source line instead? That should have the same effect. Might also want to wrap it in a panel.

Although, I think JIRA keeps linebreaks, so you may be able to get away with just passing it through as-is. (I remember having to add code to the paragraph handler to remove linebreaks from the input for this reason.)


(defun ox-jira-paragraph (paragraph contents info)
"Transcode a PARAGRAPH element from Org to JIRA.
CONTENTS is the contents of the paragraph, as a string. INFO is
Expand Down Expand Up @@ -375,7 +387,7 @@ the plist used as a communication channel."
CONTENTS holds the contents of the src-block. INFO is a plist holding
contextual information."
(when (org-string-nw-p (org-element-property :value src-block))
(let* ((title (apply #'concat (org-export-get-caption src-block)))
(let* ((title (or (car (org-export-get-caption src-block)) ""))
(lang (org-element-property :language src-block))
(lang (if (member lang ox-jira-src-supported-languages) lang "none"))
(code (org-export-format-code-default src-block info))
Expand Down