emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Paul Schorfheide <pschorf2@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Re: Patch for ox-confluence.el
Date: Sat, 19 Mar 2016 14:27:35 +0000	[thread overview]
Message-ID: <CADK98M2a-oUg5_xNdR57sWS59qse9Aq5Mss9tAv5Y4uH5BOOjQ@mail.gmail.com> (raw)
In-Reply-To: <87zitxmjlg.fsf@nicolasgoaziou.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1624 bytes --]

Thanks for the feedback, Nicolas. I wasn't familiar with defcustom. I made
the two edits and attached an updated patch. I would be happy to maintain
the file in org-mode for now and look into moving it into ELPA.

Thanks
Paul Schorfheide

On Thu, Mar 17, 2016 at 6:23 AM Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Paul Schorfheide <pschorf2@gmail.com> writes:
>
> > I made a small change to ox-confluence.el to support additional language
> > name mappings. Can someone please review it?
>
> Thank you for the patch.
>
> AFAIU, "ox-confluence.el" doesn't have a maintainer anymore, in case you
> feel like doing the job.
>
> The library could also be moved to ELPA, IMO.
>
> > +(defvar org-confluence-lang-alist
> > +  '(("sh" . "bash"))
> > +  "Map from org-babel language name to confluence wiki language name")
>
> What about making it a defcustom?
>
> >  ;; All the functions we use
> >  (defun org-confluence-bold (bold contents info)
> >    (format "*%s*" contents))
> > @@ -111,8 +115,9 @@
> >  (defun org-confluence-src-block (src-block contents info)
> >    ;; FIXME: provide a user-controlled variable for theme
> >    (let* ((lang (org-element-property :language src-block))
> > -         (language (if (string= lang "sh") "bash" ;; FIXME: provide a
> mapping of some sort
> > -                     lang))
> > +         (language (if (assoc lang org-confluence-lang-alist)
> > +                    (cdr (assoc lang org-confluence-lang-alist))
> > +                       lang))
>
> Nitpick:
>
>   (or (cdr (assoc lang org-confluence-lang-alist) lang))
>
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #1.2: Type: text/html, Size: 2310 bytes --]

[-- Attachment #2: 0001-Add-org-confluence-lang-alist.patch --]
[-- Type: application/octet-stream, Size: 1551 bytes --]

From 2fc5bc3199452506b313d3681672402def2859c6 Mon Sep 17 00:00:00 2001
From: Paul Schorfheide <pschorf2@gmail.com>
Date: Wed, 9 Mar 2016 10:38:46 -0600
Subject: [PATCH] Add org-confluence-lang-alist

* ox-confluence.el (org-confluence-src-block): Add var for mapping
language name

TINYCHANGE
---
 contrib/lisp/ox-confluence.el | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index 4b74e75..48bc5ea 100644
--- a/contrib/lisp/ox-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -58,6 +58,11 @@
 		     (template . org-confluence-template)
 		     (underline . org-confluence-underline)))
 
+(defcustom org-confluence-lang-alist
+  '(("sh" . "bash"))
+  "Map from org-babel language name to confluence wiki language name"
+  :type '(alist :key-type string :value-type string))
+
 ;; All the functions we use
 (defun org-confluence-bold (bold contents info)
   (format "*%s*" contents))
@@ -118,8 +123,7 @@ a communication channel."
 (defun org-confluence-src-block (src-block contents info)
   ;; FIXME: provide a user-controlled variable for theme
   (let* ((lang (org-element-property :language src-block))
-         (language (if (string= lang "sh") "bash" ;; FIXME: provide a mapping of some sort
-                     lang))
+         (language (or (cdr (assoc lang org-confluence-lang-alist)) lang))
          (content (org-export-format-code-default src-block info)))
     (org-confluence--block language "Emacs" content)))
 
-- 
2.5.4 (Apple Git-61)


  reply	other threads:[~2016-03-19 14:27 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-09 16:42 Patch for ox-confluence.el Paul Schorfheide
2016-03-17 11:26 ` Nicolas Goaziou
2016-03-19 14:27   ` Paul Schorfheide [this message]
2016-04-02  8:57     ` Nicolas Goaziou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CADK98M2a-oUg5_xNdR57sWS59qse9Aq5Mss9tAv5Y4uH5BOOjQ@mail.gmail.com \
    --to=pschorf2@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).