Item13387: Only first topic published gets TablePlugin default styles

pencil
Priority: Normal
Current State: Closed
Released In: n/a
Target Release: n/a
Applies To: Extension
Component: PublishPlugin
Branches: master
Reported By: MichaelTempest
Waiting For:
Last Change By: CrawfordCurrie
When publishing a web with PublishPlugin, the first topic published contains the TablePlugin default styles. All other topics do not. This is relevant because these default styles affect the presentation of exported tables. For example: these styles provide the alternating background colours for table rows; without these styles, table rows are all the same colour.

The presence (or absence) of these default styles is easy to detect. The default styles are followed by the following marker text:
<!--TABLEPLUGIN_default-->

When the default styles are not present, the "specific" styles are followed by this marker text:
<!--TABLEPLUGIN_specific: requires= missing ids: TABLEPLUGIN_default-->

The problem appears to be that TablePlugin is not re-initialised between topics. $Foswiki::Plugins::TablePlugin::writtenToHead is cleared in initPlugin, and set in Foswiki::Plugins::TablePlugins::Core::_addDefaultStyles. The default styles are only added the first time that _addDefaultStyles is called after initPlugin.

Some possible fixes:
  • Reset $Foswiki::Plugins::TablePlugin::writtenToHead back to zero after publishing each topic. This is a hack. However, it works (this is how I worked around the issue on my own wiki).
  • Make PublishPlugin call TablePlugin's initialiseWhenRender and make that function also reset writtenToHead. However, that might result in the default styles being added twice when CompareRevisionsAddOn is used to compare things. I haven't tried this.
  • Provide a new option for PublishPlugin that lists plugins that should be re-initialised between topics, and put TablePlugin in the default value for that option. I haven't tried this.

-- MichaelTempest - 29 Apr 2015

Moved the checkin posted here over to Item13378. Didn't attempt to fix the checkin itself.

-- GeorgeClark - 11 May 2015

Should be OK now

-- Main.CrawfordCurrie - 20 Apr 2017 - 17:57
 
Topic revision: r6 - 20 Apr 2017, CrawfordCurrie
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy