From 9e8ebbbdfb83bd4bdd61eb3454300c2749232d43 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Thu, 28 Oct 2004 18:38:07 +0000 Subject: [PATCH] Add some introductory notes. 2004-10-28 Matthias Clasen * glib/tmpl/keyfile.sgml: Add some introductory notes. --- docs/reference/ChangeLog | 4 ++ docs/reference/glib/tmpl/keyfile.sgml | 79 +++++++++++++++++++++++++++++++++++ 2 files changed, 83 insertions(+) diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 5547346..4c590ca 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,3 +1,7 @@ +2004-10-28 Matthias Clasen + + * glib/tmpl/keyfile.sgml: Add some introductory notes. + 2004-10-27 Matthias Clasen * === Released 2.5.4 === diff --git a/docs/reference/glib/tmpl/keyfile.sgml b/docs/reference/glib/tmpl/keyfile.sgml index f64104c..de3d450 100644 --- a/docs/reference/glib/tmpl/keyfile.sgml +++ b/docs/reference/glib/tmpl/keyfile.sgml @@ -6,7 +6,86 @@ parses .ini-like config files +#GKeyFile lets you parse, edit or create files containing groups of +key-value pairs, which we call key files for +lack of a better name. Several freedesktop.org specifications use +key files now, e.g the +Desktop +Entry Specification and the +Icon +Theme Specification. + + + +The syntax of key files is described in detail in the +Desktop +Entry Specification, here is a quick summary: Key files +consists of groups of key-value pairs, interspersed with comments. + + + +# this is just an example +# there can be comments before the first group + +[First Group] + +Name=Key File Example\tthis value shows\nescaping +# localized strings are stored in multiple key-value pairs +Welcome=Hello +Welcome[de]=Hallo +Welcome[fr]=Bonjour +Welcome[it]=Ciao + +[Another Group] + +Numbers=2;20;-200;0 + +Booleans=true;false;true;true + + + + +Lines beginning with a '#' and blank lines are considered comments. + + + +Groups are started by a header line containing the group name enclosed +in '[' and ']', and ended implicitly by the start of the next group or +the end of the file. Each key-value pair must be contained in a group. + + + +Key-value pairs generally have the form key=value, +with the exception of localized strings, which have the form +key[locale]=value. Space before and after the +'=' character are ignored. Newline, tab, carriage return and backslash +characters are escaped as \n, \t, \r, and \\, respectively. To preserve +initial and final spaces, these can also be escaped as \s. + + + +Key files can store strings (possibly with localized variants), integers, +booleans and lists of these. Lists are separated by a separator character, +typically ';' or ','. To use the list separator character in a value in +a list, it has to be escaped by prefixing it with a backslash. + + + +This syntax is obviously inspired by the .ini +files commonly met on Windows, but there are some important differences: + + +.ini files use the ';' character to begin comments, + key files use the '#' character. + + +Key files allow only comments before the first group. + + +Key files are always encoded in UTF-8. + + -- 2.7.4