aboutsummaryrefslogtreecommitdiff
path: root/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
diff options
context:
space:
mode:
authorRobin Krahl <me@robin-krahl.de>2014-11-01 16:02:31 +0100
committerRobin Krahl <me@robin-krahl.de>2014-11-01 16:02:31 +0100
commit6f251c2526004faa55e4bcb9935aad38bfed7a48 (patch)
tree9e774fe95a9ba02aa85af595e199203249bcf1e9 /mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
parent0d2d08472aa09dd001b532698e04b0f02e0a44c6 (diff)
downloadLrMediaWiki-6f251c2526004faa55e4bcb9935aad38bfed7a48.tar.gz
LrMediaWiki-6f251c2526004faa55e4bcb9935aad38bfed7a48.tar.bz2
Move file description template into a separate file
Move the file description template from the constant `MediaWikiInterface.fileDescriptionPattern` to the file `description.txt` in the main directory of the plug-in. This allows better customization of the file description. - add `MediaWikiInterface.loadFileDescriptionTemplate` that tries to read the file description template from the `description.txt` file - call `MediaWikiInterface.loadFileDescriptionTemplate` before the description preview and before the export Fix https://github.com/ireas/LrMediaWiki/issues/29
Diffstat (limited to 'mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua')
-rwxr-xr-xmediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua9
1 files changed, 7 insertions, 2 deletions
diff --git a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
index 52f45d3..079225e 100755
--- a/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
+++ b/mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua
@@ -266,8 +266,13 @@ MediaWikiExportServiceProvider.sectionsForTopOfDialog = function(viewFactory, pr
viewFactory:push_button {
title = LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext',
action = function(button)
- local wikitext = MediaWikiInterface.buildFileDescription('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, '<!-- {{Location}} if GPS metadata is available -->\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file categories -->')
- LrDialogs.message(LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', wikitext, 'info')
+ result, message = MediaWikiInterface.loadFileDescriptionTemplate()
+ if result then
+ local wikitext = MediaWikiInterface.buildFileDescription('<!-- description -->', propertyTable.info_source, '<!-- date -->', propertyTable.info_author, propertyTable.info_license, '<!-- {{Location}} if GPS metadata is available -->\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '<!-- per-file categories -->')
+ LrDialogs.message(LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', wikitext, 'info')
+ else
+ LrDialogs.message(LOC '$$$/LrMediaWiki/Export/DescriptionError=Error reading the file description', message, 'error')
+ end
end,
},
},