File indexing completed on 2024-12-29 04:51:04

0001 /*
0002    SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org>
0003    SPDX-License-Identifier: LGPL-2.0-or-later
0004 */
0005 
0006 function extractMail(content, node) {
0007     let res = node.result[0];
0008     res.reservedTicket = {
0009         '@type': 'Ticket',
0010         ticketToken: 'qrcode:' + node.findChildNodes({ scope: "Descendants", mimeType: "text/plain", match: "^[0-9a-z-]{16,}$" })[0].content 
0011     };
0012     res.cancelReservationUrl = res.reservationFor.url;
0013     res.reservationFor.url = undefined;
0014     const addr = res.reservationFor.location.name.split(/, /);
0015     res.reservationFor.location.address = {
0016         streetAddress: addr[0],
0017         addressCountry: addr[addr.length - 1],
0018         postalCode: addr[addr.length - 2],
0019         addressLocality: addr[addr.length - 3]
0020     };
0021     res.reservationFor.location.name = res.reservationFor.name;
0022     res.reservationFor.name = res.reservationFor.description.match(/^.*?: (.*)\n/)[1];
0023     return res;
0024 }