// TransformDummyTitlepage adds a dummy titlepage if forced or the heuristic
// determines that is is necessary. If there was an error determining if the
// titlepage is required, false and an error is returned. If it is not required,
// false is returned. If it is required, but there was an error when adding it,
// true and an error is returned.  If it was added successfully, the filename
// and contents of the content document to add to the epub and true is returned.
//
// The heuristic determines whether the first content file in the spine is a
// title page without other content, and if it isn't (or if force is true), it
// adds a blank content document and modifies the OPF to add it to the manifest
// and start of the spine. This is required because Kobo will treat the first
// spine entry specially (e.g. no margins) for full-screen book covers. See #33.
//
// Note that the heuristic is subject to change between kepubify versions.
TransformDummyTitlepage adds a dummy titlepage if forced or the heuristic
determines that is is necessary. If there was an error determining if the
titlepage is required, false and an error is returned. If it is not required,
false is returned. If it is required, but there was an error when adding it,
true and an error is returned.  If it was added successfully, the filename
and contents of the content document to add to the epub and true is returned.

The heuristic determines whether the first content file in the spine is a
title page without other content, and if it isn't (or if force is true), it
adds a blank content document and modifies the OPF to add it to the manifest
and start of the spine. This is required because Kobo will treat the first
spine entry specially  for full-screen book covers.

Note that the heuristic is subject to change between kepubify versions.
// TransformDummyTitlepage adds a dummy titlepage if forced or the heuristic // determines that is is necessary . If there was an error determining if the // titlepage is required false and an error is returned . If it is not required // false is returned . If it is required but there was an error when adding it // true and an error is returned . If it was added successfully the filename // and contents of the content document to add to the epub and true is returned . // // The heuristic determines whether the first content file in the spine is a // title page without other content and if it isn ' t ( or if force is true ) it // adds a blank content document and modifies the OPF to add it to the manifest // and start of the spine . This is required because Kobo will treat the first // spine entry specially ( e . g . no margins ) for full - screen book covers . See #33 . // // Note that the heuristic is subject to change between kepubify versions .
func (c *Converter) TransformDummyTitlepage(epub fs.FS, opfF string, opf *bytes.Buffer) (string, io.Reader, bool, error) {
	if c.dummyTitlepageForce {
		if !c.dummyTitlepageForceValue {
			return "", nil, false, nil
		}
	} else {
		if req, err := transformDummyTitlepageRequired(epub, opfF, bytes.NewReader(opf.Bytes())); err != nil {
			return "", nil, false, fmt.Errorf("check if dummy titlepage is required: %w", err)
		} else if !req {
			return "", nil, false, nil
		}
	}
	fn, r, err := transformDummyTitlepageAdd(opf, opfF)
	if err != nil {
		return "", nil, true, fmt.Errorf("apply title page fix: %w", err)
	}
	return fn, r, true, nil
}
func ( c * Converter ) TransformDummyTitlepage ( epub fs . FS , opfF string , opf * bytes . Buffer ) ( string , io . Reader , bool , error ) { if c . dummyTitlepageForce { if ! c . dummyTitlepageForceValue { return " " , nil , false , nil } } else { if req , err := transformDummyTitlepageRequired ( epub , opfF , bytes . NewReader ( opf . Bytes ( ) ) ) ; err != nil { return " " , nil , false , fmt . Errorf ( " " , err ) } else if ! req { return " " , nil , false , nil } } fn , r , err := transformDummyTitlepageAdd ( opf , opfF ) if err != nil { return " " , nil , true , fmt . Errorf ( " " , err ) } return fn , r , true , nil }
TransformDummyTitlepage adds a dummy titlepage if forced or the heuristic
determines that is is necessary.
TransformDummyTitlepage adds a dummy titlepage if forced or the heuristic determines that is is necessary .