1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/*!
Write a document as HTML. This includes a small number of additional CSS and JavaScript assets
to support math formatting and code syntax highlighting.
# Example
```rust
# use somedoc::model::Document;
use somedoc::write::{OutputFormat, write_document_to_string};
# fn make_some_document() -> Document { Document::default() }
let doc = make_some_document();
let doc_str = write_document_to_string(&doc, OutputFormat::Json).unwrap();
println!("{}", doc_str);
```
*/
use crateDocument;
use crateWriter;
use RefCell;
use Write;
// ------------------------------------------------------------------------------------------------
// Public Types
// ------------------------------------------------------------------------------------------------
///
/// Implementation of the HTML writer structure, usually this is accessed via the `writer`
/// function, but may be used directly.
///
/// # Example
///
/// ```rust
/// # use somedoc::model::Document;
/// use somedoc::write::json::JsonWriter;
/// use somedoc::write::{write_document_to_string, Writer};
/// use somedoc::model::visitor::walk_document;
///
/// # fn make_some_document() -> Document { Document::default() }
/// let doc = make_some_document();
/// let mut out = std::io::stdout();
/// let writer = JsonWriter::new(&mut out);
/// assert!(writer.write_document(&doc).is_ok());
/// ```
///
// ------------------------------------------------------------------------------------------------
// Public Functions
// ------------------------------------------------------------------------------------------------
///
/// Implementation of the writer function for JSON.
///
/// While this can be called directly it is most often used by calling either
/// [`model::write_document`](../fn.write_document.html) or
/// [`model::write_document_to_string`](../fn.write_document_to_string.html).
///
// ------------------------------------------------------------------------------------------------
// Implementations
// ------------------------------------------------------------------------------------------------