From 6f251c2526004faa55e4bcb9935aad38bfed7a48 Mon Sep 17 00:00:00 2001 From: Robin Krahl Date: Sat, 1 Nov 2014 16:02:31 +0100 Subject: 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 --- mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'mediawiki.lrdevplugin/MediaWikiExportServiceProvider.lua') 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('', propertyTable.info_source, '', propertyTable.info_author, propertyTable.info_license, '\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_categories, '') - LrDialogs.message(LOC '$$$/LrMediaWiki/Section/Licensing/Preview=Preview generated wikitext', wikitext, 'info') + result, message = MediaWikiInterface.loadFileDescriptionTemplate() + if result then + local wikitext = MediaWikiInterface.buildFileDescription('', propertyTable.info_source, '', propertyTable.info_author, propertyTable.info_license, '\n' .. propertyTable.info_templates, propertyTable.info_other, propertyTable.info_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, }, }, -- cgit v1.2.1