From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Clemente Subject: Re: Using Org-mode file format for storing configuration data Date: Wed, 02 Jan 2013 03:03:19 +0100 Message-ID: <87licc1guw.wl%n142857@gmail.com> References: <2012-12-30T18-55-46@devnull.Karl-Voit.at> Mime-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([208.118.235.92]:43909) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqDg4-0002Mi-NZ for emacs-orgmode@gnu.org; Tue, 01 Jan 2013 21:03:34 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TqDfx-0003Un-EX for emacs-orgmode@gnu.org; Tue, 01 Jan 2013 21:03:32 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:54138) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TqDfx-0003Ug-80 for emacs-orgmode@gnu.org; Tue, 01 Jan 2013 21:03:25 -0500 Received: by mail-wi0-f179.google.com with SMTP id o1so7620511wic.12 for ; Tue, 01 Jan 2013 18:03:23 -0800 (PST) In-Reply-To: <2012-12-30T18-55-46@devnull.Karl-Voit.at> 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: news1142@Karl-Voit.at Cc: emacs-orgmode@gnu.org El Sun, 30 Dec 2012 19:04:25 +0100 Karl Voit va escriure: >=20 > I plan to implement a new weblog system that parses Org-mode files > and generates (static) HTML output. Yes, I am aware that there are > other solutions out there but I do not like them for various > reasons.[1] Nice! I also don't like existing solutions and I was thinking on writing = some Python to do the export. But the complexities of exporting are so well= resolved in elisp that it's much easier to invoke elisp code than to write= your own in Python. >=20 > So for my new system, I am thinking of using Org-mode files for > writing (and parsing) the user-defined preferences. I happened to be thinking the same two days ago. I wanted a place for scr= ipts to store data as key=E2=86=92value pairs: e.g. configurations, or obse= rvations (like: file count on ~). Normally I would use lots of small hidden= files for that. Now I wanted a central registry. I thought of using some cache server, or a small NoSQL database, or a sys= tem monitor for observations (e.g. collectd), and of course, org-mode. In t= he end, I think I will stay with the many small files; it's much easier! =20 > - In Python I have to parse a basic sub-set of Org-mode format > anyhow. An additional parser would be more work to do. Don't do it from scratch; there are already some parsers which work. I tr= ied: https://github.com/bjonnh/PyOrgMode > - Possible methods to store configuration/settings of a weblog system > that scans Org-mode files to generate HTML: > - in drawers: see below > - in tables: see below > - in tags: see below > - other possibilities? >=20 From the ones you say, I prefer property drawers. It's the most DB-like = and it's analogous to storing data (well, strings). You don't need all the table benefits (reordering, exporting, formatting= , formulae, =E2=80=A6). Nor the tags benefits (search, multiple tags, =E2=80=A6) > What do you think of this? > Can you imagine a better way of storing key-value-pairs in Org-mode? >=20 > My focus is user friendly maintenance and overview including in-line > documentation of the preferences. Of course, storing configuration in .org is very utopic (being all .org),= but I would prefer *not* to do it. I would use a simple ~/.file.conf with = some variables in the usual style: # a comment path=3D~/web/ # where to export images images=3D~/web/images I think this wins for usability and =E2=80=9Efriendly maintenance=E2=80= =9C, since people know it and it works. And it allows you to define many pr= ojects (e.g. check the configuration file for the program unison). There are even libraries to parse these simple files: http://docs.python.= org/2/library/configparser.html And if you want to design an equivalent grammar for configuration files (= beware! that's another adventure!), check http://augeas.net/ . It can manip= ulate configuration files in a format-agnostic way. But I think it's more important to center efforts in developing a good ex= porter web publisher. As you said, the current ones are not powerful enough. Good luck.