emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Patch for ox-confluence.el
@ 2016-03-09 16:42 Paul Schorfheide
  2016-03-17 11:26 ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Schorfheide @ 2016-03-09 16:42 UTC (permalink / raw)
  To: emacs-orgmode


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

Hi:

I made a small change to ox-confluence.el to support additional language
name mappings. Can someone please review it?

Thanks
Paul Schorfheide

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

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

From c69827145c437d507c87e547bc554851b964d7b8 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 | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/contrib/lisp/ox-confluence.el b/contrib/lisp/ox-confluence.el
index 9b96d5f..d4a26bf 100644
--- a/contrib/lisp/ox-confluence.el
+++ b/contrib/lisp/ox-confluence.el
@@ -57,6 +57,10 @@
 		     (template . org-confluence-template)
 		     (underline . org-confluence-underline)))
 
+(defvar org-confluence-lang-alist
+  '(("sh" . "bash"))
+  "Map from org-babel language name to confluence wiki language name")
+
 ;; 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))
          (content (org-export-format-code-default src-block info)))
     (org-confluence--block language "Emacs" content)))
 
-- 
2.5.4 (Apple Git-61)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Patch for ox-confluence.el
  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
  0 siblings, 1 reply; 4+ messages in thread
From: Nicolas Goaziou @ 2016-03-17 11:26 UTC (permalink / raw)
  To: Paul Schorfheide; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Patch for ox-confluence.el
  2016-03-17 11:26 ` Nicolas Goaziou
@ 2016-03-19 14:27   ` Paul Schorfheide
  2016-04-02  8:57     ` Nicolas Goaziou
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Schorfheide @ 2016-03-19 14:27 UTC (permalink / raw)
  To: emacs-orgmode


[-- 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)


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: Patch for ox-confluence.el
  2016-03-19 14:27   ` Paul Schorfheide
@ 2016-04-02  8:57     ` Nicolas Goaziou
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolas Goaziou @ 2016-04-02  8:57 UTC (permalink / raw)
  To: Paul Schorfheide; +Cc: emacs-orgmode

Hello,

Paul Schorfheide <pschorf2@gmail.com> writes:

> 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.

I applied (eventually!) your patch.

Please let me know when you move the file into ELPA, so I can remove it
from contrib/

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-04-02  8:55 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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
2016-04-02  8:57     ` Nicolas Goaziou

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).