Skip to content

Commit 6ef0646

Browse files
committed
Added comments
1 parent f5a624c commit 6ef0646

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

contrib/kml_export.lua

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
--[[
22
This file is part of darktable,
33
Copyright 2016 by Tobias Jakobs.
4+
Copyright 2016 by Erik Augustin.
45
56
This program is free software: you can redistribute it and/or modify
67
it under the terms of the GNU General Public License as published by
@@ -157,6 +158,7 @@ function string.stripAccents( str )
157158
end
158159

159160
-- Escape XML characters
161+
-- Keep & first, otherwise it will double escape other characters
160162
-- https://stackoverflow.com/questions/1091945/what-characters-do-i-need-to-escape-in-xml-documents
161163
function string.escapeXmlCharacters( str )
162164

@@ -248,7 +250,9 @@ local function create_kml_file(storage, image_table, extra_data)
248250
kml_file = kml_file.." <description>Exported from darktable</description>\n"
249251

250252
for image,exported_image in pairs(image_table) do
253+
-- Extract filename, e.g DSC9784.ARW -> DSC9784
251254
filename = string.upper(string.gsub(image.filename,"%.%w*", ""))
255+
-- Extract extension from exported image (user can choose JPG or PNG), e.g DSC9784.JPG -> .JPG
252256
extension = string.match(exported_image,"%.%w*$")
253257

254258
if ((image.longitude and image.latitude) and
@@ -262,6 +266,7 @@ local function create_kml_file(storage, image_table, extra_data)
262266
else
263267
image_title = image.filename
264268
end
269+
-- Characters should not be escaped in CDATA, but we are using HTML fragment, so we must escape them
265270
image_description = string.escapeXmlCharacters(image.description)
266271

267272
kml_file = kml_file.." <name>"..image_title.."</name>\n"

0 commit comments

Comments
 (0)