From mboxrd@z Thu Jan 1 00:00:00 1970 From: Benjamin Beckwith Subject: Re: How to customize the org-mode's BEGIN_SRC HTML output Date: Tue, 24 Aug 2010 23:32:01 -0400 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=37490 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Oo6ia-0004ll-ET for emacs-orgmode@gnu.org; Tue, 24 Aug 2010 23:32:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Oo6iY-00015e-Ip for emacs-orgmode@gnu.org; Tue, 24 Aug 2010 23:32:04 -0400 Received: from mail-qw0-f41.google.com ([209.85.216.41]:38712) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Oo6iY-00015Z-EW for emacs-orgmode@gnu.org; Tue, 24 Aug 2010 23:32:02 -0400 Received: by qwf7 with SMTP id 7so125337qwf.0 for ; Tue, 24 Aug 2010 20:32:01 -0700 (PDT) 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: emacs-orgmode@gnu.org Rafael, I had my shortcodes setup to accept the language directly. Your change should work as you indicated. I have an additional fix to my code that should behave better for you. I add a property, org-protected, that prevents processing of the text. I tried it on your code blocks by calling org-export directly (C-c C-e) and then choosing 'H' to see the html in a buffer. This really helps with debug. Fixed code follows ---------------------------------------------------- (defun bnb/org2blog-src-blocks-to-wp-syntaxhighlighter () "Export #+BEGIN_SRC blocks as Wordpress Syntaxhighlighter tags. There is a special header option, :syntaxhl that contains the options to pass to syntaxhighlighter. This is intended to be added to `org-export-preprocess-hooks'" (interactive) (save-window-excursion (let ((case-fold-search t) (colon-re "^[ \t]*:\\([ \t]\\|$\\)") lang body headers syntaxhl block beg) (goto-char (point-min)) (while (re-search-forward colon-re nil t) (replace-match (match-string 1)) (beginning-of-line 1) (insert "[text light=\"true\"]\n") (setq beg (point)) (while (looking-at colon-re) (replace-match (match-string 1)) (end-of-line 1) (or (eobp) (forward-char 1))) (end-of-line 1) (add-text-properties beg (if (bolp) (1- (point)) (point)) '(org-protected t)) (insert "\n[/text]")) (unless (boundp 'org-babel-src-block-regexp) (require 'ob)) (while (re-search-forward (concat "\\(" org-babel-src-block-regexp "\\|" org-babel-inline-src-block-regexp "\\)") nil t) (setq lang (match-string-no-properties 3)) (if (string-match "-" lang) (error "SyntaxHighlighter does not support languages with '-' in the names")) (setq headers (match-string-no-properties 5)) (setq body (match-string-no-properties 6)) (save-match-data (setq syntaxhl (if (string-match ":syntaxhl[ ]+\\([^ ]+\\)" headers) (concat " " (replace-regexp-in-string "\;" " " (match-string 1 headers)))))) (setq block (concat "\n\n[" lang syntaxhl "]\n" body "[/" lang "]\n")) (add-text-properties 0 (length block) '(org-protected t) block) (replace-match block nil t))))) ---------------------------------- I also remembered that I made the following setting as well, but I do not know if I still need it. (setq org-export-preprocess-hook (list 'bnb/org2blog-src-blocks-to-wp-syntaxhighlighter 'org-export-blocks-preprocess))