Skip to content

Commit 72ea7a7

Browse files
committed
chore: simplify code
1 parent 6d2fe04 commit 72ea7a7

2 files changed

Lines changed: 19 additions & 25 deletions

File tree

Fable.Literate/App.fs

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ module Utils =
8282
"@alfonsogarciacaro"
8383
"@ncave"
8484
"@MangelMaxime"
85-
"@claude-code 🤖"
85+
"@claude 🤖"
8686
|]
8787

8888
/// Returns a random contributor from the list.
@@ -123,8 +123,8 @@ module Utils =
123123

124124
if endPos > start then
125125
directive.Substring(start, endPos - start).Trim()
126-
|> fun s -> s.Split(',')
127-
|> Array.map (fun s -> s.Trim())
126+
|> _.Split(',')
127+
|> Array.map _.Trim()
128128
|> Array.filter (fun s -> s.Length > 0)
129129
|> Array.toList
130130
else
@@ -257,7 +257,7 @@ module Parser =
257257
lines
258258
|> Seq.fold parseLine initial
259259
|> flushState
260-
|> fun ctx -> List.rev ctx.Blocks
260+
|> _.Blocks |> List.rev
261261

262262
(**
263263
## Transform Module
@@ -280,7 +280,7 @@ module Transform =
280280
/// Filters standalone module/namespace declarations (e.g., "module Foo" or "namespace Bar")
281281
/// but keeps module definitions with bodies (e.g., "module Foo =").
282282
let private isBoilerplate (lines: string list) : bool =
283-
let code = lines |> String.concat "\n" |> (fun s -> s.Trim())
283+
let code = lines |> String.concat "\n" |> _.Trim()
284284

285285
String.IsNullOrWhiteSpace code
286286
|| code.StartsWith "namespace "
@@ -322,18 +322,15 @@ module MarkdownPrinter =
322322
/// Render a single block to markdown.
323323
let private printBlock (block: Block) : string =
324324
match block with
325-
| Markdown content -> content + "\n"
325+
| Markdown content -> $"{content}\n"
326326
| FSharpCode lines ->
327327
let code = lines |> String.concat "\n" |> trimCode
328-
"\n```fsharp\n" + code + "\n```\n\n"
329-
| PythonCode content -> "\n```python\n" + content + "\n```\n\n"
328+
$"\n```fsharp\n{code}\n```\n\n"
329+
| PythonCode content -> $"\n```python\n{content}\n```\n\n"
330330
| IncludePython symbols ->
331331
// Unresolved - should have been transformed
332332
let symbolList = String.concat ", " symbols
333-
334-
"\n<!-- include-python: "
335-
+ symbolList
336-
+ " (unresolved) -->\n"
333+
$"\n<!-- include-python: {symbolList} (unresolved) -->\n"
337334
| Hidden _ -> "" // Should have been filtered
338335

339336
/// Render a document to markdown string.

docs/blogpost.md

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Introduction to Fable.Python
22

3-
*Generated on 2025-12-22 13:26 UTC using Fable v5.0.0-alpha.21*
3+
*Generated on 2025-12-22 13:28 UTC using Fable v5.0.0-alpha.21*
44

55
> This post is part of the [F# Advent Calendar
66
2025](https://sergeytihon.com/2025/11/03/f-advent-calendar-in-english-2025/). Thank you, Sergey Tihon, for organizing
@@ -3428,7 +3428,7 @@ module Utils =
34283428
"@alfonsogarciacaro"
34293429
"@ncave"
34303430
"@MangelMaxime"
3431-
"@claude-code 🤖"
3431+
"@claude 🤖"
34323432
|]
34333433
34343434
/// Returns a random contributor from the list.
@@ -3469,8 +3469,8 @@ module Utils =
34693469
34703470
if endPos > start then
34713471
directive.Substring(start, endPos - start).Trim()
3472-
|> fun s -> s.Split(',')
3473-
|> Array.map (fun s -> s.Trim())
3472+
|> _.Split(',')
3473+
|> Array.map _.Trim()
34743474
|> Array.filter (fun s -> s.Length > 0)
34753475
|> Array.toList
34763476
else
@@ -3539,7 +3539,7 @@ Parse lines into a document AST
35393539
lines
35403540
|> Seq.fold parseLine initial
35413541
|> flushState
3542-
|> fun ctx -> List.rev ctx.Blocks
3542+
|> _.Blocks |> List.rev
35433543
```
35443544

35453545
### Transform Module
@@ -3562,7 +3562,7 @@ module Transform =
35623562
/// Filters standalone module/namespace declarations (e.g., "module Foo" or "namespace Bar")
35633563
/// but keeps module definitions with bodies (e.g., "module Foo =").
35643564
let private isBoilerplate (lines: string list) : bool =
3565-
let code = lines |> String.concat "\n" |> (fun s -> s.Trim())
3565+
let code = lines |> String.concat "\n" |> _.Trim()
35663566
35673567
String.IsNullOrWhiteSpace code
35683568
|| code.StartsWith "namespace "
@@ -3585,18 +3585,15 @@ module MarkdownPrinter =
35853585
/// Render a single block to markdown.
35863586
let private printBlock (block: Block) : string =
35873587
match block with
3588-
| Markdown content -> content + "\n"
3588+
| Markdown content -> $"{content}\n"
35893589
| FSharpCode lines ->
35903590
let code = lines |> String.concat "\n" |> trimCode
3591-
"\n```fsharp\n" + code + "\n```\n\n"
3592-
| PythonCode content -> "\n```python\n" + content + "\n```\n\n"
3591+
$"\n```fsharp\n{code}\n```\n\n"
3592+
| PythonCode content -> $"\n```python\n{content}\n```\n\n"
35933593
| IncludePython symbols ->
35943594
// Unresolved - should have been transformed
35953595
let symbolList = String.concat ", " symbols
3596-
3597-
"\n<!-- include-python: "
3598-
+ symbolList
3599-
+ " (unresolved) -->\n"
3596+
$"\n<!-- include-python: {symbolList} (unresolved) -->\n"
36003597
| Hidden _ -> "" // Should have been filtered
36013598
36023599
/// Render a document to markdown string.

0 commit comments

Comments
 (0)