fix cargo
Some checks failed
Deploy ailog / build-and-deploy (push) Failing after 14m42s

This commit is contained in:
2025-06-11 18:27:58 +09:00
parent ad45b151b1
commit eb5aa0a2be
23 changed files with 214 additions and 70 deletions

View File

@ -3,7 +3,7 @@ use regex::Regex;
use super::MarkdownSection;
pub struct MarkdownParser {
code_block_regex: Regex,
_code_block_regex: Regex,
header_regex: Regex,
link_regex: Regex,
image_regex: Regex,
@ -15,7 +15,7 @@ pub struct MarkdownParser {
impl MarkdownParser {
pub fn new() -> Self {
Self {
code_block_regex: Regex::new(r"```([a-zA-Z0-9]*)\n([\s\S]*?)\n```").unwrap(),
_code_block_regex: Regex::new(r"```([a-zA-Z0-9]*)\n([\s\S]*?)\n```").unwrap(),
header_regex: Regex::new(r"^(#{1,6})\s+(.+)$").unwrap(),
link_regex: Regex::new(r"\[([^\]]+)\]\(([^)]+)\)").unwrap(),
image_regex: Regex::new(r"!\[([^\]]*)\]\(([^)]+)\)").unwrap(),

View File

@ -41,11 +41,13 @@ pub enum MarkdownSection {
}
pub trait Translator {
#[allow(dead_code)]
async fn translate(&self, content: &str, config: &TranslationConfig) -> Result<String>;
async fn translate_markdown(&self, content: &str, config: &TranslationConfig) -> Result<String>;
async fn translate_sections(&self, sections: Vec<MarkdownSection>, config: &TranslationConfig) -> Result<Vec<MarkdownSection>>;
}
#[allow(dead_code)]
pub struct TranslationResult {
pub original: String,
pub translated: String,
@ -56,6 +58,7 @@ pub struct TranslationResult {
}
#[derive(Debug, Clone, Default)]
#[allow(dead_code)]
pub struct TranslationMetrics {
pub character_count: usize,
pub word_count: usize,
@ -117,6 +120,7 @@ impl LanguageMapping {
self.mappings.get(code)
}
#[allow(dead_code)]
pub fn get_supported_languages(&self) -> Vec<String> {
self.mappings.keys().cloned().collect()
}

View File

@ -155,7 +155,7 @@ impl Translator for OllamaTranslator {
println!(" 🔤 Processing section {}", index + 1);
let translated_section = match &section {
MarkdownSection::Code(content, lang) => {
MarkdownSection::Code(_content, _lang) => {
if config.preserve_code {
println!(" ⏭️ Preserving code block");
section // Preserve code blocks
@ -174,7 +174,7 @@ impl Translator for OllamaTranslator {
MarkdownSection::Link(translated_text.trim().to_string(), url.clone())
}
}
MarkdownSection::Image(alt, url) => {
MarkdownSection::Image(_alt, _url) => {
println!(" 🖼️ Preserving image");
section // Preserve images
}