From ac5c99847112d207508acb3c08605f219916c7e6 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sun, 24 Aug 2014 03:39:30 +0200 Subject: Fix #7: Move file description to plugin metadata. --- .../MediaWikiExportServiceProvider.lua | 14 +++++++++++++- mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua index 9b4fa96..ff27185 100755 --- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua +++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua @@ -70,7 +70,19 @@ MediaWikiExportServiceProvider.processRenderedPhotos = function(functionContext, local photo = rendition.photo local fallbackDescription = exportSettings.fallback_description - local description = photo:getFormattedMetadata('caption') + local descriptionEn = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'description_en') + local descriptionDe = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'description_de') + local descriptionAdditional = photo:getPropertyForPlugin(Info.LrToolkitIdentifier, 'description_additional') + local description = '' + if not isStringEmpty(descriptionEn) then + description = '{{en|1=' .. descriptionEn .. '}}\n' + end + if not isStringEmpty(descriptionDe) then + description = description .. '{{de|1=' .. descriptionDe .. '}}\n' + end + if not isStringEmpty(descriptionAdditional) then + description = description .. descriptionAdditional + end if isStringEmpty(description) then if fallbackDescription then description = fallbackDescription diff --git a/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua b/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua index 72cdda2..2f1c89a 100644 --- a/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua +++ b/mediawiki.lrdevplugin/MediaWikiMetadataProvider.lua @@ -15,6 +15,21 @@ return { metadataFieldsForPhotos = { + { + id = 'description_en', + title = LOC '$$$/LrMediaWiki/Metadata/DescriptionEn=Description (en)', + dataType = 'string', + }, + { + id = 'description_de', + title = LOC '$$$/LrMediaWiki/Metadata/DescriptionDe=Description (de)', + dataType = 'string', + }, + { + id = 'description_additional', + title = LOC '$$$/LrMediaWiki/Metadata/DescriptionAdditional=Description (other)', + dataType = 'string', + }, { id = 'categories', title = LOC '$$$/LrMediaWiki/Metadata/Categories=Categories', @@ -22,5 +37,5 @@ return { }, }, - schemaVersion = 1, + schemaVersion = 2, } \ No newline at end of file -- cgit v1.2.1