pub struct Section {
pub index: usize,
pub idref: String,
pub href: String,
pub full_path: String,
pub raw_html: String,
pub processed_html: String,
pub plain_text: String,
pub plain_text_lower: String,
pub char_count: usize,
pub viewport_width: Option<f64>,
pub viewport_height: Option<f64>,
}Expand description
Loaded and processed EPUB section ready for reading.
Fields§
§index: usize§idref: String§href: String§full_path: String§raw_html: String§processed_html: String§plain_text: String§plain_text_lower: String§char_count: usize§viewport_width: Option<f64>§viewport_height: Option<f64>Implementations§
Source§impl Section
impl Section
Sourcepub fn new(
index: usize,
idref: String,
href: String,
full_path: String,
archive: &EpubArchive,
) -> Result<Self, String>
pub fn new( index: usize, idref: String, href: String, full_path: String, archive: &EpubArchive, ) -> Result<Self, String>
Create and process a section from archive content using default Base64 inlining.
Sourcepub fn new_with_strategy(
index: usize,
idref: String,
href: String,
full_path: String,
archive: &EpubArchive,
_strategy: &AssetDeliveryStrategy,
) -> Result<Self, String>
pub fn new_with_strategy( index: usize, idref: String, href: String, full_path: String, archive: &EpubArchive, _strategy: &AssetDeliveryStrategy, ) -> Result<Self, String>
Create and process a section using a specific asset delivery strategy (Base64 vs Resource Stream).
Sourcepub fn detect_language(&self) -> Option<String>
pub fn detect_language(&self) -> Option<String>
Detects the primary language of this section’s plain text content using whatlang.
Sourcepub fn tokenize_tts_words(&self) -> Vec<TtsWordToken>
pub fn tokenize_tts_words(&self) -> Vec<TtsWordToken>
Tokenizes plain text into word tokens with exact character start/end offsets for SpeechSynthesis TTS synchronization.
Sourcepub fn to_tts_annotated_html(&self) -> String
pub fn to_tts_annotated_html(&self) -> String
Wraps plain text words in the processed HTML with <span id="tts-w-{index}" class="tts-word"> for live SpeechSynthesis word-by-word visual highlighting.
Sourcepub fn strip_script_content(&mut self)
pub fn strip_script_content(&mut self)
Strip embedded