Extends
Methods
(static) isChapter() → {boolean}
- Source:
Returns if this document is a chapter or not.
The epub cover is never a chapter, so this will always return false.
Returns:
Returns true if this document is a chapter
- Type
- boolean
addItem(item)
- Source:
- Overrides:
Adds an EpubItem to this document. It will create additional links according to the item type.
Parameters:
Name | Type | Description |
---|---|---|
item |
EpubItem | The EpubItem to add to this document |
addLink(link)
- Source:
- Overrides:
Adds an additional link to the document. Links will be embedded only inside of this document.
NOTE: This link has an undefined structure and is not the same as the Link object in src/epub/Link.js
Example
Example usage of addLink.
addLink({href='styles.css', rel='stylesheet', type='text/css'})
Parameters:
Name | Type | Description |
---|---|---|
link |
object | The link to add to the document |
getBodyContent() → {string}
- Source:
- Overrides:
Gets the content of the Body element for this HTML document. Content will be of type string
Returns:
The body content of this document
- Type
- string
getContent() → {string}
- Source:
- Overrides:
Gets content for the cover page as a string.
Returns:
The HTML content of this document
- Type
- string
getLanguage() → {string}
- Source:
- Overrides:
Gets the language code for this book item. The language of the book item can be different from the
language settings defined globally for the book.
Returns:
The language code for this book item
- Type
- string
getLinks() → {Array.<object>}
- Source:
- Overrides:
Returns the array of additional links defined for this document.
NOTE: These links have an undefined structure and is not the same as the Link object in src/epub/Link.js
Returns:
An array of links
- Type
- Array.<object>
getLinksOfType(linkType) → {Array.<object>}
- Source:
- Overrides:
Returns an array of additional links defined for this document of the given type.
NOTE: These links have an undefined structure and is not the same as the Link object in src/epub/Link.js
Parameters:
Name | Type | Description |
---|---|---|
linkType |
string | The type of the links to search for (e.g. 'text/javascript') |
Returns:
An array of links
- Type
- Array.<object>
getType() → {ItemTypeEnum}
- Source:
- Overrides:
Guesses type according to the file extension. Might not be the best way to do it, but it works for now.
We map the type by finding the file extension in ItemTypeFileExtensionMap
Returns:
The type of the item
- Type
- ItemTypeEnum
setLanguage(lang)
- Source:
- Overrides:
Sets the language for this book item. By default it will user the language of the book, but
it can still be overwritten with this method.
Parameters:
Name | Type | Description |
---|---|---|
lang |
string | The new language code for this book item |