File indexing completed on 2024-12-29 04:51:03
0001 /* 0002 SPDX-FileCopyrightText: 2019 Volker Krause <vkrause@kde.org> 0003 0004 SPDX-License-Identifier: LGPL-2.0-or-later 0005 */ 0006 0007 function parseEvent(event) 0008 { 0009 var res; 0010 res = JsonLd.newFoodEstablishmentReservation(); 0011 res.reservationFor.name = event.organizer.name; 0012 res.startTime = event.dtStart.toJSON(); 0013 res.endTime = event.dtEnd.toJSON(); 0014 var addr = event.location.split(', '); 0015 res.reservationFor.address.streetAddress = addr[1]; 0016 res.reservationFor.address.addressLocality = addr[2]; 0017 0018 var country = event.description.match(addr[2] + "\\n([\\w ]+)\\n\\n"); 0019 if (country) 0020 res.reservationFor.address.addressCountry = country[1]; 0021 0022 var cancelUrl = event.description.match(/\n(https?:\/\/.*?\/cancel.*?)\n/); 0023 if (cancelUrl) { 0024 res.potentialAction = JsonLd.newObject("CancelAction"); 0025 res.potentialAction.url = cancelUrl[1]; 0026 } 0027 0028 var url = event.description.match(/\n(https?:\/\/.+?)\n$/); 0029 if (url) 0030 res.reservationFor.url = url[1]; 0031 0032 if (event.attendees.length > 0) { 0033 res.underName.name = event.attendees[0].name; 0034 res.underName.email = event.attendees[0].email; 0035 } 0036 0037 return res; 0038 }