File indexing completed on 2024-12-29 04:51:04
0001 /* 0002 SPDX-FileCopyrightText: 2024 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 function extractHtml(html) { 0007 const text = html.root.recursiveContent; 0008 let res = JsonLd.newLodgingReservation(); 0009 const hotel = text.match(/YOUR HOTEL\n(.*)\n(.*)\n(.*), (.*)\n.*(\d{1,2}:\d{2} .*)\n.*(\d{1,2}:\d{2} .*)\n/); 0010 res.reservationFor.name = hotel[1]; 0011 res.reservationFor.address.streetAddress = hotel[2]; 0012 res.reservationFor.address.addressLocality = hotel[3]; 0013 res.reservationFor.address.addressCountry = hotel[4]; 0014 0015 const arr = text.match(/Arrival\s*: (.*)\n/)[1]; 0016 const dep = text.match(/Departure\s*: (.*)\n/)[1]; 0017 res.checkinTime = JsonLd.toDateTime(arr + ' ' + hotel[5].replace(/\./g, ''), "dd.MM.yyyy h:mm ap", "en"); 0018 res.checkoutTime = JsonLd.toDateTime(dep + ' ' + hotel[6].replace(/\./g, ''), "dd.MM.yyyy h:mm ap", "en"); 0019 0020 res.reservationNumber = text.match(/Confirmation.*: (.*)\n/)[1]; 0021 res.underName.name = text.match(/Name\s*: (.*)\n/)[1]; 0022 return res; 0023 }