feat: Add comment range
parent
9f52bdd6e7
commit
e44590468e
|
@ -0,0 +1,39 @@
|
|||
use crate::documents::BuildXML;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CommentRangeEnd<'a> {
|
||||
id: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> CommentRangeEnd<'a> {
|
||||
pub fn new(id: &'a str) -> CommentRangeEnd<'a> {
|
||||
CommentRangeEnd { id }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> BuildXML for CommentRangeEnd<'a> {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.comment_range_end(&self.id).build()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
#[cfg(test)]
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::str;
|
||||
|
||||
#[test]
|
||||
fn test_comment_range_end() {
|
||||
let c = CommentRangeEnd::new("mockid");
|
||||
let b = c.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
r#"<w:commentRangeEnd w:id="mockid" />"#
|
||||
);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
use crate::documents::BuildXML;
|
||||
use crate::xml_builder::*;
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
pub struct CommentRangeStart<'a> {
|
||||
id: &'a str,
|
||||
}
|
||||
|
||||
impl<'a> CommentRangeStart<'a> {
|
||||
pub fn new(id: &'a str) -> CommentRangeStart<'a> {
|
||||
CommentRangeStart { id }
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> BuildXML for CommentRangeStart<'a> {
|
||||
fn build(&self) -> Vec<u8> {
|
||||
let b = XMLBuilder::new();
|
||||
b.comment_range_start(&self.id).build()
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
|
||||
use super::*;
|
||||
#[cfg(test)]
|
||||
use pretty_assertions::assert_eq;
|
||||
use std::str;
|
||||
|
||||
#[test]
|
||||
fn test_comment_range_start() {
|
||||
let c = CommentRangeStart::new("mockid");
|
||||
let b = c.build();
|
||||
assert_eq!(
|
||||
str::from_utf8(&b).unwrap(),
|
||||
r#"<w:commentRangeStart w:id="mockid" />"#
|
||||
);
|
||||
}
|
||||
}
|
|
@ -5,6 +5,8 @@ mod bookmark_end;
|
|||
mod bookmark_start;
|
||||
mod br;
|
||||
mod color;
|
||||
mod comment_range_end;
|
||||
mod comment_range_start;
|
||||
mod default_tab_stop;
|
||||
mod delete;
|
||||
mod delete_text;
|
||||
|
@ -55,6 +57,8 @@ pub use bookmark_end::*;
|
|||
pub use bookmark_start::*;
|
||||
pub use br::*;
|
||||
pub use color::*;
|
||||
pub use comment_range_end::*;
|
||||
pub use comment_range_start::*;
|
||||
pub use default_tab_stop::*;
|
||||
pub use delete::*;
|
||||
pub use delete_text::*;
|
||||
|
|
|
@ -170,6 +170,9 @@ impl XMLBuilder {
|
|||
|
||||
closed_el!(bookmark_start, "w:bookmarkStart", "w:id", "w:name");
|
||||
closed_el!(bookmark_end, "w:bookmarkEnd", "w:id");
|
||||
|
||||
closed_el!(comment_range_start, "w:commentRangeStart", "w:id");
|
||||
closed_el!(comment_range_end, "w:commentRangeEnd", "w:id");
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Override PartName="/_rels/.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/><Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/><Override PartName="/word/settings.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.settings+xml"/><Override PartName="/word/fontTable.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.fontTable+xml"/><Override PartName="/word/_rels/document.xml.rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Override PartName="/word/comments.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.comments+xml"/><Override PartName="/word/document.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml"/><Override PartName="/word/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.wordprocessingml.styles+xml"/>
|
||||
</Types>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="word/document.xml"/>
|
||||
</Relationships>
|
Binary file not shown.
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties" xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"><Template></Template><TotalTime>1</TotalTime><Application>LibreOffice/6.0.7.3$Linux_X86_64 LibreOffice_project/00m0$Build-3</Application><Pages>1</Pages><Words>5</Words><Characters>28</Characters><CharactersWithSpaces>33</CharactersWithSpaces><Paragraphs>1</Paragraphs></Properties>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<cp:coreProperties xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:dcterms="http://purl.org/dc/terms/" xmlns:dcmitype="http://purl.org/dc/dcmitype/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><dcterms:created xsi:type="dcterms:W3CDTF">2019-12-04T16:57:40Z</dcterms:created><dc:creator></dc:creator><dc:description></dc:description><dc:language>ja-JP</dc:language><cp:lastModifiedBy></cp:lastModifiedBy><dcterms:modified xsi:type="dcterms:W3CDTF">2019-12-04T16:58:51Z</dcterms:modified><cp:revision>1</cp:revision><dc:subject></dc:subject><dc:title></dc:title></cp:coreProperties>
|
|
@ -0,0 +1,3 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/><Relationship Id="rId2" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="comments.xml"/><Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/fontTable" Target="fontTable.xml"/><Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/settings" Target="settings.xml"/>
|
||||
</Relationships>
|
|
@ -0,0 +1,46 @@
|
|||
<?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">
|
||||
<w:comment w:id="0" w:author="不明な作成者" w:date="2019-12-04T16:58:11Z" w:initials="">
|
||||
<w:p>
|
||||
<w:r>
|
||||
<w:rPr>
|
||||
<w:rFonts w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari" w:ascii="Liberation Serif" w:hAnsi="Liberation Serif"/>
|
||||
<w:b w:val="false"/>
|
||||
<w:bCs w:val="false"/>
|
||||
<w:i w:val="false"/>
|
||||
<w:iCs w:val="false"/>
|
||||
<w:caps w:val="false"/>
|
||||
<w:smallCaps w:val="false"/>
|
||||
<w:strike w:val="false"/>
|
||||
<w:dstrike w:val="false"/>
|
||||
<w:outline w:val="false"/>
|
||||
<w:shadow w:val="false"/>
|
||||
<w:emboss w:val="false"/>
|
||||
<w:imprint w:val="false"/>
|
||||
<w:color w:val="auto"/>
|
||||
<w:spacing w:val="0"/>
|
||||
<w:w w:val="100"/>
|
||||
<w:kern w:val="2"/>
|
||||
<w:position w:val="0"/>
|
||||
<w:sz w:val="20"/>
|
||||
<w:szCs w:val="24"/>
|
||||
<w:u w:val="none"/>
|
||||
<w:vertAlign w:val="baseline"/>
|
||||
<w:em w:val="none"/>
|
||||
<w:lang w:bidi="hi-IN" w:eastAsia="ja-JP" w:val="en-US"/>
|
||||
</w:rPr>
|
||||
<w:t>Hello world!!</w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
</w:comment>
|
||||
</w:comments>
|
|
@ -0,0 +1,49 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:document 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">
|
||||
<w:body>
|
||||
<w:p>
|
||||
<w:pPr>
|
||||
<w:pStyle w:val="Normal"/>
|
||||
<w:rPr></w:rPr>
|
||||
</w:pPr>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
<w:t xml:space="preserve">Comment is </w:t>
|
||||
</w:r>
|
||||
<w:commentRangeStart w:id="0"/>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
<w:t>here</w:t>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
</w:r>
|
||||
<w:commentRangeEnd w:id="0"/>
|
||||
<w:r>
|
||||
<w:commentReference w:id="0"/>
|
||||
</w:r>
|
||||
<w:r>
|
||||
<w:rPr></w:rPr>
|
||||
<w:t xml:space="preserve">. Comment Example </w:t>
|
||||
</w:r>
|
||||
</w:p>
|
||||
<w:sectPr>
|
||||
<w:type w:val="nextPage"/>
|
||||
<w:pgSz w:w="11906" w:h="16838"/>
|
||||
<w:pgMar w:left="1134" w:right="1134" w:header="0" w:top="1134" w:footer="0" w:bottom="1134" w:gutter="0"/>
|
||||
<w:pgNumType w:fmt="decimal"/>
|
||||
<w:formProt w:val="false"/>
|
||||
<w:textDirection w:val="lrTb"/>
|
||||
</w:sectPr>
|
||||
</w:body>
|
||||
</w:document>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:fonts xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><w:font w:name="Times New Roman"><w:charset w:val="00"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Symbol"><w:charset w:val="02"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:charset w:val="00"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Serif"><w:altName w:val="Times New Roman"/><w:charset w:val="01"/><w:family w:val="roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Liberation Sans"><w:altName w:val="Arial"/><w:charset w:val="01"/><w:family w:val="swiss"/><w:pitch w:val="variable"/></w:font></w:fonts>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:settings xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main"><w:zoom w:percent="100"/><w:defaultTabStop w:val="709"/><w:compat><w:doNotExpandShiftReturn/></w:compat></w:settings>
|
|
@ -0,0 +1,2 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<w:styles xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="w14"><w:docDefaults><w:rPrDefault><w:rPr><w:rFonts w:ascii="Liberation Serif" w:hAnsi="Liberation Serif" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:kern w:val="2"/><w:sz w:val="24"/><w:szCs w:val="24"/><w:lang w:val="en-US" w:eastAsia="ja-JP" w:bidi="hi-IN"/></w:rPr></w:rPrDefault><w:pPrDefault><w:pPr><w:widowControl/></w:pPr></w:pPrDefault></w:docDefaults><w:style w:type="paragraph" w:styleId="Normal"><w:name w:val="Normal"/><w:qFormat/><w:pPr><w:widowControl/></w:pPr><w:rPr><w:rFonts w:ascii="Liberation Serif" w:hAnsi="Liberation Serif" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:color w:val="auto"/><w:kern w:val="2"/><w:sz w:val="24"/><w:szCs w:val="24"/><w:lang w:val="en-US" w:eastAsia="ja-JP" w:bidi="hi-IN"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style14"><w:name w:val="見出し"/><w:basedOn w:val="Normal"/><w:next w:val="Style15"/><w:qFormat/><w:pPr><w:keepNext w:val="true"/><w:spacing w:before="240" w:after="120"/></w:pPr><w:rPr><w:rFonts w:ascii="Liberation Sans" w:hAnsi="Liberation Sans" w:eastAsia="Noto Sans CJK JP" w:cs="Lohit Devanagari"/><w:sz w:val="28"/><w:szCs w:val="28"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style15"><w:name w:val="Body Text"/><w:basedOn w:val="Normal"/><w:pPr><w:spacing w:lineRule="auto" w:line="276" w:before="0" w:after="140"/></w:pPr><w:rPr></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style16"><w:name w:val="List"/><w:basedOn w:val="Style15"/><w:pPr></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style17"><w:name w:val="Caption"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:suppressLineNumbers/><w:spacing w:before="120" w:after="120"/></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/><w:i/><w:iCs/><w:sz w:val="24"/><w:szCs w:val="24"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="Style18"><w:name w:val="索引"/><w:basedOn w:val="Normal"/><w:qFormat/><w:pPr><w:suppressLineNumbers/></w:pPr><w:rPr><w:rFonts w:cs="Lohit Devanagari"/></w:rPr></w:style></w:styles>
|
Loading…
Reference in New Issue