From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastian Rose Subject: Org-export intergration Date: Mon, 04 May 2009 11:29:08 +0200 Message-ID: <87ocu9dxnf.fsf@kassiopeya.MSHEIMNETZ> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1M0uQZ-00008z-Vm for emacs-orgmode@gnu.org; Mon, 04 May 2009 05:25:36 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1M0uQU-00005V-IT for emacs-orgmode@gnu.org; Mon, 04 May 2009 05:25:34 -0400 Received: from [199.232.76.173] (port=41068 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1M0uQU-00005F-26 for emacs-orgmode@gnu.org; Mon, 04 May 2009 05:25:30 -0400 Received: from mail.gmx.net ([213.165.64.20]:35665) by monty-python.gnu.org with smtp (Exim 4.60) (envelope-from ) id 1M0uQT-0005d3-Gw for emacs-orgmode@gnu.org; Mon, 04 May 2009 05:25:29 -0400 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 Mailing List --=-=-= Hi, here is a little function, that creates the menu-structure file for Marco Pratesi's great phplayersmenu. Just thought I share it here. See http://phplayersmenu.sourceforge.net/demo.php for a demo. All the menus there are made from the same menu-structur files. To use it, have this here in my config: (setq org-publish-project-alist '( ("org-notes" ;; .... config omitted ... ;; ;;; Layersmenu ;;; :completion-function sr-org-notes-kb-complete :layers-menu-structure-file "~/develop/htdocs/intranet/navigations/org.txt" :layers-menu-link-target "mitte" ) NOTE: the function will not work stand-alone. You will have to use it as :completion-function. Here it is: --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=sr-org-index-complete.el Content-Transfer-Encoding: quoted-printable ;;; sr-org-kb-index.el ;; Generate a menufile for Marco Pratesi's great phplayersmenu. ;;; Usage ;; ;; The menu-structure file is made from the index-file of your project. ;; The index-filename is set in your `org-publish-project-alist': ;; ;; (require 'org-publish) ;; (setq org-publish-project-alist ;; '(("org-notes" ;; :auto-index t ; generate index.org automagically ;; :index-filename "sitemap.org" ;; :recursive t ;; :base-extension "org" ;; :publishing-directory "~/develop/htdocs/org-notes/" ;; :publishing-function org-publish-org-to-html ;; ;; ;; ;; ;; Layersmenu: ;; ;; ;; :completion-function sr-org-notes-kb-complete ;; :layers-menu-structure-file "~/public_html/navigations/org.txt" ;; ;; Optional: ;; :layers-menu-link-target "mitte" ;; ) ;; ;; All other values used by phplayersmenu itself, may be set through styles= heets and ;; the phplayersmenu functions. ;; ;;; (defun sr-org-notes-kb-complete () "Take the index-file and turn it into the menu-structure file for Marco Pratesi's phplayersmenu." (let* ((base-dir (file-name-as-directory (plist-get project-plist :base-d= irectory))) (orig (expand-file-name (concat base-dir (plist-get project-plist = :index-filename)))) (strip-suffix (or (plist-get project-plist :base-extension) "org")) (add-suffix (or (plist-get project-plist :html-extension) "html")) (link-target (or (plist-get project-plist :layers-menu-link-target= ) "_blank")) (menu-file (or (plist-get project-plist :layers-menu-structure-fil= e) nil)) (visiting (find-buffer-visiting orig)) (visiting-output (find-buffer-visiting menu-file)) (input-buffer (find-file orig)) (output-buffer (find-file menu-file)) (old-ndots 1) (sub "") (old-sub "")) (unless menu-file (throw 'sr-org-note-kb-completion-error "No menu structure file provided. Giving up.")) (with-current-buffer output-buffer (erase-buffer)) (with-current-buffer input-buffer (widen) (goto-char (point-min)) (while (re-search-forward org-bracket-link-analytic-regexp (point-max= ) t) (let ((link (match-string-no-properties 3)) (text (match-string-no-properties 5)) (pos 0) (ndots 1)) (with-current-buffer output-buffer (if (string-match (concat "\\(" strip-suffix "\\)$") link) (setq link (replace-match add-suffix t t link))) (while (setq pos (string-match "/" link pos)) (setq ndots (+ ndots 1)) (setq pos (+ pos 1))) (when (< 1 ndots) (string-match "\\(/[^/]*\\)$" link) (setq sub (replace-match "" t t link)) (unless (string=3D sub old-sub) (let ((ds 0) (subs (split-string sub "/")) (old-subs (split-string old-sub "/"))) (while (string=3D (car old-subs) (car subs)) (setq ds (+ ds 1)) (pop old-subs) (pop subs)) (dolist (d subs) (setq ds (+ ds 1)) (insert (concat (make-string ds ?.) "|" d "\n"))) (setq old-sub sub)))) (insert (concat (make-string ndots ?.) "|" text "|" link "|||" link-target "\n")) (setq old-ndots ndots) )))) (or visiting (kill-buffer input-buffer)) (with-current-buffer output-buffer (save-buffer)) (or visiting-output (kill-buffer output-buffer)) )) (provide 'sr-org-index-complete) --=-=-= Regards Sebastian --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Remember: use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--