[Po4a-devel]Simplify the tag kind verification

Francois Gouget fgouget@free.fr
Thu, 19 May 2005 12:14:44 +0200 (CEST)


  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

---1463809536-1548235044-1116497684=:4743
Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed


set_tags_kind() uses this code to verify the tag kind:

    if ($_ ne 'translate' && $_ ne 'empty' && $_ ne 'verbatim'  && $_ ne 'ignore' && $_ ne 'indent');

This seemed pretty long and unclear so I changed it to the equivalent:

    if ($_ !~ /^(translate|empty|verbatim|ignore|indent)$/);

Which I feel is more compact, readable and maintainable. But as I said 
the two are functionally equivalent so it's partly a matter of taste. 
Anyway, here's the patch.


Changelog:

  * po4a/lib/Locale/Po4a/Sgml.pm

    Francois Gouget <fgouget@free.fr>
    Use a regular expression to simplify the tag kind check.

-- 
Francois Gouget         fgouget@free.fr        http://fgouget.free.fr/
Nouvelle version : les anciens bogues ont \xE9t\xE9 remplac\xE9s par de nouveaux.
---1463809536-1548235044-1116497684=:4743
Content-Type: TEXT/plain; charset=US-ASCII; name=po4a-kind.diff
Content-Transfer-Encoding: BASE64
Content-ID: <Pine.LNX.4.62.0505191214440.4743@amboise.dolphin>
Content-Description: po4a-kind.diff
Content-Disposition: attachment; filename=po4a-kind.diff

SW5kZXg6IHBvNGEvbGliL0xvY2FsZS9QbzRhL1NnbWwucG0NCj09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT0NClJDUyBmaWxlOiAvY3Zzcm9vdC93aW5lL2RvY3Mv
cG80YS9saWIvTG9jYWxlL1BvNGEvU2dtbC5wbSx2DQpyZXRyaWV2aW5nIHJl
dmlzaW9uIDEuMS4xLjENCmRpZmYgLXUgLXAgLXIxLjEuMS4xIFNnbWwucG0N
Ci0tLSBwbzRhL2xpYi9Mb2NhbGUvUG80YS9TZ21sLnBtCTE0IE1heSAyMDA1
IDEyOjM3OjM1IC0wMDAwCTEuMS4xLjENCisrKyBwbzRhL2xpYi9Mb2NhbGUv
UG80YS9TZ21sLnBtCTE5IE1heSAyMDA1IDEwOjAwOjExIC0wMDAwDQpAQCAt
MjgwLDcgKzI4MCw3IEBAIHN1YiBzZXRfdGFnc19raW5kIHsNCiAgICAgDQog
ICAgIGZvcmVhY2ggKGtleXMgJWtpbmRzKSB7DQogCWRpZSAicG80YTo6c2dt
bDogaW50ZXJuYWwgZXJyb3I6IHNldF90YWdzX2tpbmQgY2FsbGVkIHdpdGgg
dW5yZWNvZ25pemVkIGFyZyAkXyINCi0JICAgIGlmICgkXyBuZSAndHJhbnNs
YXRlJyAmJiAkXyBuZSAnZW1wdHknICYmICRfIG5lICd2ZXJiYXRpbScgICYm
ICRfIG5lICdpZ25vcmUnICYmICRfIG5lICdpbmRlbnQnKTsNCisJICAgIGlm
ICgkXyAhfiAvXih0cmFuc2xhdGV8ZW1wdHl8dmVyYmF0aW18aWdub3JlfGlu
ZGVudCkkLyk7DQogCQ0KIAkkc2VsZi0+e1NHTUx9LT57a317JF99IC49ICRr
aW5kc3skX307DQogICAgIH0gICAgDQo=

---1463809536-1548235044-1116497684=:4743--