File indexing completed on 2024-12-29 04:51:06
0001 /* 0002 SPDX-FileCopyrightText: 2023 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 function parsePdfTicket(pdf, node, triggerNode) { 0007 let res = JsonLd.newBoatReservation(); 0008 res.reservationNumber = triggerNode.content.match(/;(\d+)-/)[1]; 0009 const text = pdf.pages[triggerNode.location].textInRect(0.0, 0.0, 0.68, 1.0); 0010 const dep = text.match(/Abfahrt Von (\S.*?) +\S.*(\d\d\.\d\d.\d{4}) +(.*)\n.*(\d\d:\d\d) +(\S.*)/); 0011 res.reservationFor.departureBoatTerminal.name = dep[3]; 0012 res.reservationFor.departureBoatTerminal.address.addressLocality = dep[1]; 0013 res.reservationFor.departureBoatTerminal.address.streetAddress = dep[5]; 0014 res.reservationFor.departureTime = JsonLd.toDateTime(dep[2] + ' ' + dep[4], 'dd.MM.yyyy hh:mm', 'de'); 0015 0016 const arr = text.match(/Ankunft in (\S.*?) +\S.*(\d\d\.\d\d.\d{4}) +(.*)\n.*(\d\d:\d\d) +(\S.*)/); 0017 res.reservationFor.arrivalBoatTerminal.name = arr[3]; 0018 res.reservationFor.arrivalBoatTerminal.address.addressLocality = arr[1]; 0019 res.reservationFor.arrivalBoatTerminal.address.streetAddress = arr[5]; 0020 res.reservationFor.arrivalTime = JsonLd.toDateTime(arr[2] + ' ' + arr[4], 'dd.MM.yyyy hh:mm', 'de'); 0021 0022 return res; 0023 }