49 lines
1.6 KiB
Rust
49 lines
1.6 KiB
Rust
|
use super::{Paragraph, Table};
|
||
|
use crate::documents::BuildXML;
|
||
|
use crate::xml_builder::*;
|
||
|
|
||
|
#[derive(Debug)]
|
||
|
pub struct Comments {}
|
||
|
|
||
|
impl Comments {
|
||
|
pub fn new() -> Comments {
|
||
|
Default::default()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl Default for Comments {
|
||
|
fn default() -> Self {
|
||
|
Self {}
|
||
|
}
|
||
|
}
|
||
|
|
||
|
impl BuildXML for Comments {
|
||
|
fn build(&self) -> Vec<u8> {
|
||
|
XMLBuilder::new()
|
||
|
.declaration(Some(true))
|
||
|
.open_comments()
|
||
|
.close()
|
||
|
.build()
|
||
|
}
|
||
|
}
|
||
|
|
||
|
#[cfg(test)]
|
||
|
mod tests {
|
||
|
|
||
|
use super::super::Run;
|
||
|
use super::*;
|
||
|
#[cfg(test)]
|
||
|
use pretty_assertions::assert_eq;
|
||
|
use std::str;
|
||
|
|
||
|
#[test]
|
||
|
fn test_comments() {
|
||
|
let b = Comments::new().build();
|
||
|
assert_eq!(
|
||
|
str::from_utf8(&b).unwrap(),
|
||
|
r#"<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||
|
<w:comments xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" mc:Ignorable="w14 wp14" />"#
|
||
|
);
|
||
|
}
|
||
|
}
|