emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] [PATCH] Add "latex" option to ox-bibtex.el


From: feng shu
Subject: Re: [O] [PATCH] Add "latex" option to ox-bibtex.el
Date: Sat, 13 Jul 2013 07:15:34 +0800

I want to add a option which can setting bib for html export and latex export separately,
As it for the reason:
1. bibtex2html can't work well with complex bib style, so using a simple style and making it
    show correctly is reasonable choose,
2. bibtex2html can't find bib style in current dir, for example (./file.sty) ,
3. the biblatex user.


In my opinion, the solution seemd more hacky than mine for a user,  It let my org-mode file more unportable.

Could you share you opinion and reason about my approach:  Is the idea , separating with  a new option, hacky?  or my code hacky? .



On Fri, Jul 12, 2013 at 9:36 PM, Nicolas Goaziou <address@hidden> wrote:
> Really?  This problem can be resolved with hooks or filters?  Could you
> give me more informations or a example?

Perhaps something like the following (untested) should do the trick:

  (defun my-bibliography-selector-hook (backend)
    (case backend
      (latex
       (when (save-excursion
               (re-search-forward "^[ \t]*\\bibliography\\(?:style\\)?{" nil t))
         (while (re-search-forward "^[ \t]*#+BIBLIOGRAPHY:.*$" nil t)
           (when (eq (org-element-type (save-match-data (org-element-at-point)))
                     'keyword)
             (replace-match "")))))
      (html
       (when (save-excursion
               (re-search-forward "^[ \t]*#+BIBLIOGRAPHY:.*$" nil t))
         (while (re-search-forward "^[ \t]*\\bibliography\\(?:style\\)?{.*$" nil t)
           (replace-match ""))))))

  (add-hook 'org-export-before-parsing-hook 'my-bibliography-selector-hook)


Regards,

--
Nicolas Goaziou


reply via email to

[Prev in Thread] Current Thread [Next in Thread]