summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2025-04-07 07:02:18 +0200
committerMartin Fischer <martin@push-f.com>2025-04-13 23:18:01 +0200
commit766ec45bb50c4e4335e7529f070e87af510c3914 (patch)
tree7ba687b40e09459c90b93ae58cef80a386cc580b
parent43c782b50fe9c5acbfd04139337873326015e27d (diff)
refactor: convert countries.json to TOML
-rw-r--r--default.nix2
-rw-r--r--go.mod2
-rw-r--r--go.sum2
-rw-r--r--lex-serve/countries.json218
-rw-r--r--lex-serve/countries.toml215
-rw-r--r--lex-serve/main.go16
6 files changed, 231 insertions, 224 deletions
diff --git a/default.nix b/default.nix
index c93187e..52527c2 100644
--- a/default.nix
+++ b/default.nix
@@ -4,7 +4,7 @@ pkgs.buildGoModule {
pname = "lex-surf";
version = "git";
src = ./.;
- vendorHash = "sha256-8FDvleOMW1EzFQ116fQR7iKsETj9ZhXC7LFgAbSoLM4=";
+ vendorHash = "sha256-AfMqgXH9+FJ9SRa8FnL6LaoZ4M6RCQpiYChVz6eJbBk=";
postInstall = ''
cp -r lex-serve/assets $out/
diff --git a/go.mod b/go.mod
index e2f8382..31d4f00 100644
--- a/go.mod
+++ b/go.mod
@@ -2,5 +2,7 @@ module push-f.com/lex-surf
go 1.23.5
+require github.com/BurntSushi/toml v1.5.0
+
// test dependencies
require github.com/peter-evans/patience v0.3.0
diff --git a/go.sum b/go.sum
index 9d6ce76..96bcfa4 100644
--- a/go.sum
+++ b/go.sum
@@ -1,2 +1,4 @@
github.com/peter-evans/patience v0.3.0 h1:rX0JdJeepqdQl1Sk9c9uvorjYYzL2TfgLX1adqYm9cA=
github.com/peter-evans/patience v0.3.0/go.mod h1:Kmxu5sY1NmBLFSStvXjX1wS9mIv7wMcP/ubucyMOAu0=
+github.com/BurntSushi/toml v1.5.0 h1:W5quZX/G/csjUnuI8SUYlsHs9M38FC7znL0lIO+DvMg=
+github.com/BurntSushi/toml v1.5.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
diff --git a/lex-serve/countries.json b/lex-serve/countries.json
deleted file mode 100644
index d7f8cc1..0000000
--- a/lex-serve/countries.json
+++ /dev/null
@@ -1,218 +0,0 @@
-{
- "al": {
- "name": "Albania",
- "search_url": "https://qbz.gov.al/search;q=%s"
- },
- "am": {
- "name": "Armenia",
- "search_url": "http://www.parliament.am/search.php?where=laws&what=%s"
- },
- "ar": {
- "name": "Argentina",
- "search_url": "https://www.boletinoficial.gob.ar/busquedaAvanzada/primera"
- },
- "at": {
- "name": "Austria",
- "search_url": "https://www.ris.bka.gv.at/Ergebnis.wxe?Abfrage=Gesamtabfrage&Suchworte=%s"
- },
- "au": {
- "name": "Australia",
- "search_url": "https://www.legislation.gov.au/Search/%s"
- },
- "az": {
- "name": "Azerbaijan",
- "search_url": "https://meclis.gov.az/axtar-qanun.php?cat=72&soz=%s"
- },
- "be": {
- "name": "Belgium",
- "search_url": "https://www.ejustice.just.fgov.be/cgi_loi/loi_rech.pl?liste.x=&liste.y=&language=nl&text1=%s"
- },
- "bg": {
- "name": "Bulgaria",
- "search_url": "https://dv.parliament.bg/DVWeb/broeveList.faces"
- },
- "br": {
- "name": "Brazil",
- "search_url": "https://legislacao.presidencia.gov.br/"
- },
- "by": {
- "name": "Belarus",
- "search_url": "https://etalonline.by/kodeksy/"
- },
- "ca": {
- "name": "Canada",
- "search_url": "https://laws-lois.justice.gc.ca/Search/Search.aspx?txtS3archA11=%s"
- },
- "ch": {
- "name": "Switzerland",
- "search_url": "https://www.fedlex.admin.ch/de/search?text=%s"
- },
- "cy": {
- "name": "Cyprus",
- "search_url": "http://www.cylaw.org/cgi-bin/sinocgi.pl?directories=9&query=%s"
- },
- "cz": {
- "name": "Czech Republic",
- "search_url": "https://aplikace.mvcr.cz/sbirka-zakonu/SearchResult.aspx?typeLaw=zakon&what=Text_v_anotaci&q=%s"
- },
- "de": {
- "name": "Germany",
- "search_url": "https://www.gesetze-im-internet.de/cgi-bin/htsearch?config=Titel_bmjhome2005&method=and&words=%s"
- },
- "dk": {
- "name": "Denmark",
- "search_url": "https://www.retsinformation.dk/documents?t=%s"
- },
- "ee": {
- "name": "Estonia",
- "search_url": "https://www.riigiteataja.ee/otsingu_tulemus.html?otsisona=%s"
- },
- "es": {
- "name": "Spain",
- "search_url": "https://www.boe.es/buscar/legislacion.php?campo%5B0%5D=ID_SRC&dato%5B0%5D=&operador%5B0%5D=and&campo%5B1%5D=NOVIGENTE&operador%5B1%5D=and&campo%5B3%5D=CONSO&operador%5B3%5D=and&campo%5B2%5D=TIT&dato%5B2%5D=%s&checkbox_solo_tit=S&operador%5B2%5D=and&page_hits=50&sort_field%5B0%5D=PESO&sort_order%5B0%5D=desc&sort_field%5B1%5D=ref&sort_order%5B1%5D=asc&accion=Buscar"
- },
- "fi": {
- "name": "Finland",
- "search_url": "https://finlex.fi/fi/laki/haku/?search[type]=pika&search[pika]=%s"
- },
- "fr": {
- "name": "France",
- "search_url": "https://www.legifrance.gouv.fr/search/all?tab_selection=all&searchField=ALL&query=%s"
- },
- "gr": {
- "name": "Greece",
- "search_url": "http://www.et.gr/index.php/nomoi-proedrika-diatagmata"
- },
- "hr": {
- "name": "Croatia",
- "search_url": "https://sredisnjikatalogrh.gov.hr/cadial/search.php?action=search&query=%s"
- },
- "hu": {
- "name": "Hungary",
- "search_url": "https://njt.hu/"
- },
- "ie": {
- "name": "Ireland",
- "search_url": "http://www.irishstatutebook.ie/eli/ResultsTitle.html?q=%s"
- },
- "in": {
- "name": "India",
- "search_url": "https://www.indiacode.nic.in/handle/123456789/1362/simple-search?query=%s"
- },
- "is": {
- "name": "Iceland",
- "search_url": "https://www.stjornartidindi.is/"
- },
- "it": {
- "name": "Italy",
- "search_url": "https://www.normattiva.it/ricerca/veloce/0?testoRicerca=%s"
- },
- "jp": {
- "name": "Japan",
- "search_url": "https://elaws.e-gov.go.jp/result?allDocument=0&searchTargetAll=1&searchTextBox=%s&serchSelect=and&searchTarget_array=Constitution%2CAct%2CCabinetOrder%2CImperialOrder%2CMinisterialOrdinance%2CRule&classification_array=%E6%86%B2%E6%B3%95%2C%E5%88%91%E4%BA%8B%2C%E8%B2%A1%E5%8B%99%E9%80%9A%E5%89%87%2C%E6%B0%B4%E7%94%A3%E6%A5%AD%2C%E8%A6%B3%E5%85%89%2C%E5%9B%BD%E4%BC%9A%2C%E8%AD%A6%E5%AF%9F%2C%E5%9B%BD%E6%9C%89%E8%B2%A1%E7%94%A3%2C%E9%89%B1%E6%A5%AD%2C%E9%83%B5%E5%8B%99%2C%E8%A1%8C%E6%94%BF%E7%B5%84%E7%B9%94%2C%E6%B6%88%E9%98%B2%2C%E5%9B%BD%E7%A8%8E%2C%E5%B7%A5%E6%A5%AD%2C%E9%9B%BB%E6%B0%97%E9%80%9A%E4%BF%A1%2C%E5%9B%BD%E5%AE%B6%E5%85%AC%E5%8B%99%E5%93%A1%2C%E5%9B%BD%E5%9C%9F%E9%96%8B%E7%99%BA%2C%E4%BA%8B%E6%A5%AD%2C%E5%95%86%E6%A5%AD%2C%E5%8A%B4%E5%83%8D%2C%E8%A1%8C%E6%94%BF%E6%89%8B%E7%B6%9A%2C%E5%9C%9F%E5%9C%B0%2C%E5%9B%BD%E5%82%B5%2C%E9%87%91%E8%9E%8D%E3%83%BB%E4%BF%9D%E9%99%BA%2C%E7%92%B0%E5%A2%83%E4%BF%9D%E5%85%A8%2C%E7%B5%B1%E8%A8%88%2C%E9%83%BD%E5%B8%82%E8%A8%88%E7%94%BB%2C%E6%95%99%E8%82%B2%2C%E5%A4%96%E5%9B%BD%E7%82%BA%E6%9B%BF%E3%83%BB%E8%B2%BF%E6%98%93%2C%E5%8E%9A%E7%94%9F%2C%E5%9C%B0%E6%96%B9%E8%87%AA%E6%B2%BB%2C%E9%81%93%E8%B7%AF%2C%E6%96%87%E5%8C%96%2C%E9%99%B8%E9%81%8B%2C%E7%A4%BE%E4%BC%9A%E7%A6%8F%E7%A5%89%2C%E5%9C%B0%E6%96%B9%E8%B2%A1%E6%94%BF%2C%E6%B2%B3%E5%B7%9D%2C%E7%94%A3%E6%A5%AD%E9%80%9A%E5%89%87%2C%E6%B5%B7%E9%81%8B%2C%E7%A4%BE%E4%BC%9A%E4%BF%9D%E9%99%BA%2C%E5%8F%B8%E6%B3%95%2C%E7%81%BD%E5%AE%B3%E5%AF%BE%E7%AD%96%2C%E8%BE%B2%E6%A5%AD%2C%E8%88%AA%E7%A9%BA%2C%E9%98%B2%E8%A1%9B%2C%E6%B0%91%E4%BA%8B%2C%E5%BB%BA%E7%AF%89%E3%83%BB%E4%BD%8F%E5%AE%85%2C%E6%9E%97%E6%A5%AD%2C%E8%B2%A8%E7%89%A9%E9%81%8B%E9%80%81%2C%E5%A4%96%E4%BA%8B&lawNo1=&lawNo2=&lawNo3=&lawNo4=&dayPromulgation1_0=&dayPromulgation1_1=&dayPromulgation1_2=&dayPromulgation1_3=&dayPromulgation2_0=&dayPromulgation2_1=&dayPromulgation2_2=&dayPromulgation2_3=&dayPromulgation1=&dayPromulgation2=&lawDayFrom1=0&selectMenu=0&searchBtn=1"
- },
- "lt": {
- "name": "Lithuania",
- "search_url": "https://e-seimas.lrs.lt/portal/simpleSearch/lt"
- },
- "lu": {
- "name": "Luxembourg",
- "search_url": "http://legilux.public.lu/search/?fulltext=%s"
- },
- "lv": {
- "name": "Latvia",
- "search_url": "https://www.vestnesis.lv/rezultati/atbilstiba/on/locijums/on/lapa/1/skaits/20/kartot/datums/ta/on/izdeveji/saeima.likumi/teksts/%s"
- },
- "ma": {
- "name": "Malta",
- "search_url": "https://legislation.mt/Legislation"
- },
- "mk": {
- "name": "Macedonia",
- "search_url": "https://vlada.mk/search/node/%s%20language%3Amk%2Cund"
- },
- "mx": {
- "name": "Mexico",
- "search_url": "http://www.diputados.gob.mx/LeyesBiblio/index.htm"
- },
- "nl": {
- "name": "Netherlands",
- "search_url": "https://wetten.overheid.nl/zoeken/zoekresultaat/rs/2,3,4/titel/%s/titelf/1/tekstf/1/artnrb/0/d//dx/0"
- },
- "no": {
- "name": "Norway",
- "search_url": "https://lovdata.no/sok?q=%s"
- },
- "nz": {
- "name": "New Zealand",
- "search_url": "https://www.legislation.govt.nz/all/results.aspx?search=ts_act%40bill%40regulation%40deemedreg_%s_resel_25_a"
- },
- "pe": {
- "name": "Peru",
- "search_url": "https://leyes.congreso.gob.pe/LeyNume_1p.aspx?xEstado=2&xTipoBusqueda=3&xTexto=%s"
- },
- "ph": {
- "name": "Philippines",
- "search_url": "https://www.officialgazette.gov.ph/the-philippine-legal-codes/"
- },
- "pk": {
- "name": "Pakistan",
- "search_url": "http://www.punjablaws.gov.pk/index6.html"
- },
- "pl": {
- "name": "Poland",
- "search_url": "http://isap.sejm.gov.pl/isap.nsf/search.xsp?status=O&title=%s"
- },
- "pt": {
- "name": "Portugal",
- "search_url": "https://dre.pt/web/guest/pesquisa/-/search/basic?q=%s"
- },
- "py": {
- "name": "Paraguay",
- "search_url": "http://digesto.senado.gov.py/buscar/buscar?buscar=%s"
- },
- "ro": {
- "name": "Romania",
- "search_url": "http://legislatie.just.ro/Public/RezultateCautare?titlu=%s"
- },
- "rs": {
- "name": "Serbia",
- "search_url": "https://www.pravno-informacioni-sistem.rs/reg-search?q=%s"
- },
- "ru": {
- "name": "Russia",
- "search_url": "http://pravo.gov.ru/proxy/ips/?searchres=&bpas=cd00000&sort=-1&intelsearch=%s"
- },
- "se": {
- "name": "Sweden",
- "search_url": "https://www.riksdagen.se/sv/global/sok/?doktyp=sfs&q=%s"
- },
- "si": {
- "name": "Slovenia",
- "search_url": "http://www.pisrs.si/Pis.web/indexSearch?search=%s"
- },
- "sk": {
- "name": "Slovakia",
- "search_url": "https://www.slov-lex.sk/vyhladavanie-pravnych-predpisov?text=%s"
- },
- "tk": {
- "name": "Turkey",
- "search_url": "https://www.mevzuat.gov.tr/aramasonuc?AranacakMetin=%s"
- },
- "ua": {
- "name": "Ukraine",
- "search_url": "https://zakon.rada.gov.ua/laws/main?find=2&dat=00000000&lang=en&user=a&text=%s&textl=2&bool=and&org=0&typ=1&datl=0&yer=0000&mon=00&day=00&numl=2&num=&minjustl=2&minjust="
- },
- "uk": {
- "name": "the United Kingdom",
- "search_url": "https://www.legislation.gov.uk/primary+secondary?title=%s"
- },
- "us": {
- "name": "the United States",
- "search_url": "https://www.loc.gov/search/?fa=original-format:legislation&q=%s"
- },
- "uy": {
- "name": "Uruguay",
- "search_url": "https://parlamento.gub.uy/documentosyleyes/leyes?Searchtext=%s"
- }
-}
diff --git a/lex-serve/countries.toml b/lex-serve/countries.toml
new file mode 100644
index 0000000..a0d1fed
--- /dev/null
+++ b/lex-serve/countries.toml
@@ -0,0 +1,215 @@
+[al]
+name = "Albania"
+search-url = "https://qbz.gov.al/search;q=%s"
+
+[am]
+name = "Armenia"
+search-url = "http://www.parliament.am/search.php?where=laws&what=%s"
+
+[ar]
+name = "Argentina"
+search-url = "https://www.boletinoficial.gob.ar/busquedaAvanzada/primera"
+
+[at]
+name = "Austria"
+search-url = "https://www.ris.bka.gv.at/Ergebnis.wxe?Abfrage=Gesamtabfrage&Suchworte=%s"
+
+[au]
+name = "Australia"
+search-url = "https://www.legislation.gov.au/Search/%s"
+
+[az]
+name = "Azerbaijan"
+search-url = "https://meclis.gov.az/axtar-qanun.php?cat=72&soz=%s"
+
+[be]
+name = "Belgium"
+search-url = "https://www.ejustice.just.fgov.be/cgi_loi/loi_rech.pl?liste.x=&liste.y=&language=nl&text1=%s"
+
+[bg]
+name = "Bulgaria"
+search-url = "https://dv.parliament.bg/DVWeb/broeveList.faces"
+
+[br]
+name = "Brazil"
+search-url = "https://legislacao.presidencia.gov.br/"
+
+[by]
+name = "Belarus"
+search-url = "https://etalonline.by/kodeksy/"
+
+[ca]
+name = "Canada"
+search-url = "https://laws-lois.justice.gc.ca/Search/Search.aspx?txtS3archA11=%s"
+
+[ch]
+name = "Switzerland"
+search-url = "https://www.fedlex.admin.ch/de/search?text=%s"
+
+[cy]
+name = "Cyprus"
+search-url = "http://www.cylaw.org/cgi-bin/sinocgi.pl?directories=9&query=%s"
+
+[cz]
+name = "Czech Republic"
+search-url = "https://aplikace.mvcr.cz/sbirka-zakonu/SearchResult.aspx?typeLaw=zakon&what=Text_v_anotaci&q=%s"
+
+[de]
+name = "Germany"
+search-url = "https://www.gesetze-im-internet.de/cgi-bin/htsearch?config=Titel_bmjhome2005&method=and&words=%s"
+
+[dk]
+name = "Denmark"
+search-url = "https://www.retsinformation.dk/documents?t=%s"
+
+[ee]
+name = "Estonia"
+search-url = "https://www.riigiteataja.ee/otsingu_tulemus.html?otsisona=%s"
+
+[es]
+name = "Spain"
+search-url = "https://www.boe.es/buscar/legislacion.php?campo%5B0%5D=ID_SRC&dato%5B0%5D=&operador%5B0%5D=and&campo%5B1%5D=NOVIGENTE&operador%5B1%5D=and&campo%5B3%5D=CONSO&operador%5B3%5D=and&campo%5B2%5D=TIT&dato%5B2%5D=%s&checkbox_solo_tit=S&operador%5B2%5D=and&page_hits=50&sort_field%5B0%5D=PESO&sort_order%5B0%5D=desc&sort_field%5B1%5D=ref&sort_order%5B1%5D=asc&accion=Buscar"
+
+[fi]
+name = "Finland"
+search-url = "https://finlex.fi/fi/laki/haku/?search[type]=pika&search[pika]=%s"
+
+[fr]
+name = "France"
+search-url = "https://www.legifrance.gouv.fr/search/all?tab_selection=all&searchField=ALL&query=%s"
+
+[gr]
+name = "Greece"
+search-url = "http://www.et.gr/index.php/nomoi-proedrika-diatagmata"
+
+[hr]
+name = "Croatia"
+search-url = "https://sredisnjikatalogrh.gov.hr/cadial/search.php?action=search&query=%s"
+
+[hu]
+name = "Hungary"
+search-url = "https://njt.hu/"
+
+[ie]
+name = "Ireland"
+search-url = "http://www.irishstatutebook.ie/eli/ResultsTitle.html?q=%s"
+
+[in]
+name = "India"
+search-url = "https://www.indiacode.nic.in/handle/123456789/1362/simple-search?query=%s"
+
+[is]
+name = "Iceland"
+search-url = "https://www.stjornartidindi.is/"
+
+[it]
+name = "Italy"
+search-url = "https://www.normattiva.it/ricerca/veloce/0?testoRicerca=%s"
+
+[jp]
+name = "Japan"
+search-url = "https://elaws.e-gov.go.jp/result?allDocument=0&searchTargetAll=1&searchTextBox=%s&serchSelect=and&searchTarget_array=Constitution%2CAct%2CCabinetOrder%2CImperialOrder%2CMinisterialOrdinance%2CRule&classification_array=%E6%86%B2%E6%B3%95%2C%E5%88%91%E4%BA%8B%2C%E8%B2%A1%E5%8B%99%E9%80%9A%E5%89%87%2C%E6%B0%B4%E7%94%A3%E6%A5%AD%2C%E8%A6%B3%E5%85%89%2C%E5%9B%BD%E4%BC%9A%2C%E8%AD%A6%E5%AF%9F%2C%E5%9B%BD%E6%9C%89%E8%B2%A1%E7%94%A3%2C%E9%89%B1%E6%A5%AD%2C%E9%83%B5%E5%8B%99%2C%E8%A1%8C%E6%94%BF%E7%B5%84%E7%B9%94%2C%E6%B6%88%E9%98%B2%2C%E5%9B%BD%E7%A8%8E%2C%E5%B7%A5%E6%A5%AD%2C%E9%9B%BB%E6%B0%97%E9%80%9A%E4%BF%A1%2C%E5%9B%BD%E5%AE%B6%E5%85%AC%E5%8B%99%E5%93%A1%2C%E5%9B%BD%E5%9C%9F%E9%96%8B%E7%99%BA%2C%E4%BA%8B%E6%A5%AD%2C%E5%95%86%E6%A5%AD%2C%E5%8A%B4%E5%83%8D%2C%E8%A1%8C%E6%94%BF%E6%89%8B%E7%B6%9A%2C%E5%9C%9F%E5%9C%B0%2C%E5%9B%BD%E5%82%B5%2C%E9%87%91%E8%9E%8D%E3%83%BB%E4%BF%9D%E9%99%BA%2C%E7%92%B0%E5%A2%83%E4%BF%9D%E5%85%A8%2C%E7%B5%B1%E8%A8%88%2C%E9%83%BD%E5%B8%82%E8%A8%88%E7%94%BB%2C%E6%95%99%E8%82%B2%2C%E5%A4%96%E5%9B%BD%E7%82%BA%E6%9B%BF%E3%83%BB%E8%B2%BF%E6%98%93%2C%E5%8E%9A%E7%94%9F%2C%E5%9C%B0%E6%96%B9%E8%87%AA%E6%B2%BB%2C%E9%81%93%E8%B7%AF%2C%E6%96%87%E5%8C%96%2C%E9%99%B8%E9%81%8B%2C%E7%A4%BE%E4%BC%9A%E7%A6%8F%E7%A5%89%2C%E5%9C%B0%E6%96%B9%E8%B2%A1%E6%94%BF%2C%E6%B2%B3%E5%B7%9D%2C%E7%94%A3%E6%A5%AD%E9%80%9A%E5%89%87%2C%E6%B5%B7%E9%81%8B%2C%E7%A4%BE%E4%BC%9A%E4%BF%9D%E9%99%BA%2C%E5%8F%B8%E6%B3%95%2C%E7%81%BD%E5%AE%B3%E5%AF%BE%E7%AD%96%2C%E8%BE%B2%E6%A5%AD%2C%E8%88%AA%E7%A9%BA%2C%E9%98%B2%E8%A1%9B%2C%E6%B0%91%E4%BA%8B%2C%E5%BB%BA%E7%AF%89%E3%83%BB%E4%BD%8F%E5%AE%85%2C%E6%9E%97%E6%A5%AD%2C%E8%B2%A8%E7%89%A9%E9%81%8B%E9%80%81%2C%E5%A4%96%E4%BA%8B&lawNo1=&lawNo2=&lawNo3=&lawNo4=&dayPromulgation1_0=&dayPromulgation1_1=&dayPromulgation1_2=&dayPromulgation1_3=&dayPromulgation2_0=&dayPromulgation2_1=&dayPromulgation2_2=&dayPromulgation2_3=&dayPromulgation1=&dayPromulgation2=&lawDayFrom1=0&selectMenu=0&searchBtn=1"
+
+[lt]
+name = "Lithuania"
+search-url = "https://e-seimas.lrs.lt/portal/simpleSearch/lt"
+
+[lu]
+name = "Luxembourg"
+search-url = "http://legilux.public.lu/search/?fulltext=%s"
+
+[lv]
+name = "Latvia"
+search-url = "https://www.vestnesis.lv/rezultati/atbilstiba/on/locijums/on/lapa/1/skaits/20/kartot/datums/ta/on/izdeveji/saeima.likumi/teksts/%s"
+
+[ma]
+name = "Malta"
+search-url = "https://legislation.mt/Legislation"
+
+[mk]
+name = "Macedonia"
+search-url = "https://vlada.mk/search/node/%s%20language%3Amk%2Cund"
+
+[mx]
+name = "Mexico"
+search-url = "http://www.diputados.gob.mx/LeyesBiblio/index.htm"
+
+[nl]
+name = "Netherlands"
+search-url = "https://wetten.overheid.nl/zoeken/zoekresultaat/rs/2,3,4/titel/%s/titelf/1/tekstf/1/artnrb/0/d//dx/0"
+
+[no]
+name = "Norway"
+search-url = "https://lovdata.no/sok?q=%s"
+
+[nz]
+name = "New Zealand"
+search-url = "https://www.legislation.govt.nz/all/results.aspx?search=ts_act%40bill%40regulation%40deemedreg_%s_resel_25_a"
+
+[pe]
+name = "Peru"
+search-url = "https://leyes.congreso.gob.pe/LeyNume_1p.aspx?xEstado=2&xTipoBusqueda=3&xTexto=%s"
+
+[ph]
+name = "Philippines"
+search-url = "https://www.officialgazette.gov.ph/the-philippine-legal-codes/"
+
+[pk]
+name = "Pakistan"
+search-url = "http://www.punjablaws.gov.pk/index6.html"
+
+[pl]
+name = "Poland"
+search-url = "http://isap.sejm.gov.pl/isap.nsf/search.xsp?status=O&title=%s"
+
+[pt]
+name = "Portugal"
+search-url = "https://dre.pt/web/guest/pesquisa/-/search/basic?q=%s"
+
+[py]
+name = "Paraguay"
+search-url = "http://digesto.senado.gov.py/buscar/buscar?buscar=%s"
+
+[ro]
+name = "Romania"
+search-url = "http://legislatie.just.ro/Public/RezultateCautare?titlu=%s"
+
+[rs]
+name = "Serbia"
+search-url = "https://www.pravno-informacioni-sistem.rs/reg-search?q=%s"
+
+[ru]
+name = "Russia"
+search-url = "http://pravo.gov.ru/proxy/ips/?searchres=&bpas=cd00000&sort=-1&intelsearch=%s"
+
+[se]
+name = "Sweden"
+search-url = "https://www.riksdagen.se/sv/global/sok/?doktyp=sfs&q=%s"
+
+[si]
+name = "Slovenia"
+search-url = "http://www.pisrs.si/Pis.web/indexSearch?search=%s"
+
+[sk]
+name = "Slovakia"
+search-url = "https://www.slov-lex.sk/vyhladavanie-pravnych-predpisov?text=%s"
+
+[tk]
+name = "Turkey"
+search-url = "https://www.mevzuat.gov.tr/aramasonuc?AranacakMetin=%s"
+
+[ua]
+name = "Ukraine"
+search-url = "https://zakon.rada.gov.ua/laws/main?find=2&dat=00000000&lang=en&user=a&text=%s&textl=2&bool=and&org=0&typ=1&datl=0&yer=0000&mon=00&day=00&numl=2&num=&minjustl=2&minjust="
+
+[uk]
+name = "the United Kingdom"
+search-url = "https://www.legislation.gov.uk/primary+secondary?title=%s"
+
+[us]
+name = "the United States"
+search-url = "https://www.loc.gov/search/?fa=original-format:legislation&q=%s"
+
+[uy]
+name = "Uruguay"
+search-url = "https://parlamento.gub.uy/documentosyleyes/leyes?Searchtext=%s"
diff --git a/lex-serve/main.go b/lex-serve/main.go
index 07dba19..ac67ad4 100644
--- a/lex-serve/main.go
+++ b/lex-serve/main.go
@@ -11,10 +11,12 @@ import (
"net/url"
"os"
"strings"
+
+ "github.com/BurntSushi/toml"
)
-//go:embed countries.json
-var countriesJSON []byte
+//go:embed countries.toml
+var countriesTOML []byte
func main() {
log := slog.New(slog.NewTextHandler(os.Stderr, nil))
@@ -32,9 +34,13 @@ func main() {
}
var handler = handler{logger: log, domain: domain, lawsByCC: map[string]map[string]law{}}
- err := json.Unmarshal(countriesJSON, &handler.countries)
+ meta, err := toml.NewDecoder(bytes.NewReader(countriesTOML)).Decode(&handler.countries)
if err != nil {
- log.Error("failed to parse countries.json", Error(err))
+ log.Error("failed to parse countries.toml", Error(err))
+ os.Exit(1)
+ }
+ if len(meta.Undecoded()) != 0 {
+ log.Error("unknown keys in countries.toml", "keys", meta.Undecoded())
os.Exit(1)
}
@@ -169,7 +175,7 @@ type law struct {
type country struct {
Name string
- SearchURL string `json:"search_url"`
+ SearchURL string `toml:"search-url"`
}
func (c country) HasPlaceholder() bool {