Skip to content

Commit 911a6ab

Browse files
abelsromerorobertpanzer
authored andcommitted
Replace use of deprecated 'numbered' attribute by 'sectnums'
Fixes #1120
1 parent dc91b1d commit 911a6ab

File tree

6 files changed

+32
-27
lines changed

6 files changed

+32
-27
lines changed

CHANGELOG.adoc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ Bug Fixes::
3939

4040
* Cell nodes do not inherit from StructuralNode (#1086) (@rahmanusta)
4141

42+
Build / Infrastructure::
43+
44+
* Replace use of deprecated 'numbered' attribute by 'sectnums' (#1123) (@abelsromero)
45+
4246
== 2.5.4 (2022-06-30)
4347

4448
Improvement::

asciidoctorj-api/src/main/java/org/asciidoctor/Attributes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public class Attributes {
3838
public static final String ICONFONT_NAME = "iconfont-name";
3939
public static final String ICONS_DIR = "iconsdir";
4040
public static final String DATA_URI = "data-uri";
41-
public static final String SECTION_NUMBERS = "numbered";
41+
public static final String SECTION_NUMBERS = "sectnums";
4242
public static final String IMAGE_ICONS = "";
4343
public static final String FONT_ICONS = "font";
4444
public static final String LINK_ATTRS = "linkattrs";
@@ -541,7 +541,7 @@ public void setIconsDir(String iconsDir) {
541541
}
542542

543543
/**
544-
* auto-number section titles in the HTML backend
544+
* auto-number section titles.
545545
*
546546
* @param sectionNumbers
547547
*/
@@ -596,9 +596,9 @@ public void setAttribute(String attributeName, Object attributeValue) {
596596
/**
597597
* Sets attributes in string form. An example of a valid string would be:
598598
*
599-
* 'toc numbered source-highlighter=coderay'
599+
* 'toc sectnums source-highlighter=coderay'
600600
*
601-
* where you are adding three attributes: toc, numbered and source-highlighter with value coderay.
601+
* where you are adding three attributes: toc, sectnums and source-highlighter with value coderay.
602602
*
603603
* @param attributes
604604
* in string format.
@@ -612,9 +612,9 @@ public void setAttributes(String attributes) {
612612
/**
613613
* Sets attributes in array form. An example of a valid array would be:
614614
*
615-
* '['toc', 'numbered']'
615+
* '['toc', 'sectnums']'
616616
*
617-
* where you are adding three attributes: toc and numbered.
617+
* where you are adding two attributes: toc and sectnums.
618618
*
619619
* @param attributes
620620
* in array format.

asciidoctorj-api/src/main/java/org/asciidoctor/AttributesBuilder.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -435,10 +435,10 @@ public AttributesBuilder attribute(String attributeName) {
435435
}
436436

437437
/**
438-
* Auto-number section titles in the HTML backend.
438+
* Auto-number section titles.
439439
*
440440
* @param sectionNumbers
441-
* true if numbers should be autonumbered, false otherwise.
441+
* true if numbers should be auto-numbered, false otherwise.
442442
* @return this instance.
443443
*/
444444
public AttributesBuilder sectionNumbers(boolean sectionNumbers) {
@@ -573,9 +573,9 @@ public AttributesBuilder attributes(Map<String, Object> attributes) {
573573
/**
574574
* Sets attributes in string form. An example of a valid string would be:
575575
*
576-
* 'toc numbered source-highlighter=coderay'
576+
* 'toc sectnums source-highlighter=coderay'
577577
*
578-
* where you are adding three attributes: toc, numbered and
578+
* where you are adding three attributes: toc, sectnums and
579579
* source-highlighter with value coderay.
580580
*
581581
* @param attributes
@@ -591,9 +591,9 @@ public AttributesBuilder arguments(String attributes) {
591591
/**
592592
* Sets attributes in array form. An example of a valid array would be:
593593
*
594-
* '['toc', 'numbered']'
594+
* '['toc', 'sectnums']'
595595
*
596-
* where you are adding three attributes: toc and numbered.
596+
* where you are adding two attributes: toc and sectnums.
597597
*
598598
* @param attributes
599599
* in array format.

asciidoctorj-core/src/main/java/org/asciidoctor/jruby/cli/AsciidoctorCliOptions.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public class AsciidoctorCliOptions {
6060
@Parameter(names = {NO_HEADER_FOOTER, "--no-header-footer"}, description = "suppress output of header and footer (default: false)")
6161
private boolean noHeaderFooter = false;
6262

63-
@Parameter(names = {SECTION_NUMBERS, "--section-numbers"}, description = "auto-number section titles in the HTML backend; disabled by default")
63+
@Parameter(names = {SECTION_NUMBERS, "--section-numbers"}, description = "auto-number section titles; disabled by default")
6464
private boolean sectionNumbers = false;
6565

6666
@Parameter(names = {ERUBY, "--eruby"}, description = "specify eRuby implementation to render built-in templates: [erb, erubis] (default: erb)")

asciidoctorj-core/src/test/java/org/asciidoctor/WhenAttributesAreUsedInAsciidoctor.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public void setting_linkcss_as_false_in_string_should_embed_css_file() throws IO
513513
@Test
514514
public void setting_toc_attribute_and_numbered_in_string_form_table_of_contents_should_be_generated() throws IOException {
515515

516-
Attributes attributes = attributes("toc numbered").get();
516+
Attributes attributes = attributes("toc sectnums").get();
517517
Options options = options().inPlace(false).toDir(testFolder.getRoot()).safe(SafeMode.UNSAFE).attributes(attributes).get();
518518

519519
asciidoctor.convertFile(classpath.getResource("tocsample.asciidoc"), options);
@@ -530,8 +530,7 @@ public void setting_toc_attribute_and_numbered_in_string_form_table_of_contents_
530530
@Test
531531
public void setting_toc_attribute_and_numbered_in_array_form_table_of_contents_should_be_generated() throws IOException {
532532

533-
Attributes attributes = attributes(new String[] { "toc", "numbered" })
534-
.get();
533+
Attributes attributes = attributes(new String[] { "toc", "sectnums" }).get();
535534
Options options = options().inPlace(false).toDir(testFolder.getRoot()).safe(SafeMode.UNSAFE).attributes(attributes).get();
536535

537536
asciidoctor.convertFile(classpath.getResource("tocsample.asciidoc"), options);

asciidoctorj-core/src/test/java/org/asciidoctor/jruby/cli/WhenAsciidoctorAPICallIsCalled.java

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
11
package org.asciidoctor.jruby.cli;
22

33
import com.beust.jcommander.JCommander;
4-
import org.asciidoctor.AttributesBuilder;
5-
import org.asciidoctor.OptionsBuilder;
6-
import org.asciidoctor.SafeMode;
4+
import org.asciidoctor.*;
75
import org.asciidoctor.jruby.internal.AsciidoctorUtils;
86
import org.junit.Test;
97

@@ -21,13 +19,17 @@ public class WhenAsciidoctorAPICallIsCalled {
2119
@Test
2220
public void api_parameters_should_be_transformed_to_cli_command() {
2321

24-
AttributesBuilder attributesBuilder = AttributesBuilder.attributes()
25-
.attribute("myAtribute", "myValue").sectionNumbers(true)
26-
.copyCss(false);
22+
Attributes attributes = Attributes.builder()
23+
.attribute("myAtribute", "myValue")
24+
.sectionNumbers(true)
25+
.copyCss(false)
26+
.build();
2727

28-
OptionsBuilder optionsBuilder = OptionsBuilder.options()
29-
.backend("docbook").templateDirs(new File("a"), new File("b"))
30-
.safe(SafeMode.UNSAFE).attributes(attributesBuilder.get());
28+
OptionsBuilder optionsBuilder = Options.builder()
29+
.backend("docbook")
30+
.templateDirs(new File("a"), new File("b"))
31+
.safe(SafeMode.UNSAFE)
32+
.attributes(attributes);
3133

3234
List<String> command = AsciidoctorUtils.toAsciidoctorCommand(
3335
optionsBuilder.asMap(), "file.adoc");
@@ -45,8 +47,8 @@ public void api_parameters_should_be_transformed_to_cli_command() {
4547
assertThat(asciidoctorCliOptions.getBackend(), is("docbook"));
4648
assertThat(asciidoctorCliOptions.getParameters(), containsInAnyOrder("file.adoc"));
4749

48-
assertThat(asciidoctorCliOptions.getAttributes(), hasEntry("myAtribute", (Object) "myValue"));
49-
assertThat(asciidoctorCliOptions.getAttributes(), hasKey("numbered"));
50+
assertThat(asciidoctorCliOptions.getAttributes(), hasEntry("myAtribute", "myValue"));
51+
assertThat(asciidoctorCliOptions.getAttributes(), hasKey("sectnums"));
5052
assertThat(asciidoctorCliOptions.getAttributes(), hasKey("copycss!"));
5153

5254
}

0 commit comments

Comments
 (0)