From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vladimir Lomov Subject: Lieterate Programming for configuration settings Date: Mon, 5 Mar 2012 17:09:14 +0900 Message-ID: <20120305080914.GC862@smoon> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from eggs.gnu.org ([208.118.235.92]:33692) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4Sz1-0005GX-II for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 03:09:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S4Syu-0001Yf-Ck for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 03:09:27 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:51354) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S4Syu-0001Y9-2e for emacs-orgmode@gnu.org; Mon, 05 Mar 2012 03:09:20 -0500 Received: by bkwq16 with SMTP id q16so3552371bkw.0 for ; Mon, 05 Mar 2012 00:09:17 -0800 (PST) Content-Disposition: inline List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hello, --------------------------------- 8< --------------------------------- #+TITLE: Literate Programming for configuration settings #+AUTHOR: Vladimir Lomov #+OPTIONS: toc:nil * Literate Programming I'm trying to use the Literate Programming to describe my set up of Openbox and my workflow with Linux. The main problem is with Openbox. I set up convenient (for me) keybindings, like "W-x f k" to launch Krusader file manager, and now I want to describe all my keybindings. I see this as follow: from one source I get Org table (keybind and description) and xml code (to be included into ~rc.xml~ using noweb). At first, I thought about table in org file with three columns: | Keybind | Code | Description | |---------+------+-------------| but I don't know how to exclude second column in html export and how to generate xml code excluding the third column. So I decided to use plain txt files with the same information. My question is: how to get table in html export and xml file with code? I wrote two shell scripts, first gives org table from txt file, the second generates xml code from the same txt file, but can't figure out how to use them with org. (My next step would be to put both: plain txt file content and shell script code into one org file, if my idea would work.) ** Example Below is example of plain text file. I don't need ~example.txt~ except for shell script to generate org table and xml code, if it is possible to get both without extracting text file it would be great. #+name: example.txt #+begin_src text :exports none :tangle example.txt "Alt-F2" 'gmrun' "Run gmrun, very useful tool" "Alt-F4" '' "Close application window" "Alt-F9" '' "Iconify to task bar" "Alt-Tab" '' "Switch focus to next window" "Alt-S-Tab" '' "Switch focus to previous window" "Alt-space" 'client-menu' "Show application window menu" #+end_src This shell script used standalone gives correct org table. I also don't need it except it generates org table. #+name: txt2org-table #+begin_src sh :exports none #!/bin/bash ### # Read a txt file and write to stdout it as Org table. ### _data="$1" ### # Each line has three fields: keystroke, xml code and description. For table the 1 and 3 are needed. ### echo "| Keybind | Description |" echo "+------------+----------------------|" while IFS=' ' read -r kb code descr do [[ ${kb} = \#* ]] && continue echo "| ${kb//\"/~} | ${descr//\"} |" done < "${_data}" echo "+------------+----------------------|" exit 0 #+end_src ** My real goal Ideally I want to have a table (like <>) in org file, when I export org file to html there must be table with "Keybind" and "Description" and the same org file should generate ~rc.xml~ (I assume it is possible to insert results of script run in place of <>). --- Thanks in advance, Vladimir Lomov P.S. Sorry if I description were to obscure. P.P.S. Side note: why then 'tangled' example.txt the first line is empty one? -- I hate users you sound like a sysadmin already!