You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-08-10 22:11:50 +02:00
This commit is contained in:
Binary file not shown.
@@ -245,4 +245,18 @@ describe('InteropService_Importer_OneNote', () => {
|
||||
}
|
||||
BaseModel.setIdGenerator(originalIdGenerator);
|
||||
});
|
||||
|
||||
skipIfNotCI('should use default value for EntityGuid and InkBias if not found', async () => {
|
||||
let idx = 0;
|
||||
const originalIdGenerator = BaseModel.setIdGenerator(() => String(idx++));
|
||||
const notes = await importNote(`${supportDir}/onenote/ink_bias_and_entity_guid.zip`);
|
||||
|
||||
// InkBias bug
|
||||
expect(notes.find(n => n.title === 'Marketing Funnel & Training').body).toMatchSnapshot();
|
||||
|
||||
// EntityGuid
|
||||
expect(notes.find(n => n.title === 'Decrease support costs').body).toMatchSnapshot();
|
||||
|
||||
BaseModel.setIdGenerator(originalIdGenerator);
|
||||
});
|
||||
});
|
||||
|
@@ -1446,3 +1446,95 @@ exports[`InteropService_Importer_OneNote should render links properly by ignorin
|
||||
</body>
|
||||
</html>"
|
||||
`;
|
||||
|
||||
exports[`InteropService_Importer_OneNote should use default value for EntityGuid and InkBias if not found 1`] = `
|
||||
"<html xmlns="http://www.w3.org/1999/xhtml"><head>
|
||||
<meta charset="UTF-8" />
|
||||
<title>Marketing Funnel & Training</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; font-weight: normal; }
|
||||
table, tr, td { border-color: #A3A3A3; }
|
||||
ul, ol { padding: 0; }
|
||||
.title .outline-element { display: inline; }
|
||||
.title .outline-element:nth-child(2) { margin-left: 10px !important; }
|
||||
.container-outline { font-family: Calibri, sans-serif; font-size: 6pt; }
|
||||
.ink-text, .ink-space { display: inline-block; position: relative; vertical-align: bottom; }
|
||||
.ink-text { top: 0; left: 0; }
|
||||
.note-tag-icon { position: relative; }
|
||||
.note-tag-icon > svg { position: absolute; }
|
||||
.icon-secondary > svg { position: absolute; fill: black; filter: drop-shadow(0 0 2px white); height: 12px; top: -1px; }
|
||||
.icon-secondary > .content { position: absolute; color: black; filter: drop-shadow(0 0 2px white); font-size: 10px; color: black; top: -1px; user-select: none; }
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="title" style="left: 48px; position: absolute; top: 24px;"><div class="container-outline"><div class="outline-element" style="margin-left: 0px;"><span style="font-family: Trebuchet MS; font-size: 20pt; line-height: 32px;">Marketing Funnel & Training</span></div>
|
||||
</div><div class="container-outline"><div class="outline-element" style="margin-left: 0px;"><span style="color: rgb(128,128,128); font-family: Calibri; font-size: 10pt; line-height: 16px;">Tuesday, October 06, 2015</span></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><span style="color: rgb(128,128,128); font-family: Calibri; font-size: 10pt; line-height: 16px;">12:27 PM</span></div>
|
||||
</div></div><div class="container-outline" style="left: 48px; position: absolute; top: 115px; width: 624px;"><div class="outline-element" style="margin-left: 0px;"><img src=":/139" /></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Trebuchet MS; font-size: 12pt; line-height: 19px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><cite style="color: rgb(89,89,89); font-family: Calibri; font-size: 9pt; line-height: 14px;">From <<a href="http://adamhcohen.com/wp-content/uploads/New-Marketing-Funnel1.JPG" style="">http://adamhcohen.com/wp-content/uploads/New-Marketing-Funnel1.JPG</a>> </cite></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Trebuchet MS; font-size: 12pt; line-height: 19px;"> </p></div>
|
||||
</div><div class="container-outline" style="left: 72px; position: absolute; top: 475px; width: 146px;"><div class="outline-element" style="margin-left: 0px;"><p style="color: rgb(91,155,213); font-family: Trebuchet MS; font-size: 12pt; line-height: 19px;">Customer Success Management</p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="color: rgb(91,155,213); font-family: Trebuchet MS; font-size: 12pt; line-height: 19px;">and</p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="color: rgb(91,155,213); font-family: Trebuchet MS; font-size: 12pt; line-height: 19px;">Training</p></div>
|
||||
</div><img style="height: 170px; left: 57px; overflow: visible; position: absolute; top: 435px; width: 310px;" src=":/140" />
|
||||
|
||||
<script>
|
||||
if (window.parent !== null) {
|
||||
window.parent.postMessage(window.location.href, '*');
|
||||
}
|
||||
</script>
|
||||
|
||||
</body></html>"
|
||||
`;
|
||||
|
||||
exports[`InteropService_Importer_OneNote should use default value for EntityGuid and InkBias if not found 2`] = `
|
||||
"<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Decrease support costs</title>
|
||||
<style>
|
||||
* { margin: 0; padding: 0; font-weight: normal; }
|
||||
table, tr, td { border-color: #A3A3A3; }
|
||||
ul, ol { padding: 0; }
|
||||
.title .outline-element { display: inline; }
|
||||
.title .outline-element:nth-child(2) { margin-left: 10px !important; }
|
||||
.container-outline { font-family: Calibri, sans-serif; font-size: 6pt; }
|
||||
.ink-text, .ink-space { display: inline-block; position: relative; vertical-align: bottom; }
|
||||
.ink-text { top: 0; left: 0; }
|
||||
.note-tag-icon { position: relative; }
|
||||
.note-tag-icon > svg { position: absolute; }
|
||||
.icon-secondary > svg { position: absolute; fill: black; filter: drop-shadow(0 0 2px white); height: 12px; top: -1px; }
|
||||
.icon-secondary > .content { position: absolute; color: black; filter: drop-shadow(0 0 2px white); font-size: 10px; color: black; top: -1px; user-select: none; }
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="title" style="left: 48px; position: absolute; top: 24px;"><div class="container-outline"><div class="outline-element" style="margin-left: 0px;"><span style="font-family: Calibri Light; font-size: 20pt; line-height: 32px;">Decrease support costs</span></div>
|
||||
</div><div class="container-outline"><div class="outline-element" style="margin-left: 0px;"><span style="color: rgb(128,128,128); font-family: Calibri; font-size: 10pt; line-height: 16px;">Saturday, October 10, 2015</span></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><span style="color: rgb(128,128,128); font-family: Calibri; font-size: 10pt; line-height: 16px;">11:15 PM</span></div>
|
||||
</div></div><div class="container-outline" style="left: 48px; position: absolute; top: 88px; width: 624px;"><div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;">One of the strategic goals of training <span style="font-style: italic; font-weight: bold;">must</span> be to decrease the cost of customer support. To do this training must teach customers to "<span style="font-weight: bold;">do</span>" not to "know." How many customers call asking to know something?</p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
<div class="outline-element" style="margin-left: 0px;"><p style="font-family: Calibri; font-size: 11pt; line-height: 17px;"> </p></div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
if (window.parent !== null) {
|
||||
window.parent.postMessage(window.location.href, '*');
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>"
|
||||
`;
|
||||
|
@@ -69,9 +69,7 @@ impl<'a> Renderer<'a> {
|
||||
}
|
||||
|
||||
let path = PathBuf::from(filename);
|
||||
let ext = path
|
||||
.extension()
|
||||
.unwrap_or_default();
|
||||
let ext = path.extension().unwrap_or_default();
|
||||
let base = path
|
||||
.as_os_str()
|
||||
.to_str()
|
||||
|
@@ -40,17 +40,15 @@ pub(crate) fn parse(object: &Object) -> Result<Data> {
|
||||
.unwrap();
|
||||
let bias = simple::parse_u8(PropertyType::InkBias, object)?
|
||||
.map(|bias| match bias {
|
||||
0 => Ok(InkBias::Handwriting),
|
||||
1 => Ok(InkBias::Drawing),
|
||||
2 => Ok(InkBias::Both),
|
||||
i => Err(ErrorKind::MalformedOneNoteFileData(
|
||||
format!("invalid ink bias value: {}", i).into(),
|
||||
)),
|
||||
0 => InkBias::Handwriting,
|
||||
1 => InkBias::Drawing,
|
||||
2 => InkBias::Both,
|
||||
_i => InkBias::Both,
|
||||
})
|
||||
.transpose()?
|
||||
.ok_or_else(|| {
|
||||
ErrorKind::MalformedOneNoteFileData("ink stroke node has no ink bias".into())
|
||||
})?;
|
||||
.unwrap_or_else(|| {
|
||||
log_warn!("No InkBias was set. Using default value 'Both'");
|
||||
return InkBias::Both;
|
||||
});
|
||||
let language_code = simple::parse_u32(PropertyType::LanguageId, object)?;
|
||||
let properties = ObjectReference::parse(PropertyType::InkStrokeProperties, object)?
|
||||
.ok_or_else(|| {
|
||||
|
@@ -1,3 +1,4 @@
|
||||
use crate::log_warn;
|
||||
use crate::parser::errors::{ErrorKind, Result};
|
||||
use crate::parser::fsshttpb::data::cell_id::CellId;
|
||||
use crate::parser::fsshttpb::data::exguid::ExGuid;
|
||||
@@ -32,7 +33,10 @@ pub(crate) fn parse(object: &Object) -> Result<Data> {
|
||||
}
|
||||
|
||||
let entity_guid = simple::parse_guid(PropertyType::NotebookManagementEntityGuid, object)?
|
||||
.ok_or_else(|| ErrorKind::MalformedOneNoteFileData("page series has no guid".into()))?;
|
||||
.unwrap_or_else(|| {
|
||||
log_warn!("page series has no guid");
|
||||
return Guid::nil();
|
||||
});
|
||||
let page_spaces =
|
||||
ObjectSpaceReference::parse_vec(PropertyType::ChildGraphSpaceElementNodes, object)?
|
||||
.unwrap_or_default();
|
||||
|
Reference in New Issue
Block a user