Skip to content

Commit e320797

Browse files
committed
feat: add ExampleBadge to all Korean documentation code examples
- Add ExampleBadge component before each code block (trb, ruby, rbs) - Links to corresponding spec file in t-ruby repository - 42 documents updated with verified example badges
1 parent 27165bf commit e320797

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1506
-0
lines changed

i18n/ko/docusaurus-plugin-content-docs/current/cli/compiler-options.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ trc compile --strict src/
3737
- 암시적 `any` 타입 불가
3838
- 엄격한 nil 검사 활성화
3939

40+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
41+
4042
```trb
4143
# 엄격 모드는 전체 타입 지정 필요
4244
def process(data: Array<String>): Hash<String, Integer>
@@ -59,6 +61,8 @@ trc compile --permissive src/
5961
- 암시적 `any` 허용
6062
- 명시적 타입 오류만 캐치
6163

64+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
65+
6266
```ruby
6367
# 관용 모드는 타입 없는 코드 허용
6468
def process(data)
@@ -76,6 +80,8 @@ end
7680
trc compile --no-implicit-any src/
7781
```
7882

83+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
84+
7985
```trb
8086
# --no-implicit-any 사용 시 오류
8187
def process(data) # 오류: 암시적 any
@@ -96,6 +102,8 @@ end
96102
trc compile --strict-nil src/
97103
```
98104

105+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
106+
99107
```trb
100108
# --strict-nil 사용 시 오류
101109
def find_user(id: Integer): User # 오류: nil을 반환할 수 있음
@@ -116,6 +124,8 @@ end
116124
trc compile --no-unused-vars src/
117125
```
118126

127+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
128+
119129
```trb
120130
# --no-unused-vars 사용 시 경고
121131
def calculate(x: Integer, y: Integer): Integer
@@ -136,6 +146,8 @@ end
136146
trc compile --no-unchecked-indexed-access src/
137147
```
138148

149+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
150+
139151
```trb
140152
# --no-unchecked-indexed-access 사용 시 오류
141153
users: Array<User> = get_users()
@@ -155,6 +167,8 @@ end
155167
trc compile --require-return-types src/
156168
```
157169

170+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
171+
158172
```trb
159173
# --require-return-types 사용 시 오류
160174
def calculate(x: Integer) # 오류: 반환 타입 누락
@@ -335,6 +349,8 @@ trc compile --optimize basic src/
335349
- `aggressive` - 최대 최적화
336350
337351
**none:**
352+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
353+
338354
```ruby
339355
# 코드 구조 변경 없음
340356
CONSTANT = 42
@@ -345,6 +361,8 @@ end
345361
```
346362
347363
**basic:**
364+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
365+
348366
```ruby
349367
# 상수 인라인, 데드 코드 제거
350368
def calculate
@@ -353,6 +371,8 @@ end
353371
```
354372
355373
**aggressive:**
374+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/compiler_options_spec.rb" line={21} />
375+
356376
```ruby
357377
# 함수 인라인, 코드 재정렬 가능
358378
def calculate

i18n/ko/docusaurus-plugin-content-docs/current/cli/configuration.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,8 @@ compiler:
254254
- 암시적 `any` 타입 불허
255255
- 엄격한 nil 검사 활성화
256256

257+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
258+
257259
```trb
258260
# 엄격 모드에서 필요
259261
def process(data: Array<String>): Hash<String, Integer>
@@ -270,6 +272,8 @@ end
270272
- 지역 변수는 추론 가능
271273
- 암시적 `any`에 경고
272274

275+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
276+
273277
```trb
274278
# 표준 모드에서 OK
275279
def process(data: Array<String>): Hash<String, Integer>
@@ -290,6 +294,8 @@ end
290294
- 암시적 `any` 타입 허용
291295
- 기존 코드 마이그레이션에 유용
292296

297+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
298+
293299
```ruby
294300
# 관용 모드에서 OK
295301
def process(data)
@@ -317,6 +323,8 @@ compiler:
317323

318324
예시 - 패턴 매칭:
319325

326+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
327+
320328
```trb
321329
# 입력 (.trb)
322330
case value
@@ -326,6 +334,8 @@ end
326334
```
327335

328336
`target_ruby: "3.0"` 사용 시:
337+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
338+
329339
```ruby
330340
# 패턴 매칭 사용 (Ruby 3.0+)
331341
case value
@@ -335,6 +345,8 @@ end
335345
```
336346

337347
`target_ruby: "2.7"` 사용 시:
348+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
349+
338350
```ruby
339351
# case/when으로 폴백
340352
case
@@ -372,6 +384,8 @@ compiler:
372384
373385
**no_implicit_any**
374386
387+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
388+
375389
```trb
376390
# no_implicit_any: true일 때 오류
377391
def process(data) # 오류: 암시적 'any' 타입
@@ -386,6 +400,8 @@ end
386400

387401
**no_unused_vars**
388402

403+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
404+
389405
```trb
390406
# no_unused_vars: true일 때 경고
391407
def calculate(x: Integer, y: Integer): Integer
@@ -396,6 +412,8 @@ end
396412

397413
**strict_nil**
398414

415+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
416+
399417
```trb
400418
# strict_nil: true일 때 오류
401419
def find_user(id: Integer): User # 오류: nil을 반환할 수 있음
@@ -410,6 +428,8 @@ end
410428

411429
**no_unchecked_indexed_access**
412430

