Crate djoc

source ·
Expand description

djoc is a library for generating documents in various formats.

To use djoc in your project, add this to your Cargo.toml file:

[dependencies]
djoc = "0.1.0"

Example

use djoc::{Builder, Document, DocumentType};

let mut document = Document::from("This is some text");
document
   .title("My Document")
   .document_type(DocumentType::Report)
   .author("John Doe".into());

let mut builder = Builder::default();
let mut bytes = Vec::new();
builder.write_latex(&mut document, &mut bytes).unwrap();

let latex = String::from_utf8(bytes).unwrap();

assert!(latex.contains(r"\documentclass{report}"));
assert!(latex.contains("My Document"));
assert!(latex.contains("John Doe"));
assert!(latex.contains("This is some text"));

Modules

  • HTML output functionality for djoc.
  • Contains the types and functions for parsing and executing a manifest file.
  • PDF output functionality for djoc.

Structs

  • Represents an author of a document.
  • Struct responsible for building a document.
  • A naïve (no timezone) datetime for use in a document.
  • In-memory representation of a document.
  • Represents a complete manifest file.

Enums

  • Enumerates the types of documents that can be generated.