Common Numbering API
Provides common operations to support the numbering of content elements. For instance, the definition of shared CSS files. |
Type | JAR |
Category | API |
Developed by | |
Rating | |
License | GNU Lesser General Public License 2.1 |
Compatibility | 14.10+ |
Table of contents
Description
Provides common operations to support the numbering of content elements. For instance, the definition of shared CSS files.
This extension is only for developers.
Developers
CSS Counter Provider
This role is used to provide CSS counters that needs to be initialized at the root of the page content.
Is it currently implemented by figures and headings numbering.
* @since 1.10.3
*/
@Role
@Unstable
public interface CSSCountersProvider
{
/**
* @param locale the current locale
* @return a set of selectors, and their rules
*/
Set<String> selectors(Locale locale);
/**
* Similar to {@link #selectors(Locale)} but with for a {@code @supports (counter-set:nh1) {}} media query. By
* default, reuse the results of {@link #selectors(Locale)}.
*
* @param locale the current locale
* @return the selectors wrapped in a media query
*/
default Set<String> selectorsCounterSet(Locale locale)
{
return selectors(locale);
}
}
Script Service
Generate the CSS
$services.numbered.common.css returns a string of the CSS initializing the counters provided by CSSCountersProvider components.
$services.numbered.common.css($locale)
Insert the CSS
This method needs to be called whenever the counters initialization CSS needs to be loaded in the page (i.e., when at least one kind of content numbering is activated).
Each kind of content numbering extension is in charge of calling insertCSS. But, insertCSS takes core of only loading the required CSS once for the whole page, even if it is called several times.
#set ($discard = $services.numbered.common.insertCSS($locale))
Prerequisites & Installation Instructions
We recommend using the Extension Manager to install this extension (Make sure that the text "Installable with the Extension Manager" is displayed at the top right location on this page to know if this extension can be installed with the Extension Manager).
You can also use the manual method which involves dropping the JAR file and all its dependencies into the WEB-INF/lib folder and restarting XWiki.
Dependencies
Dependencies for this extension (org.xwiki.contrib.numbered.content:application-numbered-content-common-api 1.10.3):
- org.xwiki.commons:xwiki-commons-component-api 14.10
- org.xwiki.commons:xwiki-commons-script 14.10
- org.xwiki.platform:xwiki-platform-skin-api 14.10
- commons-codec:commons-codec 1.15