Skip to content

Commit bbe2f1f

Browse files
committed
Update
1 parent 16bd68b commit bbe2f1f

File tree

2 files changed

+60
-7
lines changed

2 files changed

+60
-7
lines changed

_pages/en/docs/guides/introduce-apon.md

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,57 @@ APON is a data format that combines features from both JSON and YAML to enhance
2929
| **Item Separation** | Comma (`,`) | Newline + Indentation | **Newline** |
3030
| **Comments** | Not supported | Supported (`#`) | Supported (`#`) |
3131

32-
The biggest differences are in **how the structure is defined** and **how items are separated**. APON creates an explicit structure with parentheses like JSON, but uses newlines as item separators to maximize readability. This is a distinct feature from YAML, which defines the entire structure through the combination of newlines and indentation.
32+
The biggest differences are in **how the structure is defined** and **how items are separated**. APON creates an explicit structure with parentheses like JSON, but uses newlines as item separators to maximize readability. This is a distinct feature from YAML, which defines the entire structure through the combination of newlines and indentation. Also, by not using commas (`,`), APON prevents syntax errors common in JSON (like trailing comma issues) when adding or removing items, and keeps change history in version control systems (like Git) clean.
3333

3434
## 2. Basic Syntax
3535

36+
### Comments
37+
38+
In APON, comments must start with the `#` character on a **new line**.
39+
**Inline comments** (adding a comment after a parameter value on the same line) are **not supported**.
40+
41+
This design choice avoids forcing the use of quotes when the `#` character is part of the data value (e.g., CSS color codes like `#FFFFFF` or hashtags), thereby increasing input flexibility.
42+
43+
```apon
44+
# Correct usage of comments
45+
timeout: 30
46+
47+
# Incorrect usage (treated as a string value, not a comment)
48+
# The value of timeout becomes the string "30 # 30 seconds", not the number 30.
49+
timeout: 30 # 30 seconds
50+
```
51+
3652
### Single Value (Parameter)
3753

3854
The most basic unit in APON can have a single value in the format `name: value`.
55+
Keys and values are separated by a colon (`:`), and the value extends from the colon to the **end of the line**.
56+
57+
This characteristic offers several advantages:
58+
* Quotes are not required even if the value contains spaces in the middle.
59+
* Values containing special characters, like URLs or file paths, can be written as-is without escaping.
60+
* There is no need to type a comma (`,`) to indicate the end of a value.
61+
3962
It is common to omit quotes (`"`) unless the value has the following special conditions:
4063

41-
* If there are spaces at the beginning or end of the value.
64+
* If there are spaces at the beginning or end of the value (spaces in the middle are fine).
4265
* If the value contains single (`'`) or double (`"`) quotes.
4366
* If the value contains a newline character (`\n`).
67+
* If the value is an empty string.
4468

4569
```apon
46-
# Example without double quotes
70+
# Example without double quotes (Value extends to the end of the line)
4771
name: John Doe
4872
age: 30
4973
city: New York
74+
url: https://example.com/api?query=value
75+
color: #FF5733
5076
5177
# Example requiring double quotes
5278
message: "'Hello, World'"
5379
message: "First line\nNew line"
5480
indented: " Leading spaces"
5581
indented: "Trailing spaces "
82+
empty: ""
5683
```
5784

5885
### Set (Parameters)

_pages/ko/docs/guides/introduce-apon.md

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,30 +29,57 @@ APON은 JSON과 YAML의 특징을 조합하여 가독성과 편의성을 높인
2929
| **항목 구분** | 쉼표 (`,`) | 줄바꿈 + 들여쓰기 | **줄바꿈** |
3030
| **주석** | 미지원 | 지원 (`#`) | 지원 (`#`) |
3131

32-
가장 큰 차이점은 **구조를 정의하는 방식****항목을 구분하는 방식**입니다. APON은 JSON처럼 괄호로 명시적인 구조를 만들지만, 항목 구분자로는 줄바꿈을 사용하여 가독성을 극대화합니다. 이는 줄바꿈과 들여쓰기의 조합으로 구조 전체를 정의하는 YAML과는 구분되는 특징입니다.
32+
가장 큰 차이점은 **구조를 정의하는 방식****항목을 구분하는 방식**입니다. APON은 JSON처럼 괄호로 명시적인 구조를 만들지만, 항목 구분자로는 줄바꿈을 사용하여 가독성을 극대화합니다. 이는 줄바꿈과 들여쓰기의 조합으로 구조 전체를 정의하는 YAML과는 구분되는 특징입니다. 또한 콤마(`,`)를 사용하지 않음으로써 항목을 추가하거나 삭제할 때 발생할 수 있는 문법 오류(Trailing Comma 문제 등)를 방지하고, 버전 관리 시스템(Git 등)에서의 변경 이력을 깔끔하게 유지할 수 있습니다.
3333

