Add support for rotated appendices: implement 90° CCW image rotation for portrait pages, enhance table rendering logic, and update diagram handling directives.
This commit is contained in:
@@ -55,6 +55,7 @@ const (
|
||||
type Appendix struct {
|
||||
Kind AppendixKind
|
||||
Landscape bool // true → render on a landscape A4 page (15 mm symmetric margins)
|
||||
Rotated bool // true → portrait page, image rotated 90° CCW so long axis runs top-to-bottom
|
||||
Title string
|
||||
Path string // image path (Kind == AppendixKindImage)
|
||||
TableData [][][]InlineSpan // table rows (Kind == AppendixKindTable)
|
||||
@@ -194,6 +195,35 @@ func (r *IHKRenderer) AddCodeAppendix(title, lang, code string) {
|
||||
})
|
||||
}
|
||||
|
||||
// AddRotatedImageAppendix registers an image annex rendered on a portrait A4 page
|
||||
// with the image rotated 90° CCW, so a wide (landscape-ratio) diagram fills the
|
||||
// full page height when the reader tilts the page 90° clockwise.
|
||||
// Format: "Title | /path/to/image"
|
||||
func (r *IHKRenderer) AddRotatedImageAppendix(titlePath string) {
|
||||
parts := strings.SplitN(titlePath, "|", 2)
|
||||
if len(parts) < 2 {
|
||||
log.Printf("warning: @AnhangBildGedreht directive missing '|' separator: %q", titlePath)
|
||||
return
|
||||
}
|
||||
r.appendices = append(r.appendices, Appendix{
|
||||
Kind: AppendixKindImage,
|
||||
Rotated: true,
|
||||
Title: strings.TrimSpace(parts[0]),
|
||||
Path: strings.TrimSpace(parts[1]),
|
||||
})
|
||||
}
|
||||
|
||||
// AddRotatedUMLAppendix registers a UML/diagram annex (code block) rendered on a
|
||||
// portrait A4 page with the diagram image rotated 90° CCW.
|
||||
func (r *IHKRenderer) AddRotatedUMLAppendix(title, imgPath string) {
|
||||
r.appendices = append(r.appendices, Appendix{
|
||||
Kind: AppendixKindImage,
|
||||
Rotated: true,
|
||||
Title: title,
|
||||
Path: imgPath,
|
||||
})
|
||||
}
|
||||
|
||||
// AddLandscapeAppendix registers an image annex in "Title | /path/to/image" format
|
||||
// that will be rendered on a landscape A4 page with 15 mm symmetric margins.
|
||||
func (r *IHKRenderer) AddLandscapeAppendix(titlePath string) {
|
||||
|
||||
Reference in New Issue
Block a user