[caribou] Use XSLT to make keyboard definitions easier.
- From: Eitan Isaacson <eitani src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [caribou] Use XSLT to make keyboard definitions easier.
- Date: Wed, 22 Jun 2011 18:45:28 +0000 (UTC)
commit ab699e3e6d203e975f99617316e39b77ec76dc56
Author: Eitan Isaacson <eitan monotonous org>
Date: Thu Jun 16 15:51:37 2011 -0700
Use XSLT to make keyboard definitions easier.
.gitignore | 1 +
configure.ac | 2 +-
data/layouts/touch/Makefile.am | 22 ++-
data/layouts/touch/ara.xml.in | 57 ++++
data/layouts/touch/common/qwerty.xml | 177 +++++++++++++
data/layouts/touch/{ara.xml => common/symbols.xml} | 92 ++-----
data/layouts/touch/il.xml | 139 ----------
data/layouts/touch/il.xml.in | 51 ++++
data/layouts/touch/us.xml | 274 --------------------
data/layouts/touch/us.xml.in | 8 +
tools/basic.xsl | 32 +++
11 files changed, 370 insertions(+), 485 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a183c86..e068c90 100644
--- a/.gitignore
+++ b/.gitignore
@@ -45,3 +45,4 @@ caribou-internals.h
*.stamp
data/org.gnome.Caribou.Antler.service
caribou-imcontext.[ch]
+*/layouts/*/*.xml
diff --git a/configure.ac b/configure.ac
index 1de639f..91faea6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -8,7 +8,7 @@ AC_CONFIG_MACRO_DIR([m4])
AM_PROG_LIBTOOL
-AM_INIT_AUTOMAKE([1.11])
+AM_INIT_AUTOMAKE([1.11 -Wno-portability])
AM_MAINTAINER_MODE([enable])
# Support silent build rules. Disable by either passing --disable-silent-rules
# to configure or passing V=1 to make
diff --git a/data/layouts/touch/Makefile.am b/data/layouts/touch/Makefile.am
index 6692fc0..a3389d8 100644
--- a/data/layouts/touch/Makefile.am
+++ b/data/layouts/touch/Makefile.am
@@ -1,8 +1,20 @@
touchlayoutsdir = $(datadir)/caribou/layouts/touch
+touchlayouts_in_files =\
+ ara.xml.in \
+ il.xml.in \
+ us.xml.in
+touchlayouts_DATA = $(touchlayouts_in_files:.xml.in=.xml)
-touchlayouts_DATA = \
- ara.xml \
- il.xml \
- us.xml
+common_files = \
+ common/qwerty.xml \
+ common/symbols.xml
-EXTRA_DIST = $(touchlayouts_DATA)
+%.xsl: %.xml.in
+ xsltproc --xinclude $(top_srcdir)/tools/basic.xsl $< > $@
+
+%.xml: %.xsl %.xml.in
+ xsltproc --xinclude $^ > $@
+
+EXTRA_DIST = $(touchlayouts_in_files) $(common_files)
+
+CLEANFILES = $(touchlayouts_DATA) $(touchlayouts_in_files:.xml.in=.xsl)
\ No newline at end of file
diff --git a/data/layouts/touch/ara.xml.in b/data/layouts/touch/ara.xml.in
new file mode 100644
index 0000000..cc831c1
--- /dev/null
+++ b/data/layouts/touch/ara.xml.in
@@ -0,0 +1,57 @@
+<?xml version="1.0" ?>
+<layout xmlns:xi="http://www.w3.org/2001/XInclude">
+ <level mode="default" name="level1">
+ <row>
+ <key name="Arabic_dad"/>
+ <key name="Arabic_sad"/>
+ <key name="Arabic_qaf"/>
+ <key name="Arabic_feh"/>
+ <key name="Arabic_ghain"/>
+ <key name="Arabic_ain"/>
+ <key name="Arabic_ha"/>
+ <key name="Arabic_khah"/>
+ <key name="Arabic_hah"/>
+ <key name="Arabic_jeem"/>
+ <key name="BackSpace"/>
+ </row>
+ <row align="center">
+ <key name="Arabic_sheen"/>
+ <key name="Arabic_seen"/>
+ <key name="Arabic_yeh"/>
+ <key name="Arabic_beh"/>
+ <key name="Arabic_lam"/>
+ <key name="Arabic_alef"/>
+ <key name="Arabic_teh"/>
+ <key name="Arabic_noon"/>
+ <key name="Arabic_meem"/>
+ <key name="Arabic_kaf"/>
+ </row>
+ <row>
+ <key name="Arabic_zah"/>
+ <key name="Arabic_tah"/>
+ <key name="Arabic_thal"/>
+ <key name="Arabic_dal"/>
+ <key name="Arabic_zain"/>
+ <key name="Arabic_ra"/>
+ <key name="Arabic_waw"/>
+ <key name="Arabic_tehmarbuta"/>
+ <key name="Arabic_theh"/>
+ <key name="Return" width="2.0"/>
+ </row>
+ <row>
+ <key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
+ <key align="left" name="Arabic_fathatan"/>
+ <key align="left" name="space" width="5.0"/>
+ <key align="right" name="Caribou_Prefs"/>
+ </row>
+ </level>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols1'])"/>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols2'])"/>
+ <override xpath="//key[ name='question']">
+ <key name="Arabic_question_mark">
+ <key name="Arabic_question_mark"/>
+ <key name="question"/>
+ <key name="questiondown"/>
+ </key>
+ </override>
+</layout>
diff --git a/data/layouts/touch/common/qwerty.xml b/data/layouts/touch/common/qwerty.xml
new file mode 100644
index 0000000..27e206a
--- /dev/null
+++ b/data/layouts/touch/common/qwerty.xml
@@ -0,0 +1,177 @@
+<?xml version="1.0" ?>
+<external>
+ <level mode="default" name="level1">
+ <row>
+ <key name="q"/>
+ <key name="w"/>
+ <key name="e">
+ <key name="e"/>
+ <key name="egrave"/>
+ <key name="eacute"/>
+ <key name="ecircumflex"/>
+ <key name="ediaeresis"/>
+ <key name="emacron"/>
+ </key>
+ <key name="r"/>
+ <key name="t"/>
+ <key name="y"/>
+ <key name="u">
+ <key name="u"/>
+ <key name="ugrave"/>
+ <key name="uacute"/>
+ <key name="ucircumflex"/>
+ <key name="udiaeresis"/>
+ <key name="umacron"/>
+ </key>
+ <key name="i">
+ <key name="i"/>
+ <key name="igrave"/>
+ <key name="iacute"/>
+ <key name="icircumflex"/>
+ <key name="idiaeresis"/>
+ <key name="imacron"/>
+ </key>
+ <key name="o">
+ <key name="o"/>
+ <key name="ograve"/>
+ <key name="oacute"/>
+ <key name="ocircumflex"/>
+ <key name="odiaeresis"/>
+ <key name="omacron"/>
+ </key>
+ <key name="p"/>
+ <key name="BackSpace"/>
+ </row>
+ <row align="right">
+ <key name="a">
+ <key name="a"/>
+ <key name="agrave"/>
+ <key name="aacute"/>
+ <key name="acircumflex"/>
+ <key name="adiaeresis"/>
+ <key name="aring"/>
+ <key name="atilde"/>
+ <key name="ae"/>
+ <key name="amacron"/>
+ </key>
+ <key name="s"/>
+ <key name="d"/>
+ <key name="f"/>
+ <key name="g"/>
+ <key name="h"/>
+ <key name="j"/>
+ <key name="k"/>
+ <key name="l"/>
+ <key name="Return" width="1.5"/>
+ </row>
+ <row>
+ <key name="Caribou_ShiftUp" toggle="level2"/>
+ <key name="z"/>
+ <key name="x"/>
+ <key name="c">
+ <key name="c"/>
+ <key name="ccedilla"/>
+ </key>
+ <key name="v"/>
+ <key name="b"/>
+ <key name="n"/>
+ <key name="m"/>
+ <key name="comma"/>
+ <key name="period"/>
+ <key name="question"/>
+ </row>
+ <row>
+ <key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
+ <key align="left" name="Caribou_Emoticons"/>
+ <key align="left" name="space" width="5.0"/>
+ <key align="right" name="Caribou_Prefs"/>
+ </row>
+ </level>
+ <level mode="latched" name="level2">
+ <row>
+ <key name="Q"/>
+ <key name="W"/>
+ <key name="E">
+ <key name="E"/>
+ <key name="Egrave"/>
+ <key name="Eacute"/>
+ <key name="Ecircumflex"/>
+ <key name="Ediaeresis"/>
+ <key name="Emacron"/>
+ </key>
+ <key name="R"/>
+ <key name="T"/>
+ <key name="Y"/>
+ <key name="U">
+ <key name="U"/>
+ <key name="Ugrave"/>
+ <key name="Uacute"/>
+ <key name="Ucircumflex"/>
+ <key name="Udiaeresis"/>
+ <key name="Umacron"/>
+ </key>
+ <key name="I">
+ <key name="I"/>
+ <key name="Igrave"/>
+ <key name="Iacute"/>
+ <key name="Icircumflex"/>
+ <key name="Idiaeresis"/>
+ <key name="Imacron"/>
+ </key>
+ <key name="O">
+ <key name="O"/>
+ <key name="Ograve"/>
+ <key name="Oacute"/>
+ <key name="Ocircumflex"/>
+ <key name="Odiaeresis"/>
+ <key name="Omacron"/>
+ </key>
+ <key name="P"/>
+ <key name="BackSpace"/>
+ </row>
+ <row align="right">
+ <key name="A">
+ <key name="A"/>
+ <key name="Agrave"/>
+ <key name="Aacute"/>
+ <key name="Acircumflex"/>
+ <key name="Adiaeresis"/>
+ <key name="Aring"/>
+ <key name="Atilde"/>
+ <key name="Ae"/>
+ <key name="Amacron"/>
+ </key>
+ <key name="S"/>
+ <key name="D"/>
+ <key name="F"/>
+ <key name="G"/>
+ <key name="H"/>
+ <key name="J"/>
+ <key name="K"/>
+ <key name="L"/>
+ <key name="Return" width="1.5"/>
+ </row>
+ <row>
+ <key name="Caribou_ShiftDown" toggle="level1"/>
+ <key name="Z"/>
+ <key name="X"/>
+ <key name="C">
+ <key name="C"/>
+ <key name="Ccedilla"/>
+ </key>
+ <key name="V"/>
+ <key name="B"/>
+ <key name="N"/>
+ <key name="M"/>
+ <key name="comma"/>
+ <key name="period"/>
+ <key name="question"/>
+ </row>
+ <row>
+ <key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
+ <key align="left" name="Caribou_Emoticons"/>
+ <key align="left" name="space" width="5.0"/>
+ <key align="right" name="Caribou_Prefs"/>
+ </row>
+ </level>
+</external>
\ No newline at end of file
diff --git a/data/layouts/touch/ara.xml b/data/layouts/touch/common/symbols.xml
similarity index 52%
rename from data/layouts/touch/ara.xml
rename to data/layouts/touch/common/symbols.xml
index f8787ff..94e3b80 100644
--- a/data/layouts/touch/ara.xml
+++ b/data/layouts/touch/common/symbols.xml
@@ -1,69 +1,24 @@
<?xml version="1.0" ?>
-<layout>
- <level mode="default" name="level1">
- <row>
- <key name="Arabic_dad"/>
- <key name="Arabic_sad"/>
- <key name="Arabic_qaf"/>
- <key name="Arabic_feh"/>
- <key name="Arabic_ghain"/>
- <key name="Arabic_ain"/>
- <key name="Arabic_ha"/>
- <key name="Arabic_khah"/>
- <key name="Arabic_hah"/>
- <key name="Arabic_jeem"/>
- <key name="BackSpace"/>
- </row>
- <row align="center">
- <key name="Arabic_sheen"/>
- <key name="Arabic_seen"/>
- <key name="Arabic_yeh"/>
- <key name="Arabic_beh"/>
- <key name="Arabic_lam"/>
- <key name="Arabic_alef"/>
- <key name="Arabic_teh"/>
- <key name="Arabic_noon"/>
- <key name="Arabic_meem"/>
- <key name="Arabic_kaf"/>
- </row>
- <row>
- <key name="Arabic_zah"/>
- <key name="Arabic_tah"/>
- <key name="Arabic_thal"/>
- <key name="Arabic_dal"/>
- <key name="Arabic_zain"/>
- <key name="Arabic_ra"/>
- <key name="Arabic_waw"/>
- <key name="Arabic_tehmarbuta"/>
- <key name="Arabic_theh"/>
- <key name="Return" width="2.0"/>
- </row>
- <row>
- <key align="left" name="Caribou_Symbols" toggle="symbols1" width="2.0"/>
- <key align="left" name="Arabic_fathatan"/>
- <key align="left" name="space" width="5.0"/>
- <key align="right" name="Caribou_Prefs"/>
- </row>
- </level>
+<external>
<level mode="locked" name="symbols1">
<row>
- <key name="Arabic_1"/>
- <key name="Arabic_2"/>
- <key name="Arabic_3"/>
- <key name="Arabic_4"/>
- <key name="Arabic_5"/>
- <key name="Arabic_6"/>
- <key name="Arabic_7"/>
- <key name="Arabic_8"/>
- <key name="Arabic_9"/>
- <key name="Arabic_0"/>
+ <key name="1"/>
+ <key name="2"/>
+ <key name="3"/>
+ <key name="4"/>
+ <key name="5"/>
+ <key name="6"/>
+ <key name="7"/>
+ <key name="8"/>
+ <key name="9"/>
+ <key name="0"/>
<key name="BackSpace"/>
</row>
- <row align="center">
+ <row align="right">
<key name="minus"/>
<key name="slash"/>
<key name="colon"/>
- <key name="Arabic_semicolon"/>
+ <key name="semicolon"/>
<key name="parenleft"/>
<key name="parenright"/>
<key name="dollar"/>
@@ -74,10 +29,16 @@
<row>
<key name="Caribou_Symbols_More" toggle="symbols2" width="2.0"/>
<key name="period"/>
- <key name="Arabic_comma"/>
- <key name="Arabic_question_mark"/>
+ <key name="comma"/>
+ <key name="question">
+ <key name="question"/>
+ <key name="questiondown"/>
+ </key>
<key name="slash"/>
- <key name="exclam"/>
+ <key name="exclam">
+ <key name="exclam"/>
+ <key name="exclamdown"/>
+ </key>
<key name="apostrophe"/>
<key name="quotedbl"/>
<key name="bar"/>
@@ -92,7 +53,7 @@
</level>
<level mode="locked" name="symbols2">
<row>
- <key name="Arabic_percent"/>
+ <key name="percent"/>
<key name="bracketleft"/>
<key name="bracketright"/>
<key name="braceleft"/>
@@ -104,8 +65,8 @@
<key name="underscore"/>
<key name="BackSpace"/>
</row>
- <row align="center">
- <key name="less"/>
+ <row align="right">
+ <key align="right" name="less"/>
<key name="greater"/>
<key name="asterisk"/>
<key name="semicolon"/>
@@ -135,5 +96,4 @@
<key align="right" name="Caribou_Prefs"/>
</row>
</level>
-</layout>
-
+</external>
diff --git a/data/layouts/touch/il.xml.in b/data/layouts/touch/il.xml.in
new file mode 100644
index 0000000..1e74a3a
--- /dev/null
+++ b/data/layouts/touch/il.xml.in
@@ -0,0 +1,51 @@
+<?xml version="1.0" ?>
+<layout xmlns:xi="http://www.w3.org/2001/XInclude">
+ <level mode="default" name="level1">
+ <row>
+ <key name="period"/>
+ <key name="comma"/>
+ <key name="hebrew_qoph"/>
+ <key name="hebrew_resh"/>
+ <key name="hebrew_aleph"/>
+ <key name="hebrew_tet"/>
+ <key name="hebrew_waw"/>
+ <key name="hebrew_finalnun"/>
+ <key name="hebrew_finalmem"/>
+ <key name="hebrew_pe"/>
+ <key name="BackSpace"/>
+ </row>
+ <row align="center">
+ <key name="hebrew_shin"/>
+ <key name="hebrew_dalet"/>
+ <key name="hebrew_gimel"/>
+ <key name="hebrew_kaph"/>
+ <key name="hebrew_ayin"/>
+ <key name="hebrew_yod"/>
+ <key name="hebrew_chet"/>
+ <key name="hebrew_lamed"/>
+ <key name="hebrew_finalkaph"/>
+ <key name="hebrew_finalpe"/>
+ </row>
+ <row>
+ <key name="hebrew_zain"/>
+ <key name="hebrew_samech"/>
+ <key name="hebrew_bet"/>
+ <key name="hebrew_he"/>
+ <key name="hebrew_nun"/>
+ <key name="hebrew_mem"/>
+ <key name="hebrew_zade"/>
+ <key name="hebrew_taw"/>
+ <key name="hebrew_finalzade"/>
+ <key name="Return" width="2.0"/>
+ </row>
+ <row>
+ <key name="Caribou_Symbols" align="left" toggle="symbols1" width="2.0"/>
+ <key name="Caribou_Emoticons" align="left"/>
+ <key name="space" width="5.0" align="left"/>
+ <key name="Caribou_Prefs" align="right"/>
+ </row>
+ </level>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols1'])"/>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols2'])"/>
+</layout>
+
diff --git a/data/layouts/touch/us.xml.in b/data/layouts/touch/us.xml.in
new file mode 100644
index 0000000..d0cda7b
--- /dev/null
+++ b/data/layouts/touch/us.xml.in
@@ -0,0 +1,8 @@
+<?xml version="1.0" ?>
+<layout xmlns:xi="http://www.w3.org/2001/XInclude">
+ <xi:include href="common/qwerty.xml#xpointer(//level[ name='level1'])"/>
+ <xi:include href="common/qwerty.xml#xpointer(//level[ name='level2'])"/>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols1'])"/>
+ <xi:include href="common/symbols.xml#xpointer(//level[ name='symbols2'])"/>
+</layout>
+
diff --git a/tools/basic.xsl b/tools/basic.xsl
new file mode 100644
index 0000000..722bafa
--- /dev/null
+++ b/tools/basic.xsl
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<xsl:stylesheet version="1.0"
+ xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+ xmlns:gen="dummy-namespace-for-the-generated-xslt">
+
+ <xsl:namespace-alias stylesheet-prefix="gen" result-prefix="xsl"/>
+ <xsl:output method="xml" indent="yes"/>
+ <xsl:template match="/">
+ <gen:stylesheet version="1.0">
+ <gen:output method="xml" indent="yes"/>
+ <gen:template match="@*|node()">
+ <gen:copy>
+ <gen:apply-templates select="@*|node()"/>
+ </gen:copy>
+ </gen:template>
+
+ <gen:template match="//override"/>
+
+ <xsl:apply-templates/>
+ </gen:stylesheet>
+ </xsl:template>
+
+ <xsl:template match="text()"/>
+
+ <xsl:template match="//override">
+ <gen:template>
+ <xsl:attribute name="match"><xsl:value-of select="@xpath"/></xsl:attribute>
+ <xsl:copy-of select="node()/."/>
+ </gen:template>
+ </xsl:template>
+
+</xsl:stylesheet>
\ No newline at end of file
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]