3434
## 2. 기본 문법
3535

36+
### 주석 (Comments)
37+
38+
APON에서 주석은 반드시 **새로운 줄(New Line)**`#` 문자로 시작해야 합니다.
39+
파라미터 값 뒤에 `#`을 붙여 설명을 적는 **인라인 주석(Inline Comment)은 지원하지 않습니다.**
40+
41+
이는 데이터 값에 `#` 문자(예: CSS 색상 코드 `#FFFFFF`, 해시태그 등)가 포함될 때, 불필요하게 따옴표로 감싸야 하는 번거로움을 없애고 입력의 자유도를 높이기 위함입니다.
42+
43+
```apon
44+
# 올바른 주석 사용 예
45+
timeout: 30
46+
47+
# 잘못된 주석 사용 예 (주석이 아닌 문자열 값으로 인식됨)
48+
# timeout의 값은 숫자 30이 아닌 문자열 "30 # 30 seconds"가 됩니다.
49+
timeout: 30 # 30 seconds
50+
```
51+
3652
### 단일 값 (Parameter)
3753

3854
APON의 가장 기본적인 단위는 `이름: 값` 형식의 단일 값을 가질 수 있습니다.
55+
키와 값은 콜론(`:`)으로 구분되며, 콜론 이후부터 **행의 끝(End of Line)까지**가 모두 값으로 간주됩니다.
56+
57+
이러한 특징 덕분에 다음과 같은 장점이 있습니다.
58+
* 값 중간에 공백이 있어도 따옴표가 필요 없습니다.
59+
* URL이나 파일 경로처럼 특수문자가 포함된 값도 이스케이프 처리 없이 그대로 쓸 수 있습니다.
60+
* 값의 끝을 알리기 위해 콤마(`,`)를 입력할 필요가 없습니다.
61+
3962
값(value)에 다음과 같은 특수 조건이 없는 한 따옴표(`"`)를 생략하는 것이 일반적입니다.
4063

41-
* 값의 앞이나 뒤에 공백이 있는 경우
64+
* 값의 앞이나 뒤에 공백이 있는 경우 (중간 공백은 괜찮음)
4265
* 값에 작은따옴표(`'`)나 큰따옴표(`"`)가 포함된 경우
4366
* 값에 줄바꿈 문자(`\n`)가 포함된 경우
67+
* 값이 빈 문자열인 경우
4468

4569
```apon
46-
# 큰따옴표를 사용하지 않은 예
70+
# 큰따옴표를 사용하지 않은 예 (행 끝까지 값으로 인식)
4771
name: John Doe
4872
age: 30
4973
city: New York
74+
url: https://example.com/api?query=value
75+
color: #FF5733
5076
5177
# 큰따옴표를 사용해야 하는 예
5278
message: "'Hello, World'"
5379
message: "First line\nNew line"
5480
indented: " 앞에 공백이 있음"
5581
indented: "뒤에 공백이 있음 "
82+
empty: ""
5683
```
5784

5885
### 집합 (Parameters)
@@ -115,7 +142,6 @@ APON은 다양한 데이터 타입을 지원하며, `이름(타입): 값`의 형
115142

116143
**`float`에 대한 중요 참고 사항:** 소수점 숫자를 `java.lang.Float`로 파싱하려면 APON 텍스트에서 `float`로 명시적으로 타입을 지정하거나(예: `score(float): 95.5`) `ValueType.FLOAT`를 가진 `ParameterKey`를 정의해야 합니다. 그렇지 않으면 소수점 숫자는 기본적으로 `java.lang.Double`로 처리됩니다.
117144

118-
119145
| Value Type | Java Object Type | 예시 |
120146
| :--- | :--- |:------------------------------|
121147
| `string` | `java.lang.String` | `name(string): Hello, World.` |

0 commit comments

Comments
 (0)