431+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/cli/configuration_spec.rb" line={21} />
432+
413433
```trb
414434
# no_unchecked_indexed_access: true일 때 오류
415435
users: Array<User> = get_users()

i18n/ko/docusaurus-plugin-content-docs/current/getting-started/first-trb-file.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ description: 첫 번째 T-Ruby 파일 생성 및 컴파일
2222

2323
간단한 계산기를 구현하는 `calculator.trb` 파일을 만들어봅시다:
2424

25+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
26+
2527
```trb title="calculator.trb"
2628
# calculator.trb - 간단한 타입 계산기
2729
@@ -47,6 +49,8 @@ end
4749

4850
문법을 분석해봅시다:
4951

52+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
53+
5054
```trb
5155
def add(a: Integer, b: Integer): Integer
5256
# ^^^ ^ ^^^^^^^ ^ ^^^^^^^ ^^^^^^^
@@ -63,6 +67,8 @@ def add(a: Integer, b: Integer): Integer
6367

6468
계산기를 더 고급 기능으로 확장해봅시다:
6569

70+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
71+
6672
```trb title="calculator.trb"
6773
# 더 깔끔한 코드를 위한 타입 별칭
6874
type Number = Integer | Float
@@ -100,6 +106,8 @@ end
100106

101107
`|` 연산자는 union 타입을 생성합니다:
102108

109+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
110+
103111
```trb
104112
type Number = Integer | Float # Integer 또는 Float일 수 있음
105113
@@ -114,6 +122,8 @@ end
114122

115123
`<T>` 문법은 제네릭 타입 매개변수를 정의합니다:
116124

125+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
126+
117127
```trb
118128
def max<T: Comparable>(a: T, b: T): T
119129
# ^^ ^^^^^^^^^^
@@ -131,6 +141,8 @@ max("a", "b") # T는 String
131141

132142
Calculator 클래스를 만들어봅시다:
133143

144+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
145+
134146
```trb title="calculator.trb"
135147
class Calculator
136148
# 타입 어노테이션이 있는 인스턴스 변수
@@ -216,6 +228,8 @@ ruby build/calculator.rb
216228

217229
생성된 파일을 살펴보세요:
218230

231+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
232+
219233
```ruby title="build/calculator.rb"
220234
class Calculator
221235
def initialize
@@ -232,6 +246,8 @@ class Calculator
232246
end
233247
```
234248

249+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
250+
235251
```rbs title="build/calculator.rbs"
236252
type Number = Integer | Float
237253
@@ -252,6 +268,8 @@ end
252268

253269
### 옵셔널 매개변수
254270

271+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
272+
255273
```trb
256274
def greet(name: String, greeting: String = "Hello"): String
257275
"#{greeting}, #{name}!"
@@ -263,6 +281,8 @@ greet("Alice", "Hi") # "Hi, Alice!"
263281

264282
### Nullable 타입 (옵셔널 축약형)
265283

284+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
285+
266286
```trb
267287
# 다음은 동일합니다:
268288
def find(id: Integer): User | nil
@@ -271,6 +291,8 @@ def find(id: Integer): User? # 축약형
271291

272292
### 블록 매개변수
273293

294+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/first_trb_file_spec.rb" line={21} />
295+
274296
```trb
275297
def each_item(items: Array<String>, &block: (String) -> void): void
276298
items.each(&block)

i18n/ko/docusaurus-plugin-content-docs/current/getting-started/project-configuration.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,8 @@ trc --config trc.production.yaml
236236

237237
Gemfile에 T-Ruby 추가:
238238

239+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/project_configuration_spec.rb" line={21} />
240+
239241
```ruby title="Gemfile"
240242
source "https://rubygems.org"
241243
@@ -248,6 +250,8 @@ end
248250

249251
Rake 태스크 생성:
250252

253+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/project_configuration_spec.rb" line={21} />
254+
251255
```ruby title="Rakefile"
252256
require "t-ruby/rake_task"
253257
@@ -293,6 +297,8 @@ types:
293297

294298
`config/application.rb`에 추가:
295299

300+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/project_configuration_spec.rb" line={21} />
301+
296302
```ruby
297303
# 개발 중 .trb 파일 감시
298304
config.watchable_extensions << "trb"

i18n/ko/docusaurus-plugin-content-docs/current/getting-started/quick-start.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ description: 첫 T-Ruby 프로그램 작성하기
1515

1616
`hello.trb` 파일을 만들어 봅시다:
1717

18+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/quick_start_spec.rb" line={21} />
19+
1820
```trb
1921
# hello.trb
2022
@@ -59,6 +61,8 @@ ruby hello.rb
5961

6062
T-Ruby는 Ruby의 기본 타입을 모두 지원합니다:
6163

64+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/quick_start_spec.rb" line={21} />
65+
6266
```trb
6367
# 기본 타입
6468
name: String = "홍길동"
@@ -79,6 +83,8 @@ email: String? = nil
7983

8084
함수의 매개변수와 반환 타입을 지정합니다:
8185

86+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/quick_start_spec.rb" line={21} />
87+
8288
```trb
8389
# 기본 함수
8490
def add(a: Integer, b: Integer): Integer
@@ -105,6 +111,8 @@ end
105111

106112
클래스에 타입을 적용합니다:
107113

114+
<ExampleBadge status="pass" testFile="spec/docs_site/pages/getting_started/quick_start_spec.rb" line={21} />
115+
108116
```trb
109117
class User
110118
@name: String

0 commit comments

Comments
 (0)