emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* ascii-export vs. "<<" and ">>" patch
@ 2010-01-07 17:30 Bryan Fink
  2010-01-08  8:41 ` Carsten Dominik
  0 siblings, 1 reply; 2+ messages in thread
From: Bryan Fink @ 2010-01-07 17:30 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 657 bytes --]

Hi.  I'm using org-mode to write some documentation about Erlang
modules.  Erlang's "binary" data type has a syntax like:

   <<"this is binary data">>

Org-mode's ascii-exporter in version 6.33f blindly strips all <<>>
pairs from the file, leaving the text as

   "this is binary data"

which, unfortunately, is still valid Erlang syntax, but has a different meaning.

So, to help me and others write Erlang documentation in org-mode, I
submit the patch attached to this email, which changes org-ascii.el
such that it checks the org-protected text property before stripping
<<>> characters, so examples marked as verbatim text should go
untouched.

-Bryan

[-- Attachment #2: 0001-do-not-strip-and-from-protected-sections-during-asci.patch --]
[-- Type: application/octet-stream, Size: 841 bytes --]

From c7a6a3034b9e9588e22144e580105dd2016dc04a Mon Sep 17 00:00:00 2001
From: Bryan Fink <bryan@basho.com>
Date: Thu, 7 Jan 2010 12:02:28 -0500
Subject: [PATCH] do not strip "<<" and ">>" from protected sections during ascii export

---
 lisp/org-ascii.el |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/lisp/org-ascii.el b/lisp/org-ascii.el
index 3019a1a..8ef2b2c 100644
--- a/lisp/org-ascii.el
+++ b/lisp/org-ascii.el
@@ -494,7 +494,8 @@ publishing directory."
   ;; Remove target markers
   (goto-char (point-min))
   (while (re-search-forward  "<<<?\\([^<>]*\\)>>>?\\([ \t]*\\)" nil t)
-    (replace-match "\\1\\2")))
+    (if (not (get-text-property (point) 'org-protected))
+        (replace-match "\\1\\2"))))
 
 (defun org-html-expand-for-ascii (line)
   "Handle quoted HTML for ASCII export."
-- 
1.6.5.5


[-- Attachment #3: Type: text/plain, Size: 201 bytes --]

_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

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

* Re: ascii-export vs. "<<" and ">>" patch
  2010-01-07 17:30 ascii-export vs. "<<" and ">>" patch Bryan Fink
@ 2010-01-08  8:41 ` Carsten Dominik
  0 siblings, 0 replies; 2+ messages in thread
From: Carsten Dominik @ 2010-01-08  8:41 UTC (permalink / raw)
  To: Bryan Fink; +Cc: emacs-orgmode

Hi Bryan,

On Jan 7, 2010, at 6:30 PM, Bryan Fink wrote:

> Hi.  I'm using org-mode to write some documentation about Erlang
> modules.  Erlang's "binary" data type has a syntax like:
>
>   <<"this is binary data">>
>
> Org-mode's ascii-exporter in version 6.33f blindly strips all <<>>
> pairs from the file, leaving the text as
>
>   "this is binary data"
>
> which, unfortunately, is still valid Erlang syntax, but has a  
> different meaning.

First of all, you should have such code in code blocks like # 
+begin_src..., or, in running text, you need to protect it with  
something like =<<"this is binary data">>=.

Then things will work in HTML.

There is indeed a bug in ASCII export which does remove these without  
checking for protection - but I have just fixed that - so if you pull  
and protect, things should work.

HTH

- Carsten

>
> So, to help me and others write Erlang documentation in org-mode, I
> submit the patch attached to this email, which changes org-ascii.el
> such that it checks the org-protected text property before stripping
> <<>> characters, so examples marked as verbatim text should go
> untouched.
>
> -Bryan
> <0001-do-not-strip-and-from-protected-sections-during- 
> asci.patch>_______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode

- Carsten

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

end of thread, other threads:[~2010-01-08  8:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-01-07 17:30 ascii-export vs. "<<" and ">>" patch Bryan Fink
2010-01-08  8:41 ` Carsten Dominik

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