Skip to content

Commit 64d648c

Browse files
committed
Fixes asciidoctor#1237. -s CLI option should be changed to -e to align with Asciidoctor
1 parent 9f2d1ff commit 64d648c

File tree

2 files changed

+20
-12
lines changed

2 files changed

+20
-12
lines changed

CHANGELOG.adoc

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ For a detailed view of what has changed, refer to the {url-repo}/commits/main[co
1616
Bug Fixes::
1717

1818
* 'UnsupportedOperationException' when passing immutable Map as options to 'createPhraseNode' (#1221) (@abelsromero)
19+
* -s CLI option should be changed to -e to align with Asciidoctor (#1237) (@mojavelinux)
1920

2021
Improvement::
2122

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

+19-12
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ public class AsciidoctorCliOptions {
2424
public static final String TEMPLATE_DIR = "-T";
2525
public static final String TEMPLATE_ENGINE = "-E";
2626
public static final String COMPACT = "-C";
27-
public static final String ERUBY = "-e";
28-
public static final String SECTION_NUMBERS = "-n";
27+
public static final String EMBEDDED = "-e";
2928
public static final String NO_HEADER_FOOTER = "-s";
29+
public static final String SECTION_NUMBERS = "-n";
3030
public static final String SAFE = "-S";
3131
public static final String OUTFILE = "-o";
3232
public static final String DOCTYPE = "-d";
@@ -37,16 +37,16 @@ public class AsciidoctorCliOptions {
3737
public static final char ATTRIBUTE_SEPARATOR = '=';
3838
public static final String TIMINGS_OPTION_NAME = "timings";
3939

40-
@Parameter(names = {VERBOSE, "--verbose"}, description = "enable verbose mode (default: false)")
40+
@Parameter(names = {VERBOSE, "--verbose"}, description = "enable verbose mode")
4141
private boolean verbose = false;
4242

43-
@Parameter(names = {TIMINGS, "--timings"}, description = "enable timings mode (default: false)")
43+
@Parameter(names = {TIMINGS, "--timings"}, description = "enable timings mode")
4444
private boolean timings = false;
4545

4646
@Parameter(names = {VERSION, "--version"}, description = "display the version and runtime environment")
4747
private boolean version = false;
4848

49-
@Parameter(names = {BACKEND, "--backend"}, description = "set output format backend (default: html5)")
49+
@Parameter(names = {BACKEND, "--backend"}, description = "set output format backend")
5050
private String backend = "html5";
5151

5252
@Parameter(names = {DOCTYPE, "--doctype"}, description = "document type to use when rendering output: [article, book, inline] (default: article)")
@@ -61,16 +61,19 @@ public class AsciidoctorCliOptions {
6161
@Parameter(names = {SAFE, "--safe-mode"}, converter = SafeModeConverter.class, description = "set safe mode level explicitly: [unsafe, safe, server, secure] (default: unsafe)")
6262
private SafeMode safeMode = SafeMode.UNSAFE;
6363

64-
@Parameter(names = {NO_HEADER_FOOTER, "--no-header-footer"}, description = "suppress output of header and footer (default: false)")
64+
@Parameter(names = {NO_HEADER_FOOTER, "--no-header-footer"}, description = "suppress output of header and footer")
6565
private boolean noHeaderFooter = false;
6666

67+
@Parameter(names = {EMBEDDED, "--embedded"}, description = "suppress enclosing document structure and output an embedded document")
68+
private boolean embedded = false;
69+
6770
@Parameter(names = {SECTION_NUMBERS, "--section-numbers"}, description = "auto-number section titles; disabled by default")
6871
private boolean sectionNumbers = false;
6972

70-
@Parameter(names = {ERUBY, "--eruby"}, description = "specify eRuby implementation to render built-in templates: [erb, erubis] (default: erb)")
73+
@Parameter(names = {"--eruby"}, description = "specify eRuby implementation to render built-in templates: [erb, erubis]")
7174
private String eruby = "erb";
7275

73-
@Parameter(names = {COMPACT, "--compact"}, description = "compact the output by removing blank lines (default: false)")
76+
@Parameter(names = {COMPACT, "--compact"}, description = "compact the output by removing blank lines")
7477
private boolean compact = false;
7578

7679
@Parameter(names = {TEMPLATE_ENGINE, "--template-engine"}, description = "template engine to use for the custom render templates (loads gem on demand)")
@@ -88,7 +91,7 @@ public class AsciidoctorCliOptions {
8891
@Parameter(names = {SOURCE_DIR, "--source-dir"}, description = "source directory (requires destination directory)")
8992
private String sourceDir;
9093

91-
@Parameter(names = {"--trace"}, description = "include backtrace information on errors (default: false)")
94+
@Parameter(names = {"--trace"}, description = "include backtrace information on errors")
9295
private boolean trace = false;
9396

9497
@Parameter(names = {HELP, "--help"}, help = true, description = "show this message")
@@ -97,10 +100,10 @@ public class AsciidoctorCliOptions {
97100
@Parameter(names = {ATTRIBUTE, "--attribute"}, description = "a list of attributes, in the form key or key=value pair, to set on the document")
98101
private List<String> attributes = new ArrayList<>();
99102

100-
@Parameter(names = {QUIET, "--quiet"}, description = "suppress warnings (default: false)")
103+
@Parameter(names = {QUIET, "--quiet"}, description = "suppress warnings")
101104
private boolean quiet = false;
102105

103-
@Parameter(names = {"--failure-level"}, converter = SeverityConverter.class, description = "set minimum log level that yields a non-zero exit code: [info, warning, error, fatal] (default: fatal) ")
106+
@Parameter(names = {"--failure-level"}, converter = SeverityConverter.class, description = "set minimum log level that yields a non-zero exit code.")
104107
private Severity failureLevel = Severity.FATAL;
105108

106109
@Parameter(names = {REQUIRE, "--require"}, description = "require the specified library before executing the processor (using require)")
@@ -293,6 +296,10 @@ public Options parse() throws IOException {
293296
optionsBuilder.safe(SafeMode.SAFE);
294297
}
295298

299+
if (this.embedded) {
300+
optionsBuilder.option(Options.STANDALONE, false);
301+
}
302+
296303
if (this.noHeaderFooter) {
297304
optionsBuilder.option(Options.STANDALONE, false);
298305
}
@@ -368,7 +375,7 @@ private List<String> splitByPathSeparator(String path) {
368375
}
369376

370377
private static boolean isEmpty(String path) {
371-
return path == null || path.trim().length() == 0;
378+
return path == null || path.trim().isEmpty();
372379
}
373380

374381
}

0 commit comments

Comments
 (0)