diff options
Diffstat (limited to 'Master/texmf-dist/tex/latex')
5 files changed, 905 insertions, 403 deletions
diff --git a/Master/texmf-dist/tex/latex/phonenumbers/FR_Ortsnamen.tex b/Master/texmf-dist/tex/latex/phonenumbers/FR_Ortsnamen.tex index 5c8e6f0c719..a402c0a2a61 100644 --- a/Master/texmf-dist/tex/latex/phonenumbers/FR_Ortsnamen.tex +++ b/Master/texmf-dist/tex/latex/phonenumbers/FR_Ortsnamen.tex @@ -1,5 +1,5 @@ % phonenumbers package: French place names -% Datum: 22. August 2016 +% Datum: 6. November 2016 \tl_const:cn {c_phone_FR_ortsname_01_tl} {\^{I}le-de-France} \tl_const:cn {c_phone_FR_ortsname_02_tl} {Nord-ouest} \tl_const:cn {c_phone_FR_ortsname_0262_tl} {La~R\a'{e}union} @@ -13,6 +13,14 @@ \tl_const:cn {c_phone_FR_ortsname_0594_tl} {Guyane} \tl_const:cn {c_phone_FR_ortsname_0596_tl} {Martinique} \tl_const:cn {c_phone_FR_ortsname_06_tl} {t\a'{e}l\a'{e}phone~mobile} +\tl_const:cn {c_phone_FR_ortsname_0639_tl} {t\a'{e}l\a'{e}phone~mobile~(Mayotte)} +\tl_const:cn {c_phone_FR_ortsname_0690_tl} {t\a'{e}l\a'{e}phone~mobile~(Guadeloupe)} +\tl_const:cn {c_phone_FR_ortsname_0691_tl} {t\a'{e}l\a'{e}phone~mobile~(Guadeloupe)} +\tl_const:cn {c_phone_FR_ortsname_0692_tl} {t\a'{e}l\a'{e}phone~mobile~(La~R\a'{e}union)} +\tl_const:cn {c_phone_FR_ortsname_0693_tl} {t\a'{e}l\a'{e}phone~mobile~(La~R\a'{e}union)} +\tl_const:cn {c_phone_FR_ortsname_0694_tl} {t\a'{e}l\a'{e}phone~mobile~(Guyane)} +\tl_const:cn {c_phone_FR_ortsname_0696_tl} {t\a'{e}l\a'{e}phone~mobile~(Martinique)} +\tl_const:cn {c_phone_FR_ortsname_0697_tl} {t\a'{e}l\a'{e}phone~mobile~(Martinique)} \tl_const:cn {c_phone_FR_ortsname_07_tl} {t\a'{e}l\a'{e}phone~mobile} \tl_const:cn {c_phone_FR_ortsname_08_tl} {Service~\a`{a}~valeur~ajout\a'{e}e} -\tl_const:cn {c_phone_FR_ortsname_09_tl} {Service~t\a'{e}l\a'{e}fonique~en~VoIP} +\tl_const:cn {c_phone_FR_ortsname_09_tl} {Service~t\a'{e}l\a'{e}phonique~en~VoIP} diff --git a/Master/texmf-dist/tex/latex/phonenumbers/FR_Vorwahlen.tex b/Master/texmf-dist/tex/latex/phonenumbers/FR_Vorwahlen.tex index 5ef0238ca23..c9541379d9c 100644 --- a/Master/texmf-dist/tex/latex/phonenumbers/FR_Vorwahlen.tex +++ b/Master/texmf-dist/tex/latex/phonenumbers/FR_Vorwahlen.tex @@ -1,5 +1,5 @@ % phonenumbers package: French area codes -% Datum: 22. August 2016 +% Datum: 6. November 2016 \clist_const:Nn \c_phone_FR_ortsvorwahlliste_clist {01, 02, 0262, @@ -13,6 +13,14 @@ 0594, 0596} \clist_const:Nn \c_phone_FR_sondervorwahlliste_clist {06, +0639, +0690, +0691, +0692, +0693, +0694, +0696, +0697, 07, 08, 09} diff --git a/Master/texmf-dist/tex/latex/phonenumbers/US_Ortsnamen.tex b/Master/texmf-dist/tex/latex/phonenumbers/US_Ortsnamen.tex index 96c1c134f67..ae590826a51 100644 --- a/Master/texmf-dist/tex/latex/phonenumbers/US_Ortsnamen.tex +++ b/Master/texmf-dist/tex/latex/phonenumbers/US_Ortsnamen.tex @@ -1,5 +1,5 @@ % phonenumbers package: place names of the North American Numbering Plan -% Datum: 22. August 2016 +% Datum: 6. November 2016 \tl_const:cn {c_phone_US_ortsname_201_tl} {New~Jersey} \tl_const:cn {c_phone_US_ortsname_202_tl} {Washington,~D.\,C.} \tl_const:cn {c_phone_US_ortsname_203_tl} {Connecticut} @@ -75,6 +75,7 @@ \tl_const:cn {c_phone_US_ortsname_325_tl} {Texas} \tl_const:cn {c_phone_US_ortsname_330_tl} {Ohio} \tl_const:cn {c_phone_US_ortsname_331_tl} {Illinois} +\tl_const:cn {c_phone_US_ortsname_332_tl} {New~York} \tl_const:cn {c_phone_US_ortsname_334_tl} {Alabama} \tl_const:cn {c_phone_US_ortsname_336_tl} {North~Carolina} \tl_const:cn {c_phone_US_ortsname_337_tl} {Louisiana} @@ -127,6 +128,7 @@ \tl_const:cn {c_phone_US_ortsname_443_tl} {Maryland} \tl_const:cn {c_phone_US_ortsname_450_tl} {Quebec} \tl_const:cn {c_phone_US_ortsname_458_tl} {Oregon} +\tl_const:cn {c_phone_US_ortsname_463_tl} {Indiana} \tl_const:cn {c_phone_US_ortsname_469_tl} {Texas} \tl_const:cn {c_phone_US_ortsname_470_tl} {Georgia} \tl_const:cn {c_phone_US_ortsname_473_tl} {Grenada} @@ -166,6 +168,7 @@ \tl_const:cn {c_phone_US_ortsname_561_tl} {Florida} \tl_const:cn {c_phone_US_ortsname_562_tl} {California} \tl_const:cn {c_phone_US_ortsname_563_tl} {Iowa} +\tl_const:cn {c_phone_US_ortsname_564_tl} {Washington} \tl_const:cn {c_phone_US_ortsname_567_tl} {Ohio} \tl_const:cn {c_phone_US_ortsname_570_tl} {Pennsylvania} \tl_const:cn {c_phone_US_ortsname_571_tl} {Virginia} @@ -221,6 +224,7 @@ \tl_const:cn {c_phone_US_ortsname_670_tl} {Northern~Mariana~Islands} \tl_const:cn {c_phone_US_ortsname_671_tl} {Guam} \tl_const:cn {c_phone_US_ortsname_678_tl} {Georgia} +\tl_const:cn {c_phone_US_ortsname_680_tl} {New~York} \tl_const:cn {c_phone_US_ortsname_681_tl} {West~Virginia} \tl_const:cn {c_phone_US_ortsname_682_tl} {Texas} \tl_const:cn {c_phone_US_ortsname_684_tl} {American~Samoa} @@ -245,6 +249,7 @@ \tl_const:cn {c_phone_US_ortsname_721_tl} {Sint~Maarten} \tl_const:cn {c_phone_US_ortsname_724_tl} {Pennsylvania} \tl_const:cn {c_phone_US_ortsname_725_tl} {Nevada} +\tl_const:cn {c_phone_US_ortsname_726_tl} {Texas} \tl_const:cn {c_phone_US_ortsname_727_tl} {Florida} \tl_const:cn {c_phone_US_ortsname_731_tl} {Tennessee} \tl_const:cn {c_phone_US_ortsname_732_tl} {New~Jersey} @@ -300,6 +305,7 @@ \tl_const:cn {c_phone_US_ortsname_830_tl} {Texas} \tl_const:cn {c_phone_US_ortsname_831_tl} {California} \tl_const:cn {c_phone_US_ortsname_832_tl} {Texas} +\tl_const:cn {c_phone_US_ortsname_838_tl} {New~York} \tl_const:cn {c_phone_US_ortsname_843_tl} {South~Carolina} \tl_const:cn {c_phone_US_ortsname_845_tl} {New~York} \tl_const:cn {c_phone_US_ortsname_847_tl} {Illinois} @@ -371,6 +377,7 @@ \tl_const:cn {c_phone_US_ortsname_980_tl} {North~Carolina} \tl_const:cn {c_phone_US_ortsname_984_tl} {North~Carolina} \tl_const:cn {c_phone_US_ortsname_985_tl} {Louisiana} +\tl_const:cn {c_phone_US_ortsname_986_tl} {Idaho} \tl_const:cn {c_phone_US_ortsname_989_tl} {Michigan} \tl_const:cn {c_phone_US_ortsname_456_tl} {Inbound~International} \tl_const:cn {c_phone_US_ortsname_500_tl} {Non-Geographic~Service} diff --git a/Master/texmf-dist/tex/latex/phonenumbers/US_Vorwahlen.tex b/Master/texmf-dist/tex/latex/phonenumbers/US_Vorwahlen.tex index 7fce68ef7d7..6eaea3a6b7f 100644 --- a/Master/texmf-dist/tex/latex/phonenumbers/US_Vorwahlen.tex +++ b/Master/texmf-dist/tex/latex/phonenumbers/US_Vorwahlen.tex @@ -1,5 +1,5 @@ % phonenumbers package: area codes of the North American Numbering Plan -% Datum: 22. August 2016 +% Datum: 6. November 2016 \clist_const:Nn \c_phone_US_ortsvorwahlliste_clist {201, 202, 203, @@ -75,6 +75,7 @@ 325, 330, 331, +332, 334, 336, 337, @@ -127,6 +128,7 @@ 443, 450, 458, +463, 469, 470, 473, @@ -166,6 +168,7 @@ 561, 562, 563, +564, 567, 570, 571, @@ -221,6 +224,7 @@ 670, 671, 678, +680, 681, 682, 684, @@ -245,6 +249,7 @@ 721, 724, 725, +726, 727, 731, 732, @@ -300,6 +305,7 @@ 830, 831, 832, +838, 843, 845, 847, @@ -371,7 +377,193 @@ 980, 984, 985, +986, 989} +\clist_const:Nn \c_phone_US_ortsvorwahlliste_ten_digits_clist {201, +203, +204, +% 208, Bisher 7D, 10D ab 5. September 2017 (Einführung von 986 in Idaho) +% 210, Bisher 7D, 10D ab 23. Oktober 2017 (Einführung von 726 in Texas) +212, +214, +215, +220, +224, +226, +234, +236, +240, +248, +249, +250, +256, +267, +270, +272, +281, +289, +301, +303, +304, +305, +310, +312, +% 315, Bisher 7D, 10D ab 11. März 2017 (Einführung von 680 in New York) +317, +% 321, "Home NPA local calls are 7D in Brevard County" +330, +331, +332, +336, +339, +343, +346, +347, +351, +% 360, Bisher 7D, 10D ab 28. August 2017 (Einführung von 564 in Washington) +364, +365, +380, +385, +402, +403, +404, +407, +408, +410, +412, +415, +416, +418, +419, +424, +430, +431, +437, +438, +442, +443, +450, +458, +463, +469, +470, +475, +484, +503, +508, +512, +514, +% 518, Bisher 7D, 10D ab 19. September 2017 (Einführung von 838 in New York) +519, +531, +534, +539, +541, +548, +551, +564, +567, +570, +571, +579, +581, +587, +601, +604, +610, +613, +614, +615, +617, +628, +629, +630, +631, +639, +646, +647, +657, +667, +669, +678, +680, +681, +682, +702, +703, +704, +706, +713, +714, +715, +718, +720, +724, +725, +726, +732, +737, +740, +743, +747, +754, +760, +762, +769, +770, +773, +774, +778, +779, +780, +781, +782, +786, +787, +801, +809, +812, +815, +817, +818, +819, +825, +829, +832, +838, +843, +847, +848, +849, +854, +857, +860, +862, +872, +873, +878, +902, +903, +905, +917, +918, +919, +929, +930, +934, +938, +939, +947, +954, +959, +971, +972, +973, +978, +980, +984, +986} \clist_const:Nn \c_phone_US_sondervorwahlliste_clist {456, 500, 522, diff --git a/Master/texmf-dist/tex/latex/phonenumbers/phonenumbers.sty b/Master/texmf-dist/tex/latex/phonenumbers/phonenumbers.sty index 745638121a4..4d8b3e5fc92 100644 --- a/Master/texmf-dist/tex/latex/phonenumbers/phonenumbers.sty +++ b/Master/texmf-dist/tex/latex/phonenumbers/phonenumbers.sty @@ -1,9 +1,9 @@ % phonenumbers.sty % LaTeX-Paket zur Formatierung von Telefonnummern % LaTeX package for formatting telephone numbers -% Version 1.0 -% Autor: Keno Wehr -% 22. August 2016 +% Autor: K. Wehr +% Version: 1.1 +% Datum: 6. November 2016 % This work may be distributed and/or modified under the % conditions of the LaTeX Project Public License, either version 1.3 @@ -15,75 +15,48 @@ \RequirePackage{expl3} -\ProvidesExplPackage {phonenumbers} {2016/07/01} {1.0} {Telephone number package} +\ProvidesExplPackage {phonenumbers} {2016/11/06} {1.1} {Telephone number package} \RequirePackage{xparse} \RequirePackage{l3keys2e} +\RequirePackage{ltxcmds} + +\clist_const:Nn \c_phone_ziffern_clist {0,1,2,3,4,5,6,7,8,9} + +\tl_const:Nn \c_phone_bindestrich_tl {\kern1pt - \kern1pt} \str_new:N \l_phone_land_str +\str_new:N \l_phone_heimatland_str \str_new:N \l_phone_auslandsvorwahltyp_str \str_new:N \l_phone_vorwahldarstellung_str \str_new:N \l_phone_vorwahltrennung_str - -\keys_define:nn {phonenumbers} - { - country .choices:nn = {DE,FR,US} - { - \str_set_eq:NN \l_phone_land_str \l_keys_choice_tl - }, - country .initial:n = DE, - country .value_required:n = true - } - -\keys_define:nn {phonenumbers} - { - foreign .choices:nn = {off,european,american,international} - { - \str_set_eq:NN \l_phone_auslandsvorwahltyp_str \l_keys_choice_tl - }, - foreign .initial:n = off, - foreign .default:n = international - } - -\keys_define:nn {phonenumbers} - { - area-code .choices:nn = {number,place,place-and-number} - { - \str_set_eq:NN \l_phone_vorwahldarstellung_str \l_keys_choice_tl - }, - area-code .initial:n = number, - area-code .value_required:n = true - } - -\keys_define:nn {phonenumbers} - { - area-code-sep .choices:nn = {space,slash,brackets,hyphen} - { - \str_set_eq:NN \l_phone_vorwahltrennung_str \l_keys_choice_tl - }, - area-code-sep .initial:n = slash, - area-code-sep .value_required:n = true - } - -\clist_const:Nn \c_phone_ziffern_clist {0,1,2,3,4,5,6,7,8,9} - -\tl_const:Nn \c_phone_bindestrich_tl {\kern1pt - \kern1pt} +\str_new:N \l_phone_heimatvorwahl_str +\str_new:N \l_phone_bereinigte_eingabe_str +\str_new:N \l_phone_linktext_str \int_new:N \l_phone_ziffernzahl_int -\str_new:N \l_phone_bereinigte_eingabe_str + +\tl_new:N \l_phone_ausgabetext_tl \tl_new:N \l_phone_formatierte_nummer_tl -\clist_new:N \l_phone_erlaubte_zeichen_clist + \bool_new:N \l_phone_vorwahl_gefunden_bool \bool_new:N \l_phone_zeilenumbruch_bool \bool_new:N \l_phone_eingabe_leer_bool \bool_new:N \l_phone_durchwahl_leer_bool +\bool_new:N \l_phone_nummer_verlinken_bool -\cs_generate_variant:Nn \tl_if_eq:nnTF {xnTF} -\cs_generate_variant:Nn \tl_if_eq:nnTF {VnTF} -\cs_generate_variant:Nn \tl_if_eq:nnT {VnT} \cs_generate_variant:Nn \str_if_eq:nnT {xnT} \cs_generate_variant:Nn \str_if_eq:nnTF {xnTF} -\cs_generate_variant:Nn \str_case:nnTF {xnTF} +\cs_generate_variant:Nn \str_case:nn {Vn,xn} +\cs_generate_variant:Nn \str_case:nnF {VnF,xnF} +\cs_generate_variant:Nn \str_case:nnTF {VnTF,xnTF} +\cs_generate_variant:Nn \str_put_right:Nn {NV} +\cs_generate_variant:Nn \tl_put_right:Nn {Nv} +\cs_generate_variant:Nn \msg_new:nnn {nnx} +\cs_generate_variant:Nn \msg_info:nnn {nnV} +\cs_generate_variant:Nn \msg_info:nnnn {nnnv} +\cs_generate_variant:Nn \msg_warning:nnnn {nnnx} + \msg_new:nnn {phonenumbers} {illegal~character} { @@ -107,7 +80,7 @@ \msg_new:nnn {phonenumbers} {invalid~area~code} { - unknown~area~code~(Ortsvorwahl)~in~#1~phone~number~\msg_line_context: + unknown~area~code~(Vorwahl)~in~#1~phone~number~\msg_line_context: } \msg_new:nnn {phonenumbers} {number~too~short} @@ -125,43 +98,133 @@ #1~phone~number~has~no~legal~number~of~digits~\msg_line_context: } -\msg_new:nnn {phonenumbers} {subscriber~number~too~short} +\msg_new:nnn {phonenumbers} {illegal~extension} { - subscriber~number~(Teilnehmerrufnummer)~has~less~than~#2~digits~in~#1~phone~number~\msg_line_context: + extension~(Durchwahl)~of~#1~phone~number~ignored~\msg_line_context: } -\msg_new:nnn {phonenumbers} {subscriber~number~too~long} +\msg_new:nnn {phonenumbers} {home~area~code~set} { - subscriber~number~(Teilnehmerrufnummer)~has~more~than~#2~digits~in~#1~phone~number~\msg_line_context: + Your~home~is~in~#2~(area~code~#1)~according~to~line~\msg_line_number:. } -\msg_new:nnn {phonenumbers} {illegal~start~of~subscriber~number} +\msg_new:nnn {phonenumbers} {home~area~code~cleared} { - subscriber~number~(Teilnehmerrufnummer)~starts~with~'#2'~in~#1~phone~number~\msg_line_context: - } + home~area~code~#1~was~deleted~\msg_line_context: + } -\msg_new:nnn {phonenumbers} {illegal~extension} +\msg_new:nnn {phonenumbers} {invalid~home~area~code} { - extension~(Durchwahl)~of~#1~phone~number~ignored~\msg_line_context: + #1~unknown~as~#2~geographic~area~code~(Ortsvorwahl)~\msg_line_context: } -\cs_new:Npn \phone_nummernlaenge_ueberpruefen:Nnnn #1#2#3#4 - { - \int_set:Nn \l_tmpa_int {\str_count:N #1} - \int_compare:nNnTF {\l_tmpa_int} < {#2} +\cs_new:Npn \phone_landesadjektiv:n #1 + { + \str_case:nn {#1} { - \msg_warning:nnnn {phonenumbers} {number~too~short} {#4} {#2} + {DE} {German} + {FR} {French} + {US} {American} } + } + +\cs_generate_variant:Nn \phone_landesadjektiv:n {V} + + +\keys_define:nn {phonenumbers} + { + country .choices:nn = {DE,FR,US} + { + \str_set_eq:NN \l_phone_land_str \l_keys_choice_tl + }, + country .initial:n = DE, + country .value_required:n = true + } + +\keys_define:nn {phonenumbers} + { + foreign .choices:nn = {off,european,american,international} + { + \str_set_eq:NN \l_phone_auslandsvorwahltyp_str \l_keys_choice_tl + }, + foreign .initial:n = off, + foreign .default:n = international + } + +\keys_define:nn {phonenumbers} + { + area-code .choices:nn = {number,place,place-and-number} + { + \str_set_eq:NN \l_phone_vorwahldarstellung_str \l_keys_choice_tl + }, + area-code .initial:n = number, + area-code .value_required:n = true + } + +\keys_define:nn {phonenumbers} + { + area-code-sep .choices:nn = {space,slash,brackets,hyphen} + { + \str_set_eq:NN \l_phone_vorwahltrennung_str \l_keys_choice_tl + }, + area-code-sep .initial:n = slash, + area-code-sep .value_required:n = true + } + +\keys_define:nn {phonenumbers} + { + link .choices:nn = {on,off} { - \int_compare:nNnT {\l_tmpa_int} > {#3} + \str_if_eq:VnTF \l_keys_choice_tl {on} { - \msg_warning:nnnn {phonenumbers} {number~too~long} {#4} {#3} + \bool_set_true:N \l_phone_nummer_verlinken_bool } - } + { + \bool_set_false:N \l_phone_nummer_verlinken_bool + } + }, + link .initial:n = on, + link .value_required:n = true + } + +\keys_define:nn {phonenumbers} + { + home-area-code .code:n = + { + \str_if_eq:nnTF {#1}{none} + { + \str_if_empty:NF \l_phone_heimatvorwahl_str + { + \msg_info:nnV {phonenumbers} {home~area~code~cleared} \l_phone_heimatvorwahl_str + \str_clear:N \l_phone_heimatvorwahl_str + } + } + { + \str_case:VnF {\l_phone_land_str} + { + {FR} {\phone_FR_heimatvorwahl_festlegen:n {#1}} + {US} {\phone_US_heimatvorwahl_festlegen:n {#1}} + } + { + \clist_if_in:cnTF {c_phone_\l_phone_land_str _ortsvorwahlliste_clist} {#1} + { + \str_set_eq:NN \l_phone_heimatland_str \l_phone_land_str + \str_set:Nn \l_phone_heimatvorwahl_str {#1} + \msg_info:nnnv {phonenumbers} {home~area~code~set} {#1} {c_phone_\l_phone_land_str _ortsname_#1_tl} + } + { + \msg_warning:nnnx {phonenumbers} {invalid~home~area~code} {#1} {\phone_landesadjektiv:V \l_phone_land_str} + } + } + } + }, + home-area-code .initial:n = none, + home-area-code .value_required:n = true } -\cs_new:Npn \phone_gruppiere_ziffernfolge:n #1 + +\cs_new:Npn \phone_gruppierte_ziffernfolge_ausgeben:n #1 { \int_set:Nn \l_phone_ziffernzahl_int {\tl_count:n {#1}} \tl_clear:N \l_phone_formatierte_nummer_tl @@ -177,38 +240,42 @@ } } - \tl_use:N \l_phone_formatierte_nummer_tl + \tl_put_right:NV \l_phone_ausgabetext_tl \l_phone_formatierte_nummer_tl } -\cs_generate_variant:Nn \phone_gruppiere_ziffernfolge:n {V} -\cs_generate_variant:Nn \phone_gruppiere_ziffernfolge:n {x} +\cs_generate_variant:Nn \phone_gruppierte_ziffernfolge_ausgeben:n {V,x} + \cs_new:Npn \phone_auslandsvorwahl_ausgeben:n #1 { - \str_case:onTF {\l_phone_land_str} + \str_case:VnTF \l_phone_land_str { {DE} { } {FR} { } } { - \str_case:on {\l_phone_auslandsvorwahltyp_str} + \str_case:Vn \l_phone_auslandsvorwahltyp_str { - {international} {+ #1} - {european} {\phone_gruppiere_ziffernfolge:n {00#1}} - {american} {\phone_gruppiere_ziffernfolge:n {011#1}} + {international} {\tl_put_right:Nn \l_phone_ausgabetext_tl {+#1}} + {european} {\phone_gruppierte_ziffernfolge_ausgeben:n {00#1}} + {american} {\phone_gruppierte_ziffernfolge_ausgeben:n {011#1}} } } { - \str_case:on {\l_phone_auslandsvorwahltyp_str} + \tl_put_right:Nx \l_phone_ausgabetext_tl { - {international} {+ #1} - {european} {00 #1} - {american} {011 #1} + \str_case:Vn \l_phone_auslandsvorwahltyp_str + { + {international} {+ #1} + {european} {00 #1} + {american} {011 #1} + } } } } -\cs_generate_variant:Nn \phone_auslandsvorwahl_ausgeben:n {V} +\cs_generate_variant:Nn \phone_auslandsvorwahl_ausgeben:n {x} + % #1: eingebene Nummer, #2: Handelt es sich um eine Durchwahl? \cs_new:Npn \phone_eingabe_ueberpruefen:nN #1#2 @@ -249,37 +316,59 @@ } } -\cs_new:Npn \phone_nummer_ausgeben:n #1 +\cs_new:Npn \phone_nummerntext_ausgeben: + { + \bool_if:nTF {\l_phone_nummer_verlinken_bool && !\str_if_empty_p:N \l_phone_linktext_str} + { + \ltx@ifpackageloaded {hyperref} + { + \href{tel\c_colon_str\l_phone_linktext_str}{\l_phone_ausgabetext_tl} + } + { + \l_phone_ausgabetext_tl + } + } + { + \l_phone_ausgabetext_tl + } + } + +\cs_new:Npn \phone_nummer_ohne_durchwahl_ausgeben:n #1 { \phone_eingabe_ueberpruefen:nN {#1} \c_false_bool \bool_if:NF \l_phone_eingabe_leer_bool { - \str_case:on {\l_phone_land_str} + \str_case:Vn \l_phone_land_str { {DE} {\phone_DE_nummer_ausgeben:V \l_phone_bereinigte_eingabe_str} {FR} {\phone_FR_nummer_ausgeben:V \l_phone_bereinigte_eingabe_str} {US} {\phone_US_nummer_ausgeben:V \l_phone_bereinigte_eingabe_str} } } + + \phone_nummerntext_ausgeben: } +% #1: Nummer, #2: Durchwahl \cs_new:Npn \phone_nummer_mit_durchwahl_ausgeben:nn #1#2 { - \str_if_eq:VnTF {\l_phone_land_str} {DE} + \str_if_eq:VnTF \l_phone_land_str {DE} { \phone_eingabe_ueberpruefen:nN {#1} \c_false_bool \str_set_eq:NN \l_tmpa_str \l_phone_bereinigte_eingabe_str \phone_eingabe_ueberpruefen:nN {#2} \c_true_bool - \str_set_eq:NN \l_tmpb_str \l_phone_bereinigte_eingabe_str + \str_set_eq:NN \l_phone_DE_durchwahl_str \l_phone_bereinigte_eingabe_str + + \phone_DE_nummer_ausgeben:V \l_tmpa_str - \phone_DE_nummer_mit_durchwahl_ausgeben:VV \l_tmpa_str \l_tmpb_str + \phone_nummerntext_ausgeben: } { \str_set:Nx \l_tmpa_str { - \str_case:on {\l_phone_land_str} + \str_case:Vn \l_phone_land_str { {FR} {French} {US} {American} @@ -293,14 +382,14 @@ \msg_warning:nnx {phonenumbers} {illegal~extension} {\l_tmpa_str} } - \phone_nummer_ausgeben:n {#1} + \phone_nummer_ohne_durchwahl_ausgeben:n {#1} } } \cs_new:Npn \phone_vorwahlliste_ausgeben:n #1 { \begin{tabbing} - \str_case:onF \l_phone_land_str + \str_case:VnF \l_phone_land_str { {US} {\hspace{3em}} } @@ -311,7 +400,7 @@ \bool_set_false:N \l_phone_zeilenumbruch_bool - \clist_map_inline:cn {c_phone_\str_use:N \l_phone_land_str _#1_clist} + \clist_map_inline:cn {c_phone_\l_phone_land_str _#1_clist} { \bool_if:NTF \l_phone_zeilenumbruch_bool { @@ -321,10 +410,13 @@ \bool_gset_true:N \l_phone_zeilenumbruch_bool } - \str_case:onF \l_phone_land_str + \str_case:VnTF \l_phone_land_str { - {DE} {\phone_DE_gruppiere_vorwahl:nN {##1} \c_true_bool} - {FR} {\phone_gruppiere_ziffernfolge:n {##1}} + {DE} {\phone_DE_gruppierte_vorwahl_ausgeben:nN {##1} \c_true_bool} + {FR} {\phone_gruppierte_ziffernfolge_ausgeben:n {##1}} + } + { + \tl_use:N \l_phone_ausgabetext_tl } { ##1 @@ -359,7 +451,7 @@ \phone_nummer_mit_durchwahl_ausgeben:nn {#2} {#3} } { - \phone_nummer_ausgeben:n {#2} + \phone_nummer_ohne_durchwahl_ausgeben:n {#2} } \group_end: } @@ -400,9 +492,26 @@ \str_new:N \l_phone_DE_vorwahl_str \str_new:N \l_phone_DE_durchwahl_str \int_new:N \l_phone_DE_hauptnummerlaenge_int +\bool_new:N \l_phone_DE_teilnehmerrufnummer_gueltig_bool + +\msg_new:nnn {phonenumbers} {DE/subscriber~number~too~short} + { + subscriber~number~(Teilnehmerrufnummer)~has~less~than~#1~digits~in~German~phone~number~\msg_line_context: + } + +\msg_new:nnn {phonenumbers} {DE/subscriber~number~too~long} + { + subscriber~number~(Teilnehmerrufnummer)~has~more~than~#1~digits~in~German~phone~number~\msg_line_context: + } + +\msg_new:nnn {phonenumbers} {DE/illegal~start~of~subscriber~number} + { + subscriber~number~(Teilnehmerrufnummer)~starts~with~0~in~German~phone~number~\msg_line_context: + } + % #1: Vorwahl, #2: Soll die führende null ausgegeben werden? -\cs_new:Npn \phone_DE_gruppiere_vorwahl:nN #1#2 +\cs_new:Npn \phone_DE_gruppierte_vorwahl_ausgeben:nN #1#2 { \int_compare:nNnTF {\str_count:n {#1}} = {5} { @@ -411,44 +520,50 @@ \bool_if:nTF {\str_if_eq_p:Vn \l_tmpa_str {0137} || \str_if_eq_p:Vn \l_tmpa_str {0180}} { - \phone_gruppiere_ziffernfolge:V \l_tmpa_str - \, - \str_use:N \l_tmpb_str + \bool_if:nTF {#2} + { + \phone_gruppierte_ziffernfolge_ausgeben:V \l_tmpa_str + } + { + \phone_gruppierte_ziffernfolge_ausgeben:x {\str_tail:N \l_tmpa_str} + } + + \tl_put_right:Nn \l_phone_ausgabetext_tl {\,} + \tl_put_right:NV \l_phone_ausgabetext_tl \l_tmpb_str } { \bool_if:nTF {#2} { - \phone_gruppiere_ziffernfolge:n {#1} + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} } { - \phone_gruppiere_ziffernfolge:x {\str_range:nnn {#1} {2} {-1}} + \phone_gruppierte_ziffernfolge_ausgeben:x {\str_tail:n {#1}} } } } { \bool_if:nTF {#2} { - \phone_gruppiere_ziffernfolge:n {#1} + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} } { - \phone_gruppiere_ziffernfolge:x {\str_range:nnn {#1} {2} {-1}} + \phone_gruppierte_ziffernfolge_ausgeben:x {\str_tail:n {#1}} } } } % #1: Vorwahl, #2: Soll die führende null ausgegeben werden? -\cs_new:Npn \phone_DE_klammere_vorwahl:nN #1#2 +\cs_new:Npn \phone_DE_geklammerte_vorwahl_ausgeben:nN #1#2 { - \tl_set:Nn \l_tmpa_tl {\phone_DE_gruppiere_vorwahl:nN {#1} #2} - + % Klammern werden nur bei Ortsvorwahlen gesetzt \clist_if_in:NnTF \c_phone_DE_ortsvorwahlliste_clist {#1} { - ( - \l_tmpa_tl - ) + \tl_put_right:Nn \l_phone_ausgabetext_tl {(} + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} #2 + \tl_put_right:Nn \l_phone_ausgabetext_tl {)} } { - \l_tmpa_tl + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} #2 } } @@ -465,98 +580,112 @@ } } - \str_case:on \l_phone_vorwahldarstellung_str + \bool_if:nF {\str_if_eq_p:Vn \l_phone_heimatland_str {DE} && \str_if_eq_p:Vn \l_phone_heimatvorwahl_str {#1}} { - {number} + \str_case:Vn \l_phone_vorwahldarstellung_str { - \bool_if:NTF #2 + {number} { - \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} - { - \phone_DE_klammere_vorwahl:nN {#1} \c_true_bool - - \c_space_tl - } + \bool_if:NTF #2 { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_true_bool - - \str_case:onF {\l_phone_vorwahltrennung_str} + \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} { - {space} {\c_space_tl} - {hyphen} {\c_phone_bindestrich_tl} + \phone_DE_geklammerte_vorwahl_ausgeben:nN {#1} \c_true_bool + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl } { - \slash + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_true_bool + + \tl_put_right:Nx \l_phone_ausgabetext_tl + { + \str_case:VnF \l_phone_vorwahltrennung_str + { + {space} {\c_space_tl} + {hyphen} {\c_phone_bindestrich_tl} + } + { + \slash + } + } } } - } - { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_true_bool - } - } - {place} - { - \bool_if:NTF #2 - { - \str_if_eq:VnT \l_phone_vorwahltrennung_str {brackets} - { - ( - } - - \tl_if_exist:cTF {c_phone_DE_ortsname_#1_tl} - { - \tl_use:c {c_phone_DE_ortsname_#1_tl} - } - { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_true_bool - } - - \str_case:onF \l_phone_vorwahltrennung_str - { - {brackets} {) \c_space_tl} - {space} {\c_space_tl} - {hyphen} {\c_phone_bindestrich_tl} - } { - \slash + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_true_bool } } + {place} { - \tl_if_exist:cTF {c_phone_DE_ortsname_#1_tl} + \bool_if:NTF #2 { - \tl_use:c {c_phone_DE_ortsname_#1_tl} + \str_if_eq:VnT \l_phone_vorwahltrennung_str {brackets} + { + \tl_put_right:Nn \l_phone_ausgabetext_tl {(} + } + + \tl_if_exist:cTF {c_phone_DE_ortsname_#1_tl} + { + \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_DE_ortsname_#1_tl} + } + { + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_true_bool + } + + \tl_put_right:Nx \l_phone_ausgabetext_tl + { + \str_case:VnF \l_phone_vorwahltrennung_str + { + {brackets} {) \c_space_tl} + {space} {\c_space_tl} + {hyphen} {\c_phone_bindestrich_tl} + } + { + \slash + } + } } { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_true_bool + \tl_if_exist:cTF {c_phone_DE_ortsname_#1_tl} + { + \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_DE_ortsname_#1_tl} + } + { + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_true_bool + } } } - } - {place-and-number} - { - \tl_if_exist:cT {c_phone_DE_ortsname_#1_tl} - { - \tl_use:c {c_phone_DE_ortsname_#1_tl} - \c_space_tl - } - - \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} - { - \phone_DE_klammere_vorwahl:nN {#1} \c_true_bool - - \bool_if:NT #2 {\c_space_tl} - } + {place-and-number} { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_true_bool - - \bool_if:NT #2 + \tl_if_exist:cT {c_phone_DE_ortsname_#1_tl} { - \str_case:onF {\l_phone_vorwahltrennung_str} + \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_DE_ortsname_#1_tl} + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl + } + + \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} + { + \phone_DE_geklammerte_vorwahl_ausgeben:nN {#1} \c_true_bool + + \bool_if:NT #2 { - {space} {\c_space_tl} - {hyphen} {\c_phone_bindestrich_tl} + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl } + } + { + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_true_bool + + \bool_if:NT #2 { - \slash + \tl_put_right:Nx \l_phone_ausgabetext_tl + { + \str_case:VnF \l_phone_vorwahltrennung_str + { + {space} {\c_space_tl} + {hyphen} {\c_phone_bindestrich_tl} + } + { + \slash + } + } } } } @@ -565,68 +694,107 @@ } { \phone_auslandsvorwahl_ausgeben:n {49} - \c_space_tl + + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} { - \phone_DE_klammere_vorwahl:nN {#1} \c_false_bool + \phone_DE_geklammerte_vorwahl_ausgeben:nN {#1} \c_false_bool } { - \phone_DE_gruppiere_vorwahl:nN {#1} \c_false_bool + \phone_DE_gruppierte_vorwahl_ausgeben:nN {#1} \c_false_bool } \bool_if:NT #2 { - \c_space_tl + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl } } + + % Linktext schreiben, falls eine Rufnummer folgt + \bool_if:NT #2 + { + \str_put_right:Nn \l_phone_linktext_str {+49} + \str_put_right:Nx \l_phone_linktext_str {\str_tail:n {#1}} + } } \cs_generate_variant:Nn \phone_DE_vorwahl_ausgeben:nN {Vx} + +% #1: Nummer, #2: Mindestlänge, #3: Höchstlänge, #4: Nummernart +\cs_new:Npn \phone_DE_nummernlaenge_ueberpruefen:Nnnn #1#2#3#4 + { + \int_set:Nn \l_tmpa_int {\str_count:N #1} + + \int_compare:nNnTF {\l_tmpa_int} < {#2} + { + \msg_warning:nnnn {phonenumbers} {number~too~short} {German~#4} {#2} + } + { + \int_compare:nNnTF {\l_tmpa_int} > {#3} + { + \msg_warning:nnnn {phonenumbers} {number~too~long} {German~#4} {#3} + } + { + \bool_set_true:N \l_phone_DE_teilnehmerrufnummer_gueltig_bool + } + } + } + +% #1: Vorwahl, #2: Teilnehmerrufnummer +\cs_new:Npn \phone_DE_teilnehmerrufnummernlaenge_ueberpruefen:Nn #1#2 + { + \int_set:Nn \l_tmpa_int {\str_count:N #1} + \int_add:Nn \l_tmpa_int {\str_count:n {#2}} + \int_add:Nn \l_tmpa_int {\str_count:N \l_phone_DE_durchwahl_str} + + \int_compare:nNnTF {\l_tmpa_int} > {12} + { + \msg_warning:nnnn {phonenumbers} {number~too~long} {German} {12} + } + { + \int_set:Nn \l_tmpa_int {\str_count:n {#2}} + \int_add:Nn \l_tmpa_int {\str_count:N \l_phone_DE_durchwahl_str} + + \int_compare:nNnTF {\l_tmpa_int} < {3} + { + \msg_warning:nnn {phonenumbers/DE} {subscriber~number~too~short} {3} + } + { + \int_compare:nNnTF {\l_tmpa_int} > {8} + { + \msg_warning:nnn {phonenumbers/DE} {subscriber~number~too~long} {8} + } + { + \bool_set_true:N \l_phone_DE_teilnehmerrufnummer_gueltig_bool + } + } + } + } + % #1: Vorwahl, #2: Teilnehmerrufnummer \cs_new:Npn \phone_DE_teilnehmerrufnummer_ausgeben:Nn #1 #2 { - \str_if_empty:NTF {#1} + % Überprüfen der Nummernlänge + \str_if_empty:NTF #1 { % Festnetznummer ohne Vorwahl - \str_set:Nn \l_tmpa_str {#2} - \str_put_right:Nx \l_tmpa_str {\l_phone_DE_durchwahl_str} - \bool_if:NF \l_phone_eingabe_leer_bool { - \phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {3} {8} {German} + \phone_DE_teilnehmerrufnummernlaenge_ueberpruefen:Nn #1 {#2} } } { \clist_if_in:NVTF \c_phone_DE_ortsvorwahlliste_clist #1 { % Festnetznummer - \str_if_eq:xnTF {\str_range:nnn {#2} {1} {1}} {0} + \str_if_eq:xnTF {\str_head:n {#2}} {0} { - \msg_warning:nnnn {phonenumbers} {illegal~start~of~subscriber~number} {German} {0} + \msg_warning:nn {phonenumbers/DE} {illegal~start~of~subscriber~number} } { - \int_set:Nn \l_tmpa_int {\str_count:n {#2} + \str_count:N \l_phone_DE_durchwahl_str} - - \int_compare:nNnTF {\l_tmpa_int} > {8} - { - \msg_warning:nnnn {phonenumbers} {subscriber~number~too~long} {German} {8} - } - { - \int_compare:nNnTF {\l_tmpa_int} < {3} - { - \msg_warning:nnnn {phonenumbers} {subscriber~number~too~short} {German} {3} - } - { - \int_set:Nn \l_tmpb_int {\str_count:N #1 + \l_tmpa_int} - - \int_compare:nNnT {\l_tmpb_int} > {12} - { - \msg_warning:nnnn {phonenumbers} {number~too~long} {German} {12} - } - } - } + \phone_DE_teilnehmerrufnummernlaenge_ueberpruefen:Nn #1 {#2} } } { @@ -636,67 +804,81 @@ \str_if_eq:xnTF {\str_range:Nnn #1 {1} {5}} {09009} { - \phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {German~09009} + \phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {09009} } { - \str_case_x:nnF {\str_range:Nnn #1 {1} {4}} + \str_case:xnF {\str_range:Nnn #1 {1} {4}} { - {0137} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {German~0137}} - {0160} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {German~mobile}} - {0162} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {German~mobile}} - {0163} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {German~mobile}} - {0180} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {German~0180}} - {0181} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {8} {15} {German~0181}} - {0191} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {5} {German~0191}} - {0194} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {7} {7} {German~0194}} - {0700} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {German~0700}} - {0800} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {German~0800}} - {0900} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {German~0900}} + {0137} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {0137}} + {0160} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {mobile}} + {0162} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {mobile}} + {0163} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {mobile}} + {0164} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {14} {0164}} % Funkruf + {0168} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {15} {0168}} % Funkruf + {0169} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {15} {0169}} % Funkruf + {0180} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {0180}} + {0181} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {8} {15} {0181}} + {0191} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {5} {0191}} + {0194} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {7} {7} {0194}} + {0700} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {0700}} + {0800} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {0800}} + {0900} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {11} {0900}} } { - \str_case_x:nn {\str_range:Nnn #1 {1} {3}} + \str_case:xn {\str_range:Nnn #1 {1} {3}} { - {015} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {German~mobile}} - {017} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {German~mobile}} - {018} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {German~018}} + {015} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {mobile}} + {017} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {11} {12} {mobile}} + {018} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {018}} {019} { - \phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {7} {German~019} + \phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {5} {7} {019} \int_compare:nNnT {\str_count:N \l_tmpa_str} = {6} { - \msg_warning:nnn {phonenumbers} {illegal~length} {German~019} + \msg_warning:nnn {phonenumbers} {illegal~length} {019} + \bool_set_false:N \l_phone_DE_teilnehmerrufnummer_gueltig_bool } } - {032} {\phone_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {German~032}} + {032} {\phone_DE_nummernlaenge_ueberpruefen:Nnnn \l_tmpa_str {12} {12} {032}} } } } } + + \bool_if:NTF \l_phone_DE_teilnehmerrufnummer_gueltig_bool + { + % Für gültige Nummern mit Vorwahl Linktext schreiben: + \str_put_right:Nn \l_phone_linktext_str {#2} + \str_put_right:NV \l_phone_linktext_str \l_phone_DE_durchwahl_str + } + { + % Für ungültige Nummern mit Vorwahl Linktext löschen: + \str_clear:N \l_phone_linktext_str + } } - \phone_gruppiere_ziffernfolge:n {#2} + \bool_if:NTF \l_phone_DE_teilnehmerrufnummer_gueltig_bool + { + \phone_gruppierte_ziffernfolge_ausgeben:n {#2} + } + { + \str_put_right:Nn \l_phone_ausgabetext_tl {#2} + } \str_if_empty:NF \l_phone_DE_durchwahl_str { - \c_phone_bindestrich_tl \phone_gruppiere_ziffernfolge:V \l_phone_DE_durchwahl_str + \tl_put_right:NV \l_phone_ausgabetext_tl \c_phone_bindestrich_tl + \phone_gruppierte_ziffernfolge_ausgeben:V \l_phone_DE_durchwahl_str } } \cs_generate_variant:Nn \phone_DE_teilnehmerrufnummer_ausgeben:Nn {Nx} -\cs_new:Npn \phone_DE_nummer_mit_durchwahl_ausgeben:nn #1#2 - { - \str_set:Nn \l_phone_DE_durchwahl_str {#2} - - \phone_DE_nummer_ausgeben:n {#1} - } - -\cs_generate_variant:Nn \phone_DE_nummer_mit_durchwahl_ausgeben:nn {VV} -\cs_new:Npn \phone_DE_nummer_ausgeben:n #1 +\cs_new_protected:Npn \phone_DE_nummer_ausgeben:n #1 { - \str_if_eq_x:nnTF {\str_head:n {#1}} {0} + \str_if_eq:xnTF {\str_head:n {#1}} {0} { \int_set:Nn \l_phone_DE_hauptnummerlaenge_int {\str_count:n {#1}} @@ -753,12 +935,66 @@ \int_new:N \l_phone_FR_nummerlaenge_int +\msg_new:nnn {phonenumbers} {FR/illegal~home~area~code} + { + The~only~legal~home~area~code~in~France~is~0508~(Saint-Pierre-et-Miquelon).~#1~cannot~be~set~as~home~area~code~\msg_line_context:. + } + \msg_new:nnn {phonenumbers} {FR/missing~zero} { French~phone~number~has~no~zero~in~the~beginning~\msg_line_context: } -% #1: Vorwahl, #2: Folgt eine Rufnummer? + +% #1: Heimatvorwahl +\cs_new:Npn \phone_FR_heimatvorwahl_festlegen:n #1 + { + \clist_if_in:NnTF {\c_phone_FR_ortsvorwahlliste_clist} {#1} + { + % In Frankreich ist nur 0508 für Saint-Pierre-et-Miquelon als Heimatvorwahl erlaubt: + \str_if_eq:nnTF {#1} {0508} + { + \str_set:Nn \l_phone_heimatland_str {FR} + \str_set:Nn \l_phone_heimatvorwahl_str {#1} + \msg_info:nnnv {phonenumbers} {home~area~code~set} {#1} {c_phone_FR_ortsname_#1_tl} + } + { + \msg_warning:nnn {phonenumbers/FR} {illegal~home~area~code} {#1} + } + } + { + % keine gültige Ortsvorwahl: + \msg_warning:nnnn {phonenumbers} {invalid~home~area~code} {#1} {French} + } + } + +% #1: Vorwahl +\cs_new:Npn \phone_FR_ermittle_landeskennzahl:n #1 + { + \str_case:nnF {#1} + { + {0262} {262} + {026200} {262} + {0269} {262} + {0508} {508} + {0590} {590} + {0594} {594} + {0596} {596} + {0639} {262} + {0690} {590} + {0691} {590} + {0692} {262} + {0693} {262} + {0694} {594} + {0696} {596} + {0697} {596} + } + { + 33 + } + } + +% #1: Vorwahl \cs_new:Npn \phone_FR_vorwahl_ausgeben:n #1 { \str_if_eq:VnTF \l_phone_auslandsvorwahltyp_str {off} @@ -771,65 +1007,58 @@ } } - \str_case:on \l_phone_vorwahldarstellung_str + \bool_if:nF {\str_if_eq_p:Vn \l_phone_heimatland_str {FR} && \str_if_eq_p:Vn \l_phone_heimatvorwahl_str {#1}} { - {number} - { - \phone_gruppiere_ziffernfolge:n {#1} - \, - } - {place} + \str_case:Vn \l_phone_vorwahldarstellung_str { - \tl_if_exist:cTF {c_phone_FR_ortsname_#1_tl} + {number} { - \tl_use:c {c_phone_FR_ortsname_#1_tl} - \c_space_tl + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} + \tl_put_right:Nn \l_phone_ausgabetext_tl {\,} } + {place} { - \phone_gruppiere_ziffernfolge:n {#1} - \, + \tl_if_exist:cTF {c_phone_FR_ortsname_#1_tl} + { + \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_FR_ortsname_#1_tl} + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl + } + { + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} + \tl_put_right:Nn \l_phone_ausgabetext_tl {\,} + } } - } - {place-and-number} - { - \tl_if_exist:cT {c_phone_FR_ortsname_#1_tl} + {place-and-number} { - \tl_use:c {c_phone_FR_ortsname_#1_tl} - \c_space_tl + \tl_if_exist:cT {c_phone_FR_ortsname_#1_tl} + { + \tl_put_right:Nv \l_phone_ausgabetext_tl {c_phone_FR_ortsname_#1_tl} + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl + } + + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} + \tl_put_right:NV \l_phone_ausgabetext_tl {\,} } - - \phone_gruppiere_ziffernfolge:n {#1} - \, } } } { - \str_set:Nx \l_tmpa_str - { - \str_case:nnF {#1} - { - {0262} {262} - {026200} {262} - {0269} {262} - {0508} {508} - {0590} {590} - {0594} {594} - {0596} {596} - } - { - 33 - } - } - - \phone_auslandsvorwahl_ausgeben:V {\l_tmpa_str} - \c_space_tl + \phone_auslandsvorwahl_ausgeben:x {\phone_FR_ermittle_landeskennzahl:n {#1}} + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl \str_if_eq:nnF {#1} {0508} % in Saint-Pierre-et-Miquelon entfällt die Ortsvorwahl { - \phone_gruppiere_ziffernfolge:x {\str_tail:n {#1}} - \, + \phone_gruppierte_ziffernfolge_ausgeben:x {\str_tail:n {#1}} + \tl_put_right:Nn \l_phone_ausgabetext_tl {\,} } } + + \str_put_right:Nx \l_phone_linktext_str {+\phone_FR_ermittle_landeskennzahl:n {#1}} + + \str_if_eq:nnF {#1} {0508} % in Saint-Pierre-et-Miquelon entfällt die Ortsvorwahl + { + \str_put_right:Nx \l_phone_linktext_str {\str_tail:n {#1}} + } } \cs_generate_variant:Nn \phone_FR_vorwahl_ausgeben:n {V} @@ -841,37 +1070,38 @@ \int_compare:nNnTF {\l_phone_FR_nummerlaenge_int} < {10} { - \str_if_eq_x:nnTF {\str_head:n {#1}} {3} + \str_if_eq:xnTF {\str_head:n {#1}} {3} { \int_compare:nNnTF {\l_phone_FR_nummerlaenge_int} < {4} { \msg_warning:nnnn {phonenumbers} {number~too~short} {French~short} {4} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } { \int_compare:nNnTF {\l_phone_FR_nummerlaenge_int} > {4} { \msg_warning:nnnn {phonenumbers} {number~too~long} {French~short} {4} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } { - \phone_gruppiere_ziffernfolge:n {#1} + \phone_gruppierte_ziffernfolge_ausgeben:n {#1} + \str_put_right:Nn \l_phone_linktext_str {#1} } } } { \msg_warning:nnnn {phonenumbers} {number~too~short} {French} {10} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } } { \int_compare:nNnTF {\l_phone_FR_nummerlaenge_int} > {10} { \msg_warning:nnnn {phonenumbers} {number~too~long} {French} {10} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } { - \str_if_eq_x:nnTF {\str_head:n {#1}} {0} + \str_if_eq:xnTF {\str_head:n {#1}} {0} { \bool_set_false:N \l_phone_vorwahl_gefunden_bool @@ -889,10 +1119,9 @@ \phone_FR_vorwahl_ausgeben:V \l_tmpa_str - \phone_gruppiere_ziffernfolge:x - { - \str_range:nnn {#1} {##1 + 1} {-1} - } + \str_set:Nx \l_tmpb_str {\str_range:nnn {#1} {##1 + 1} {-1}} + \phone_gruppierte_ziffernfolge_ausgeben:V \l_tmpb_str + \str_put_right:NV \l_phone_linktext_str \l_tmpb_str } } } @@ -901,12 +1130,12 @@ \bool_if:nF {\l_phone_vorwahl_gefunden_bool} { \msg_warning:nnn {phonenumbers} {invalid~area~code} {French} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } } { \msg_warning:nn {phonenumbers/FR} {missing~zero} - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } } } @@ -923,14 +1152,19 @@ \clist_new:N \c_phone_US_vorwahlliste_clist \clist_concat:NNN \c_phone_US_vorwahlliste_clist \c_phone_US_ortsvorwahlliste_clist \c_phone_US_sondervorwahlliste_clist +\msg_new:nnn {phonenumbers} {US/illegal~home~area~code} + { + 10-digit~dialling~is~required~in~\tl_use:c {c_phone_US_ortsname_#1_tl}.~#1~cannot~be~set~as~home~area~code~\msg_line_context:. + } + \msg_new:nnn {phonenumbers} {US/invalid~area~code} { - unknown~area~code~"#1"~in~American~phone~number~\msg_line_context: + unknown~area~code~#1~in~American~phone~number~\msg_line_context: } \msg_new:nnn {phonenumbers} {US/invalid~central~office~code} { - invalid~central~office~code~"#1"~in~American~phone~number~\msg_line_context: + invalid~central~office~code~#1~in~American~phone~number~\msg_line_context: } \bool_new:N \l_phone_US_ferngespraechspraefix_bool @@ -951,70 +1185,121 @@ trunk-prefix .default:n = on } + +% #1: Heimatvorwahl +\cs_new:Npn \phone_US_heimatvorwahl_festlegen:n #1 + { + \clist_if_in:NnTF {\c_phone_US_ortsvorwahlliste_clist} {#1} + { + \clist_if_in:NnTF {\c_phone_US_ortsvorwahlliste_ten_digits_clist} {#1} + { + % 10-Ziffern-Wählen erforderlich: + \msg_warning:nnn {phonenumbers/US} {illegal~home~area~code} {#1} + } + { + % 7-Ziffern-Wählen möglich, Heimatvorwahl setzen: + \str_set:Nn \l_phone_heimatland_str {US} + \str_set:Nn \l_phone_heimatvorwahl_str {#1} + \msg_info:nnnv {phonenumbers} {home~area~code~set} {#1} {c_phone_US_ortsname_#1_tl} + } + } + { + % keine gültige Ortsvorwahl: + \msg_warning:nnnn {phonenumbers} {invalid~home~area~code} {#1} {American} + } + } + % #1: Vorwahl, #2: Folgt eine Rufnummer? \cs_new:Npn \phone_US_vorwahl_ausgeben:nN #1 #2 { \str_if_eq:VnTF \l_phone_auslandsvorwahltyp_str {off} { - \bool_if:NTF \l_phone_US_ferngespraechspraefix_bool + \bool_if:nF {\str_if_eq_p:Vn \l_phone_heimatland_str {US} && \str_if_eq_p:Vn \l_phone_heimatvorwahl_str {#1}} { - \bool_if:NTF #2 - { - \str_if_eq:onTF {\l_phone_vorwahltrennung_str} {space} - { - 1 \c_space_tl #1 \c_space_tl - } - { - 1 \c_phone_bindestrich_tl #1 \c_phone_bindestrich_tl - } - } + \bool_if:NTF \l_phone_US_ferngespraechspraefix_bool { - \str_if_eq:onTF {\l_phone_vorwahltrennung_str} {space} - { - 1 \c_space_tl #1 - } + \bool_if:NTF #2 { - 1 \c_phone_bindestrich_tl #1 + \str_if_eq:VnTF \l_phone_vorwahltrennung_str {space} + { + \tl_put_right:Nn \l_phone_ausgabetext_tl {1 \c_space_tl #1 \c_space_tl} + } + { + \tl_put_right:Nn \l_phone_ausgabetext_tl {1 \c_phone_bindestrich_tl #1 \c_phone_bindestrich_tl} + } } - } - } - { - \clist_if_in:NnT \c_phone_US_sondervorwahlliste_clist {#1} - { - \str_if_eq:VnT \l_phone_vorwahldarstellung_str {place} { - \str_set:Nn \l_phone_vorwahldarstellung_str {number} + \str_if_eq:VnTF \l_phone_vorwahltrennung_str {space} + { + \tl_put_right:Nn \l_phone_ausgabetext_tl {1 \c_space_tl #1} + } + { + \tl_put_right:Nn \l_phone_ausgabetext_tl {1 \c_phone_bindestrich_tl #1} + } } } - - \str_case:on \l_phone_vorwahldarstellung_str { - {number} + \clist_if_in:NnT \c_phone_US_sondervorwahlliste_clist {#1} { - \bool_if:NTF #2 - { - \str_case:onF \l_phone_vorwahltrennung_str - { - {brackets} {(#1) \c_space_tl} - {space} {#1 \c_space_tl} - } - { - #1 \c_phone_bindestrich_tl - } - } + \str_if_eq:VnT \l_phone_vorwahldarstellung_str {place} { - #1 + \str_set:Nn \l_phone_vorwahldarstellung_str {number} } } - {place} + + \tl_put_right:Nx \l_phone_ausgabetext_tl { - \bool_if:NTF #2 + \str_case:Vn \l_phone_vorwahldarstellung_str { - \str_case:onF \l_phone_vorwahltrennung_str + {number} + { + \bool_if:NTF #2 + { + \str_case:VnF \l_phone_vorwahltrennung_str + { + {brackets} {(#1) \c_space_tl} + {space} {#1 \c_space_tl} + } + { + #1 \c_phone_bindestrich_tl + } + } + { + #1 + } + } + {place} { - {brackets} + \bool_if:NTF #2 + { + \str_case:VnF \l_phone_vorwahltrennung_str + { + {brackets} + { + ( + \tl_if_exist:cTF {c_phone_US_ortsname_#1_tl} + { + \tl_use:c {c_phone_US_ortsname_#1_tl} + } + { + #1 + } + ) + \c_space_tl + } + } + { + \tl_if_exist:cTF {c_phone_US_ortsname_#1_tl} + { + \tl_use:c {c_phone_US_ortsname_#1_tl} + \c_space_tl + } + { + #1 \c_phone_bindestrich_tl + } + } + } { - ( \tl_if_exist:cTF {c_phone_US_ortsname_#1_tl} { \tl_use:c {c_phone_US_ortsname_#1_tl} @@ -1022,57 +1307,36 @@ { #1 } - ) - \c_space_tl } } + {place-and-number} { - \tl_if_exist:cTF {c_phone_US_ortsname_#1_tl} + \tl_if_exist:cT {c_phone_US_ortsname_#1_tl} { \tl_use:c {c_phone_US_ortsname_#1_tl} \c_space_tl } + + \bool_if:NTF #2 { - #1 \c_phone_bindestrich_tl + \str_case:VnF \l_phone_vorwahltrennung_str + { + {brackets} {(#1) \c_space_tl} + {space} {#1 \c_space_tl} + } + { + #1 \c_phone_bindestrich_tl + } + } + { + \str_if_eq:VnTF \l_phone_vorwahltrennung_str {brackets} + { + (#1) + } + { + #1 + } } - } - } - { - \tl_if_exist:cTF {c_phone_US_ortsname_#1_tl} - { - \tl_use:c {c_phone_US_ortsname_#1_tl} - } - { - #1 - } - } - } - {place-and-number} - { - \tl_if_exist:cT {c_phone_US_ortsname_#1_tl} - { - \tl_use:c {c_phone_US_ortsname_#1_tl} - \c_space_tl - } - - \bool_if:NTF #2 - { - \str_case:onF \l_phone_vorwahltrennung_str - { - {brackets} {(#1) \c_space_tl} - {space} {#1 \c_space_tl} - } - { - #1 \c_phone_bindestrich_tl - } - } - { - \str_if_eq:onTF \l_phone_vorwahltrennung_str {brackets} - { - (#1) - } - { - #1 } } } @@ -1081,18 +1345,25 @@ } { \phone_auslandsvorwahl_ausgeben:n {1} - \c_space_tl - #1 + + \tl_put_right:Nn \l_phone_ausgabetext_tl {\c_space_tl #1} \bool_if:NT #2 { - \c_space_tl + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl } } + + % Linktext schreiben, falls eine Rufnummer folgt + \bool_if:NT #2 + { + \str_put_right:Nn \l_phone_linktext_str {+1 #1} + } } \cs_generate_variant:Nn \phone_US_vorwahl_ausgeben:nN {VN} + % #1: Ortsvorwahl, #2: Vermittlungsstellennummer \cs_new:Npn \phone_US_vermittlungsstellennummer_ausgeben:nn #1 #2 { @@ -1133,18 +1404,32 @@ } } - #2 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#2} + \str_if_eq:VnTF \l_phone_auslandsvorwahltyp_str {off} { - \c_phone_bindestrich_tl + \tl_put_right:NV \l_phone_ausgabetext_tl \c_phone_bindestrich_tl } { - \tl_if_empty:nTF {#1} {\c_phone_bindestrich_tl} {\c_space_tl} + \tl_if_empty:nTF {#1} + { + \tl_put_right:NV \l_phone_ausgabetext_tl \c_phone_bindestrich_tl + } + { + \tl_put_right:NV \l_phone_ausgabetext_tl \c_space_tl + } + } + + % Linktext schreiben, falls eine Vorwahl vorangeht + \tl_if_empty:nF {#1} + { + \str_put_right:Nn \l_phone_linktext_str {#2} } } \cs_generate_variant:Nn \phone_US_vermittlungsstellennummer_ausgeben:nn {Vx} + \cs_new:Npn \phone_US_nummer_ausgeben:n #1 { \int_case:nnF {\str_count:n {#1}} @@ -1164,7 +1449,8 @@ {7} { \phone_US_vermittlungsstellennummer_ausgeben:Vx \c_empty_tl {\str_range:nnn {#1} {1} {3}} - \str_range:nnn {#1} {4} {7} + + \tl_put_right:Nx \l_phone_ausgabetext_tl {\str_range:nnn {#1} {4} {7}} } {10} { @@ -1179,7 +1465,8 @@ \phone_US_vermittlungsstellennummer_ausgeben:Vx \l_tmpa_str {\str_range:nnn {#1} {4} {6}} - \str_range:nnn {#1} {7} {10} + \tl_put_right:Nx \l_phone_ausgabetext_tl {\str_range:nnn {#1} {7} {10}} + \str_put_right:Nx \l_phone_linktext_str {\str_range:nnn {#1} {7} {10}} } } { @@ -1191,7 +1478,7 @@ \msg_warning:nnnn {phonenumbers} {number~too~long} {American} {10} } - #1 + \tl_put_right:Nn \l_phone_ausgabetext_tl {#1} } } |