Skip to content

Commit 9c2fe9d

Browse files
committed
Fixing formatting
1 parent 6986d86 commit 9c2fe9d

File tree

2 files changed

+34
-34
lines changed

2 files changed

+34
-34
lines changed

convert/kfx/frag_storyline.go

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -57,24 +57,24 @@ func BuildSectionFragment(sectionName string, pageTemplates []any) *Fragment {
5757
// Based on reference: {$155: eid, $176: storyline_name, $66: w, $67: h, $156: layout, $140: float, $159: $270}
5858
func NewPageTemplateEntry(eid int, storylineName string, width, height int) StructValue {
5959
return NewStruct().
60-
SetInt(SymUniqueID, int64(eid)). // $155 = id
60+
SetInt(SymUniqueID, int64(eid)). // $155 = id
6161
Set(SymStoryName, SymbolByName(storylineName)). // $176 = story_name ref
62-
SetInt(SymWidth, int64(width)). // $66 = width
63-
SetInt(SymHeight, int64(height)). // $67 = height
64-
SetSymbol(SymLayout, SymPage). // $156 = layout = $326 (page)
65-
SetSymbol(SymFloat, SymCenter). // $140 = float = $320 (center)
66-
SetSymbol(SymType, SymContainer) // $159 = type = $270 (container)
62+
SetInt(SymWidth, int64(width)). // $66 = width
63+
SetInt(SymHeight, int64(height)). // $67 = height
64+
SetSymbol(SymLayout, SymPage). // $156 = layout = $326 (page)
65+
SetSymbol(SymFloat, SymCenter). // $140 = float = $320 (center)
66+
SetSymbol(SymType, SymContainer) // $159 = type = $270 (container)
6767
}
6868

6969
// ContentRef represents a reference to content within a storyline.
7070
type ContentRef struct {
71-
EID int // Element ID ($155)
72-
Type int // Content type symbol ($269=text, $270=container, $271=image, etc.)
73-
ContentName string // Name of the content fragment
74-
ContentOffset int // Offset within content fragment ($403)
75-
Style string // Optional style name
71+
EID int // Element ID ($155)
72+
Type int // Content type symbol ($269=text, $270=container, $271=image, etc.)
73+
ContentName string // Name of the content fragment
74+
ContentOffset int // Offset within content fragment ($403)
75+
Style string // Optional style name
7676
StyleEvents []StyleEventRef // Optional inline style events ($142)
77-
Children []any // Optional nested content for containers
77+
Children []any // Optional nested content for containers
7878
}
7979

8080
// StyleEventRef represents a style event for inline formatting ($142).
@@ -89,8 +89,8 @@ type StyleEventRef struct {
8989
// Based on reference: {$155: eid, $157: style, $159: type, $145: {name: content_X, $403: offset}}
9090
func NewContentEntry(ref ContentRef) StructValue {
9191
entry := NewStruct().
92-
SetInt(SymUniqueID, int64(ref.EID)). // $155 = id
93-
SetSymbol(SymType, ref.Type) // $159 = type
92+
SetInt(SymUniqueID, int64(ref.EID)). // $155 = id
93+
SetSymbol(SymType, ref.Type) // $159 = type
9494

9595
if ref.Style != "" {
9696
entry.Set(SymStyle, SymbolByName(ref.Style)) // $157 = style as symbol
@@ -102,7 +102,7 @@ func NewContentEntry(ref ContentRef) StructValue {
102102
for _, se := range ref.StyleEvents {
103103
ev := NewStruct().
104104
SetInt(SymOffset, int64(se.Offset)). // $143 = offset
105-
SetInt(SymLength, int64(se.Length)) // $144 = length
105+
SetInt(SymLength, int64(se.Length)) // $144 = length
106106
if se.Style != "" {
107107
ev.Set(SymStyle, SymbolByName(se.Style)) // $157 = style
108108
}
@@ -116,8 +116,8 @@ func NewContentEntry(ref ContentRef) StructValue {
116116

117117
// Content reference - nested struct with name and offset
118118
contentRef := map[string]any{
119-
"name": SymbolByName(ref.ContentName),
120-
"$403": ref.ContentOffset,
119+
"name": SymbolByName(ref.ContentName),
120+
"$403": ref.ContentOffset,
121121
}
122122
entry.Set(SymContent, contentRef) // $145 = content
123123

@@ -131,11 +131,11 @@ func NewContentEntry(ref ContentRef) StructValue {
131131

132132
// StorylineBuilder helps build storyline content incrementally.
133133
type StorylineBuilder struct {
134-
name string // Storyline name (e.g., "l1")
135-
sectionName string // Associated section name (e.g., "c0")
134+
name string // Storyline name (e.g., "l1")
135+
sectionName string // Associated section name (e.g., "c0")
136136
contentEntries []ContentRef
137137
eidCounter int
138-
pageTemplateEID int // Separate EID for page template container
138+
pageTemplateEID int // Separate EID for page template container
139139
}
140140

141141
// NewStorylineBuilder creates a new storyline builder.
@@ -144,8 +144,8 @@ func NewStorylineBuilder(storyName, sectionName string, startEID int) *Storyline
144144
return &StorylineBuilder{
145145
name: storyName,
146146
sectionName: sectionName,
147-
pageTemplateEID: startEID, // First EID goes to page template
148-
eidCounter: startEID + 1, // Content EIDs start after page template
147+
pageTemplateEID: startEID, // First EID goes to page template
148+
eidCounter: startEID + 1, // Content EIDs start after page template
149149
}
150150
}
151151

convert/kfx/frag_style.go

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,19 @@ const (
2323

2424
// Font style/weight values
2525
const (
26-
SymFontNormal = 350 // normal
27-
SymFontBold = 361 // bold
28-
SymFontItalic = 382 // italic
29-
SymFontSemibold = 362 // semibold
30-
SymFontLight = 363 // light
31-
SymFontMedium = 364 // medium
26+
SymFontNormal = 350 // normal
27+
SymFontBold = 361 // bold
28+
SymFontItalic = 382 // italic
29+
SymFontSemibold = 362 // semibold
30+
SymFontLight = 363 // light
31+
SymFontMedium = 364 // medium
3232
)
3333

3434
// StyleDef defines a KFX style with its properties.
3535
type StyleDef struct {
36-
Name string // Style name (becomes local symbol)
37-
Parent string // Parent style name (for inheritance)
38-
Properties map[int]any // KFX property symbol -> value
36+
Name string // Style name (becomes local symbol)
37+
Parent string // Parent style name (for inheritance)
38+
Properties map[int]any // KFX property symbol -> value
3939
}
4040

4141
// DimensionValue creates a dimension value with unit.
@@ -171,8 +171,8 @@ func BuildStyleFragment(def StyleDef) *Fragment {
171171
// StyleRegistry manages style definitions and generates style fragments.
172172
type StyleRegistry struct {
173173
styles map[string]StyleDef
174-
order []string // Preserve insertion order
175-
used map[string]bool // Track which styles are actually used
174+
order []string // Preserve insertion order
175+
used map[string]bool // Track which styles are actually used
176176
}
177177

178178
// NewStyleRegistry creates a new style registry.
@@ -203,7 +203,7 @@ func (sr *StyleRegistry) Names() []string {
203203
}
204204

205205
// EnsureStyle ensures a style exists, creating a minimal one if needed.
206-
// Marks the style as used for output. This is used for dynamically
206+
// Marks the style as used for output. This is used for dynamically
207207
// encountered styles from FB2 paragraphs.
208208
func (sr *StyleRegistry) EnsureStyle(name string) {
209209
sr.used[name] = true

0 commit comments

Comments
 (0)