From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: [BUG] nested blocks aren't protected on export Date: Sun, 27 Jun 2010 19:42:24 -0700 Message-ID: <8739w7ane7.fsf@gmail.com> References: <876316cz9g.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=50804 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OT4In-0001j8-Ff for emacs-orgmode@gnu.org; Sun, 27 Jun 2010 22:42:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OT4Im-0006pT-2s for emacs-orgmode@gnu.org; Sun, 27 Jun 2010 22:42:29 -0400 Received: from mail-px0-f169.google.com ([209.85.212.169]:47845) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OT4Il-0006pL-L8 for emacs-orgmode@gnu.org; Sun, 27 Jun 2010 22:42:28 -0400 Received: by pxi17 with SMTP id 17so7291715pxi.0 for ; Sun, 27 Jun 2010 19:42:26 -0700 (PDT) In-Reply-To: <876316cz9g.fsf@gmail.com> (Eric Schulte's message of "Fri, 25 Jun 2010 19:18:35 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Eric Schulte Cc: Org Mode --=-=-= I've put together two patches which fix the problems I mention below. I'd like to apply these patches, but I fear that they may cause unanticipated export problems. I'd be much more comfortable if someone who knows a little more about the exporters could take a look at these. Thanks -- Eric --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-org-exp-check-for-protection-before-removing-comment.patch >From 47fcfd522294560dbe01f00b640631964e063cf0 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 27 Jun 2010 19:35:34 -0700 Subject: [PATCH 1/2] org-exp: check for protection before removing comments * lisp/org-exp.el (org-export-handle-comments): check for protection before removing comments --- lisp/org-exp.el | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 704c0b7..411557a 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1650,8 +1650,10 @@ When it is nil, all comments will be removed." (match-beginning 0) (match-end 0) '(org-protected t)) (replace-match (format commentsp (match-string 2)) t t)) (goto-char (1+ pos)) - (replace-match "") - (goto-char (max (point-min) (1- pos))))))) + (org-if-unprotected + (replace-match "") + (goto-char (max (point-min) (1- pos)))))))) + (defun org-export-mark-radio-links () "Find all matches for radio targets and turn them into internal links." -- 1.7.0.4 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-org-latex-check-for-protection-before-wrapping-lines.patch >From d422f564163e37c51d0727e2992b24b85caf54ea Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 27 Jun 2010 19:36:14 -0700 Subject: [PATCH 2/2] org-latex: check for protection before wrapping ": " lines as verbatim * lisp/org-latex.el (org-export-latex-fixed-width): check for protection before wrapping ": " lines as verbatim --- lisp/org-latex.el | 28 ++++++++++++++-------------- 1 files changed, 14 insertions(+), 14 deletions(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 01a4b05..94f04e6 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -1537,20 +1537,20 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER." "When OPT is non-nil convert fixed-width sections to LaTeX." (goto-char (point-min)) (while (re-search-forward "^[ \t]*:\\([ \t]\\|$\\)" nil t) - (if opt - (progn (goto-char (match-beginning 0)) - (insert "\\begin{verbatim}\n") - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") - (replace-match (concat (match-string 1) - (match-string 2)) t t) - (forward-line)) - (insert "\\end{verbatim}\n\n")) - (progn (goto-char (match-beginning 0)) - (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") - (replace-match (concat "%" (match-string 1) - (match-string 2)) t t) - (forward-line)))))) - + (org-if-unprotected + (if opt + (progn (goto-char (match-beginning 0)) + (insert "\\begin{verbatim}\n") + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") + (replace-match (concat (match-string 1) + (match-string 2)) t t) + (forward-line)) + (insert "\\end{verbatim}\n\n")) + (progn (goto-char (match-beginning 0)) + (while (looking-at "^\\([ \t]*\\):\\(\\([ \t]\\|$\\).*\\)$") + (replace-match (concat "%" (match-string 1) + (match-string 2)) t t) + (forward-line))))))) (defvar org-table-last-alignment) ; defined in org-table.el (defvar org-table-last-column-widths) ; defined in org-table.el -- 1.7.0.4 --=-=-= "Eric Schulte" writes: > Hi, > > When exporting nested blocks, the results of the inner blocks are not > fully protected from further exportation. For example, the following > org-mode text > > ** protecting block bodies > #+begin_src org > ,#+begin_src emacs-lisp > , (message "something") > ,#+end_src > #+end_src > > exports to the following LaTeX > > \section*{protecting block bodies} > \label{sec-1} > > \begin{verbatim} > (message "something") > \end{verbatim} > > in which it looks like the "#+begin_src emacs-lisp" and the "#+end_src" > lines are completely removed, and exports to the following html > (newlines added for readability) > >
> #+begin_src emacs-lisp
>   (message "something")
> 
> 
> > in which the #+begin_src line is in tact, but it appears everything > following the end_src line (including the ) is removed. > > I've played around with adding 'org-protected properties during export > but to no avail. > > Any suggestions are much appreciated. > > Thanks -- Eric --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ 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 --=-=-=--