2016-12-31 16:07:59 +08:00
|
|
|
@startuml
|
|
|
|
|
|
|
|
namespace book {
|
|
|
|
|
|
|
|
class MDBook {
|
|
|
|
project_root: PathBuf,
|
|
|
|
template_dir: PathBuf,
|
2017-01-14 01:14:26 +08:00
|
|
|
src_base: PathBuf,
|
2016-12-31 16:07:59 +08:00
|
|
|
dest_base: PathBuf,
|
|
|
|
render_intent: RenderIntent,
|
|
|
|
|
|
|
|
translations: HashMap<String, Book>,
|
|
|
|
|
|
|
|
indent_spaces: i32,
|
2017-01-14 01:14:26 +08:00
|
|
|
pub livereload_script: Option<String>,
|
2016-12-31 16:07:59 +08:00
|
|
|
|
|
|
|
new(project_root)
|
|
|
|
}
|
|
|
|
|
|
|
|
class book::Book {
|
|
|
|
config: BookConfig,
|
|
|
|
toc: Vec<TocItem>,
|
|
|
|
|
|
|
|
new(project_root)
|
|
|
|
}
|
|
|
|
|
|
|
|
class book::Chapter {
|
2017-01-14 01:14:26 +08:00
|
|
|
pub title: String,
|
|
|
|
pub content: Option<String>,
|
|
|
|
|
|
|
|
src_path: Option<PathBuf>,
|
2016-12-31 16:07:59 +08:00
|
|
|
dest_path: Option<PathBuf>,
|
|
|
|
|
2017-01-14 01:14:26 +08:00
|
|
|
pub translation_links: Option<Vec<TranslationLink>>,
|
2017-01-22 02:18:40 +08:00
|
|
|
pub translation_id: Option<String>,
|
2017-01-14 01:14:26 +08:00
|
|
|
pub authors: Option<Vec<Author>>,
|
|
|
|
pub translators: Option<Vec<Author>>,
|
|
|
|
pub description: Option<String>,
|
|
|
|
pub css_class: Option<String>,
|
|
|
|
|
|
|
|
new(title, src_path)
|
2016-12-31 16:07:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace book::bookconfig {
|
|
|
|
|
|
|
|
class BookConfig {
|
2017-01-14 01:14:26 +08:00
|
|
|
pub dest: PathBuf,
|
|
|
|
pub src: PathBuf,
|
|
|
|
|
|
|
|
pub title: String,
|
|
|
|
pub subtitle: Option<String>,
|
|
|
|
pub description: Option<String>,
|
|
|
|
pub language: Language,
|
|
|
|
pub authors: Vec<Author>,
|
|
|
|
pub translators: Option<Vec<Author>>,
|
|
|
|
pub publisher: Option<Publisher>,
|
|
|
|
pub number_format: NumberFormat,
|
|
|
|
pub section_names: Vec<String>,
|
|
|
|
pub is_main_book: bool,
|
|
|
|
pub is_multilang: bool,
|
2016-12-31 16:07:59 +08:00
|
|
|
|
|
|
|
new(project_root)
|
|
|
|
}
|
|
|
|
|
|
|
|
class Author {
|
|
|
|
name: String,
|
|
|
|
file_as: String,
|
|
|
|
email: Option<String>,
|
|
|
|
|
|
|
|
new(name)
|
|
|
|
}
|
|
|
|
|
|
|
|
class Language {
|
2017-01-22 02:18:40 +08:00
|
|
|
pub code: String,
|
|
|
|
pub name: Option<String>,
|
2016-12-31 16:07:59 +08:00
|
|
|
|
2017-01-22 02:18:40 +08:00
|
|
|
new(code)
|
2016-12-31 16:07:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
class Publisher {
|
|
|
|
name: String,
|
|
|
|
url: Option<String>,
|
|
|
|
logo_src: Option<PathBuf>,
|
|
|
|
|
|
|
|
new(name)
|
|
|
|
}
|
|
|
|
|
|
|
|
enum NumberFormat {
|
|
|
|
Arabic
|
|
|
|
Roman
|
|
|
|
Word
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace book::toc {
|
|
|
|
|
|
|
|
class TocContent {
|
2017-01-14 01:14:26 +08:00
|
|
|
pub chapter: Chapter,
|
|
|
|
pub sub_items: Option<Vec<TocItem>>,
|
|
|
|
pub section: Option<Vec<i32>>,
|
2016-12-31 16:07:59 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
enum TocItem {
|
|
|
|
Numbered "TocContent",
|
|
|
|
Unnumbered "TocContent",
|
|
|
|
Unlisted "TocContent",
|
|
|
|
Spacer,
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
class Renderer {
|
2017-01-22 02:18:40 +08:00
|
|
|
build(&self, project_root: &PathBuf, dest_base: &Option<PathBuf>),
|
2016-12-31 16:07:59 +08:00
|
|
|
render(&self, book_project: &MDBook),
|
|
|
|
}
|
|
|
|
|
|
|
|
@enduml
|