Counter plugin. Plugin for automatic numbering | jenyay.net

Counter plugin. Plugin for automatic numbering

Plugin adds wiki-command (:counter:) , allowing the automatic numbering anything on the page.

Counter 1.0.6 (Required OutWiker version: 1.8 - 2.1.0.834)

Counter 1.3.2 (Required OutWiker version: 3.2.0.922 and above)

Using

(:counter parameters... :)

Parameters

All parameters are optional.

  • name - sets the name of the counter. Counters with different names have independent current values.
  • start - value, with which to start a new count. With this option, you can "reset" the counter to the required value.
  • step - increment for the counter.
  • parent - name of the parent counter to create a numbering like 1.1, 1.2.3, etc.
  • separator - separator between a given counter and the parent counter (the default value - dot).
  • hide - parameter indicates that the counter need to hide, but to increase its value.

Examples of usage

Example 1

If we want to have only one numbering on the page, you can use the (:counter:) without parameters.

For example:

Picture (:counter:).

Picture (:counter:).

Picture (:counter:).

As a result, we obtain the following numbering:

Picture 1.

Picture 2.

Picture 3.

Example 2

If we want to renumber and pictures, and equations, we use the name parameter. Counters with different parameter value of the name parameters numbered independently. Lack name parameter is equivalent to name = "".

For example:

Picture (:counter name="picture":).

Equation ((:counter name="eq":))
Equation ((:counter name="eq":))

Picture (:counter name="picture":).

Equation ((:counter name="eq":))
Equation ((:counter name="eq":))

Picture (:counter name="picture":).

The result will look as follows:

Picture 1.

Equation (1)
Equation (2)

Picture 2.

Equation (3)
Equation (4)

Picture 3.

Example 3

start parameter allows you to "reset" the counter to some initial value, which goes from a new count.

For example:

Picture (:counter:).

Picture (:counter:).

Picture (:counter start=10:).

Picture (:counter:).

The result will look as follows:

Picture 1.

Picture 2.

Picture 10.

Picture 11.

Example 4

step parameter indicates that the counter should increase its value not by 1 but the specified number, which can be negative.

For example:

Picture (:counter:).

Picture (:counter:).

Picture (:counter step=2:).

Picture (:counter step=3:).

Picture (:counter step=-10:).

The result will look as follows:

Picture 1.

Picture 2.

Picture 4.

Picture 7.

Picture -3.

Example 5

Если у вас на странице есть Sectionы, то это хороший объект для автоматической нумерации. Often sections contain subsections whose numbers depend on the parent section, for example, 1.2, 1.3, 1.2.3, 1.2.4, 1.2.5, etc. To create such a numbering using the parent parameter, which shall be equal to the name (parameter name) parent counter.

For example:

Section (:counter name="level 1":)
Section (:counter name="level 1":)

Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 3" parent="level 2":)
Section (:counter name="level 3" parent="level 2":)
Section (:counter name="level 3" parent="level 2":)

Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)

Section (:counter name="level 3" parent="level 2":)
Section (:counter name="level 3" parent="level 2":)
Section (:counter name="level 3" parent="level 2":)

Section (:counter name="level 1":)
Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)

The result will look as follows:

Section 1
Section 2

Section 2.1
Section 2.1.1
Section 2.1.2
Section 2.1.3

Section 2.2
Section 2.3

Section 2.3.1
Section 2.3.2
Section 2.3.3

Section 3
Section 3.1
Section 3.2
Section 3.3

Example 6

If you use the name parameter, you can change the separator between the values ​​of the parent and child counters. For this is used separator parameter.

For example:

Section (:counter name="level 1":)
Section (:counter name="level 2" parent="level 1" separator=":":)
Section (:counter name="level 3" parent="level 2" separator="-":)
Section (:counter name="level 3" parent="level 2" separator="-":)
Section (:counter name="level 3" parent="level 2" separator="-":)

The result will look as follows:

Section 1
Section 1:1
Section 1:1-1
Section 1:1-2
Section 1:1-3

Example 7

If you want to counter increased by one, but value was not shown, used the hide parameter.

For example:

(:counter name="level 1" hide:)
Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)

(:counter name="level 1" hide:)
Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)

(:counter name="level 1" hide:)
Section (:counter name="level 2" parent="level 1":)
Section (:counter name="level 2" parent="level 1":)

The result will look as follows:


Section 1.1
Section 1.2


Section 2.1
Section 2.2


Section 3.1
Section 3.2

Versions history

1.3.2 (May 03, 2023)

  • Use updated API version.

1.3.1 (December 29, 2020)

  • Fix misprint in the plugin description.

1.3 (October 19, 2019)

  • Migrate to new API.

1.2 (August 26, 2018)

  • Add German localization.

1.1 (February 15, 2018)

  • Add OutWiker 2.1 support. Migrate to Python 3.6.

1.0.6 (October 17, 2016)

  • Added OutWiker 2.0 supporting.

1.0.5 (August 20, 2016)

  • Added the Swedish translation.

1.0.3 (January 20, 2015)

  • Minor interface improvements.
  • Bug fixes.
  • Cleanup code.

1.0.2 (September 11, 2014)

  • Added the Italian localization.
  • Bug fixes.

1.0.1 (July 13, 2014)

  • Fixed output error when trying to use a plug-in with unsupported versions OutWiker.

1.0 (June 24, 2014)

  • The first version.

Вы можете подписаться на новости сайта через RSS, Группу Вконтакте или Канал в Telegram.
1 stars

Рейтинг 1.0/5. Всего 1 голос(а, ов)