Convert ADOC to Properties
Max file size 100mb.
ADOC vs Properties Format Comparison
| Aspect | ADOC (Source Format) | Properties (Target Format) |
|---|---|---|
| Format Overview |
ADOC
AsciiDoc Markup Language
Lightweight markup language designed for writing documentation, articles, books, and technical content. Created by Stuart Rackham in 2002. Supports rich formatting, includes, cross-references, and can be converted to multiple output formats like HTML, PDF, and DocBook. Documentation Markup Language |
Properties
Java Properties File Format
Simple key-value configuration format native to Java applications. Introduced with Java 1.0 in 1996. Uses key=value or key:value syntax. Widely used for internationalization (i18n), application settings, and Spring Framework configuration. Supports Unicode escapes. Java Native Key-Value Config |
| Technical Specifications |
Structure: Plain text with semantic markup
Encoding: UTF-8 (recommended) Format: Human-readable markup Compression: None (plain text) Extensions: .adoc, .asciidoc, .asc |
Structure: Flat key=value pairs
Encoding: ISO-8859-1 or UTF-8 Format: Plain text configuration Compression: None (plain text) Extensions: .properties, .props |
| Syntax Examples |
AsciiDoc uses semantic markup: = Document Title :author: John Doe :version: 1.0 == Section Heading This is a *bold* paragraph. * List item 1 * List item 2 |
Properties uses simple key=value: # Document metadata document.title=Document Title document.author=John Doe document.version=1.0 # Section heading section.heading=Section Heading section.content=This is a paragraph |
| Content Support |
|
|
| Advantages |
|
|
| Disadvantages |
|
|
| Common Uses |
|
|
| Best For |
|
|
| Version History |
Introduced: 2002 (Stuart Rackham)
Current Version: Asciidoctor 2.x Status: Active development Evolution: Asciidoctor is modern implementation |
Introduced: 1996 (Java 1.0)
Current Version: Part of Java SE Status: Stable, maintained Evolution: XML properties added in Java 5 |
| Software Support |
Asciidoctor: Primary processor (Ruby/JS/Java)
IDEs: VS Code, IntelliJ, Atom plugins Preview: GitHub, GitLab rendering Other: AsciiDocFX, AsciidocLIVE |
Java: java.util.Properties (native)
Spring: @PropertySource, Environment Python: jproperties, configparser Other: Most languages have parsers |
Why Convert ADOC to Properties?
Converting AsciiDoc documents to Java Properties format is essential when you need to transform documented configuration specifications into actual configuration files for Java applications. This is particularly valuable when your technical documentation contains settings, message strings, or application parameters that need to be used by Java-based systems.
Java Properties files have been a cornerstone of Java application configuration since Java 1.0 in 1996. The format is natively supported by the java.util.Properties class, making it trivial to load and use in any Java application. Properties files are also the standard format for internationalization (i18n) resource bundles, allowing applications to support multiple languages.
AsciiDoc's structured content with attributes, definition lists, and sections can be effectively transformed into Properties format. Document attributes become properties, definition lists become key-value pairs, and section headings can be used as key prefixes to create hierarchical namespacing (e.g., database.host, database.port).
This conversion is particularly useful for Spring Boot applications (application.properties), Log4j configuration, Maven settings, and any Java project that uses properties for configuration. It is also invaluable for generating i18n message bundles from documented UI strings and translatable content.
Key Benefits of Converting ADOC to Properties:
- Java Native: Properties are natively supported in all Java versions
- Spring Integration: Directly usable as application.properties in Spring Boot
- i18n Support: Generate resource bundles for application localization
- Simple Format: Easy to read, edit, and version control
- Wide Compatibility: Supported by virtually all Java frameworks
- Documentation to Config: Transform documented settings into working config
- Build Tools: Use in Maven, Gradle, and other build configurations
Practical Examples
Example 1: Spring Boot Application Configuration
Input AsciiDoc file (spring-config.adoc):
= Spring Boot Configuration :application-name: myapp == Server Settings server.port:: 8080 server.address:: 0.0.0.0 server.servlet.context-path:: /api == Database Settings spring.datasource.url:: jdbc:postgresql://localhost:5432/mydb spring.datasource.username:: admin spring.datasource.password:: secret spring.jpa.hibernate.ddl-auto:: update
Output Properties file (application.properties):
# Server Settings server.port=8080 server.address=0.0.0.0 server.servlet.context-path=/api # Database Settings spring.datasource.url=jdbc:postgresql://localhost:5432/mydb spring.datasource.username=admin spring.datasource.password=secret spring.jpa.hibernate.ddl-auto=update
Example 2: Internationalization Messages
Input AsciiDoc file (messages.adoc):
= Application Messages
== Login Page
login.title:: Welcome to Our Application
login.username:: Username
login.password:: Password
login.button:: Sign In
login.error:: Invalid credentials
== Dashboard
dashboard.welcome:: Welcome, {0}!
dashboard.logout:: Logout
dashboard.settings:: Settings
Output Properties file (messages.properties):
# Login Page
login.title=Welcome to Our Application
login.username=Username
login.password=Password
login.button=Sign In
login.error=Invalid credentials
# Dashboard
dashboard.welcome=Welcome, {0}!
dashboard.logout=Logout
dashboard.settings=Settings
Example 3: Log4j Logging Configuration
Input AsciiDoc file (logging-config.adoc):
= Logging Configuration == Root Logger log4j.rootLogger:: INFO, console, file == Console Appender log4j.appender.console:: org.apache.log4j.ConsoleAppender log4j.appender.console.layout:: org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern:: %d %-5p %c - %m%n == Package Specific log4j.logger.com.myapp:: DEBUG log4j.logger.org.springframework:: WARN
Output Properties file (log4j.properties):
# Root Logger log4j.rootLogger=INFO, console, file # Console Appender log4j.appender.console=org.apache.log4j.ConsoleAppender log4j.appender.console.layout=org.apache.log4j.PatternLayout log4j.appender.console.layout.ConversionPattern=%d %-5p %c - %m%n # Package Specific log4j.logger.com.myapp=DEBUG log4j.logger.org.springframework=WARN
Frequently Asked Questions (FAQ)
Q: What are Java Properties files?
A: Java Properties files are simple text files containing key-value pairs used for configuration in Java applications. They have been part of Java since version 1.0 (1996). The format uses key=value or key:value syntax with # or ! for comments. Properties are loaded using java.util.Properties and are the standard for Java configuration and i18n.
Q: What is the difference between Properties and INI files?
A: While both are key-value formats, they differ: Properties files are flat (no sections), while INI files use [section] headers. Properties use = or : as separators; INI typically uses =. Properties natively support Unicode escapes (\uXXXX). For hierarchical organization in Properties, developers use dot notation (database.host) instead of sections.
Q: How does Spring Boot use Properties files?
A: Spring Boot uses application.properties as its primary configuration source. Properties configure the embedded server, database connections, logging, security, and more. Spring Boot supports property placeholders (${var}), profiles (application-dev.properties), and external configuration. Many Spring starters auto-configure based on these properties.
Q: Can Properties files handle Unicode and special characters?
A: Properties files traditionally use ISO-8859-1 encoding. For characters outside this range, use Unicode escapes (\uXXXX). For example, the Euro sign is \u20AC. However, Java 9+ added Properties.load() overloads accepting a Reader, allowing UTF-8 encoded files. Spring Boot 2.x+ defaults to UTF-8 for application.properties.
Q: How are AsciiDoc sections converted?
A: Since Properties format does not support sections, AsciiDoc sections are converted to comments (# Section Name) followed by related properties. The section name can also be used as a key prefix for hierarchical namespacing. For example, content under "== Database" becomes database.host, database.port, etc.
Q: Can I use the output for i18n resource bundles?
A: Yes! Properties files are the standard format for Java internationalization. Create separate files for each locale: messages.properties (default), messages_fr.properties (French), messages_de.properties (German). Java ResourceBundle loads the appropriate file based on user locale. Spring MessageSource provides similar functionality.
Q: How do I handle multi-line values?
A: Properties files support multi-line values using backslash (\) at the end of a line as a continuation character. Whitespace at the beginning of continuation lines is trimmed. Alternatively, use \n for newline characters within the value itself.
Q: Are Properties files still relevant with YAML and JSON?
A: Absolutely! While YAML and JSON offer more features, Properties remain relevant: native Java support without additional libraries, simpler syntax for flat configuration, required format for i18n resource bundles, widely used in enterprise Java. Spring Boot supports both .properties and .yaml, and many prefer Properties for simpler configs.