* Data References ~ Evernote ~ Research Notes
Re: Data References ~ Evernote ~ Research Notes
Mike, thanks for your pointers on the extra <div> </div> tags and more careful formatting of my notes.
I am now at a point where I have an Evernote file (enex) created, visually it appears to be correctly formatted but fails to actually import. As I mentioned earlier there are some issues with Evernote itself at the moment to the point they have released their legacy version 6 alongside the latest version 10.
Now version 6 gives an error message "missing_note_content" but even after a lot of searching I have been unable to establish exactly what causes this error. Version 10 does not give an error message at all, but it creates a new notebook but no note within! This is even more strange as Microsoft OneNote imports the enex file perfectly and creates a correctly formatted page.
So it's with me to try and get to the bottom of the Evernote issue but it may not be quick as Evernote's forums and support are awash with disgruntled users.
If there is any other FH user who also uses Evernote and wants to take a look, let us know.
Thanks.
I am now at a point where I have an Evernote file (enex) created, visually it appears to be correctly formatted but fails to actually import. As I mentioned earlier there are some issues with Evernote itself at the moment to the point they have released their legacy version 6 alongside the latest version 10.
Now version 6 gives an error message "missing_note_content" but even after a lot of searching I have been unable to establish exactly what causes this error. Version 10 does not give an error message at all, but it creates a new notebook but no note within! This is even more strange as Microsoft OneNote imports the enex file perfectly and creates a correctly formatted page.
So it's with me to try and get to the bottom of the Evernote issue but it may not be quick as Evernote's forums and support are awash with disgruntled users.
If there is any other FH user who also uses Evernote and wants to take a look, let us know.
Thanks.
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Data References ~ Evernote ~ Research Notes
So, essentially the plugin works correctly as a prototype but will need refining to cope with whatever Evernote eventually requires plus the other cases we identified such as format codes spanning multiple lines.
In another thread, my Export Gedcom File conversion of rich text FTF has been discussed and needed some correction, which will need to feed into this Evernote plugin and maybe a Knowledge Base plugin code snippet.
In the meantime, Graham, can you attach your latest version of the plugin here for others to take a look.
In another thread, my Export Gedcom File conversion of rich text FTF has been discussed and needed some correction, which will need to feed into this Evernote plugin and maybe a Knowledge Base plugin code snippet.
In the meantime, Graham, can you attach your latest version of the plugin here for others to take a look.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Data References ~ Evernote ~ Research Notes
Here is a prototype version.
Please read the discussion above and be aware that Evernote currently has its own problems whilst they are running two versions. This plugin will only work with version 6.x, 'Evernote Legacy'.
The significant change in this version to previous versions of the plugin is the ability to handle Research Notes (in Rich Text Format) linked to an individual.
Graham
Please read the discussion above and be aware that Evernote currently has its own problems whilst they are running two versions. This plugin will only work with version 6.x, 'Evernote Legacy'.
The significant change in this version to previous versions of the plugin is the ability to handle Research Notes (in Rich Text Format) linked to an individual.
Graham
Re: Data References ~ Evernote ~ Research Notes
Mike,
I am still working on testing what we have so far and trying to understand the quirks of how Evernote handles urls.
One thing I have sorted, I have discovered that of <col> is used in a table Evernote doesn't require <colgropup> to be there but it does expect a closing tag </col> which is not the normal html practice. anyway I have sorted that.
I have also discovered I need to change the <th> to <td> in the tables section. It works, but it is not ideal as it is because it centres and puts the text in bold by default.
Now my grasp of pattern matching is not up to editing this section fully yet, the first line works OK but in the "Alignment" block we need both the opening and closing <th> </th> to change to <td> </td>. Could you advise how it needs to change?
Thanks.
I am still working on testing what we have so far and trying to understand the quirks of how Evernote handles urls.
One thing I have sorted, I have discovered that of <col> is used in a table Evernote doesn't require <colgropup> to be there but it does expect a closing tag </col> which is not the normal html practice. anyway I have sorted that.
I have also discovered I need to change the <th> to <td> in the tables section. It works, but it is not ideal as it is because it centres and puts the text in bold by default.
Now my grasp of pattern matching is not up to editing this section fully yet, the first line works OK but in the "Alignment" block we need both the opening and closing <th> </th> to change to <td> </td>. Could you advise how it needs to change?
Code: Select all
strAny, intAny = strAny:gsub('<row>(.-)</row>\r',function(strRow) return '<tr><td>'..(strRow:gsub('|','</td><td>'))..'</td></tr>' end)
intSum = intSum + intAny
-- Alignment <align="r"> <align="c"> <align="j">
strAny, intAny = strAny:gsub('([^\r])<align="r">(.-)</th>','%1<div style="text-align:right;">%2</div></th>')
intSum = intSum + intAny
strAny, intAny = strAny:gsub('([^\r])<align="c">(.-)</th>','%1<div style="text-align:center;">%2</div></th>')
intSum = intSum + intAny
strAny, intAny = strAny:gsub('([^\r])<align="j">(.-)</th>','%1<div style="text-align:justify;">%2</div></th>')
intSum = intSum + intAny
strAny, intAny = strAny:gsub('<align="r">(.-)\r','<div style="text-align:right;">%1</div>\r')
intSum = intSum + intAny
strAny, intAny = strAny:gsub('<align="c">(.-)\r','<div style="text-align:center;">%1</div>\r')
intSum = intSum + intAny
strAny, intAny = strAny:gsub('<align="j">(.-)\r','<div style="text-align:justify;">%1</div>\r')
intSum = intSum + intAny- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Data References ~ Evernote ~ Research Notes
You are largely correct about the use of <th> & </th> being <td> & </td>
The former should only be used for heading rows or columns so the latter is better.
In that code block just replace </th> with </td> as you did in the first line.
Other changes have arisen as part of Export Gedcom File HTML testing.
Firstly, every <div & </div> should be <span & </span>
The code for Colour and Highlight need to become:
and for Font Size and Style:
The former should only be used for heading rows or columns so the latter is better.
In that code block just replace </th> with </td> as you did in the first line.
Other changes have arisen as part of Export Gedcom File HTML testing.
Firstly, every <div & </div> should be <span & </span>
The code for Colour and Highlight need to become:
Code: Select all
-- Text Colour <clr="FF0000"> <clr="0000FF"> </clr> not in matched pairs
strLine = strLine:gsub('<clr="(.-)">', '</clr><clr="%1">')
strLine, intAny = strLine:gsub('<clr="(.-)">(.-)</clr>', '<span style="color:#%1;">%2</span>')
intSum = intSum + intAny
strLine = strLine:gsub('</clr>', '')
-- Highlight Colour <hl="0000FF"> <hl="FF0000"> </hl> not in matched pairs
strLine = strLine:gsub('<hl="(.-)">', '</hl><hl="%1">')
strLine, intAny = strLine:gsub('<hl="(.-)">(.-)</hl>', '<span style="background-color:#%1;">%2</span>')
intSum = intSum + intAny
strLine = strLine:gsub('</hl>', '')
Code: Select all
-- Font Size <fs="+4"> <fs="-4"> </fs> not in matched pairs and need size adjusting by +10pt
strLine = strLine:gsub('<fs="%+(%d+)">', function(strSize) return '<fs="'..string.format("%d",10+strSize)..'">' end )
strLine = strLine:gsub('<fs="%-(%d+)">', function(strSize) return '<fs="'..string.format("%d",10-strSize)..'">' end )
strLine = strLine:gsub('<fs="(.-)">', '</fs><fs="%1">')
strLine, intAny = strLine:gsub('<fs="(.-)">(.-)</fs>', '<span style="font-size:%1pt;">%2</span>')
intSum = intSum + intAny
strLine = strLine:gsub('</fs>', '')
-- Font Style <font="Calibri","swiss",0> <font="Calibri"> </font> not in matched pairs and need all " string quotes and trailing digits removing
strLine = strLine:gsub('<font=".->', function(strFont) return ( strFont:gsub('"',''):gsub(',+%d->$','>') ) end )
strLine = strLine:gsub('<font=(.-)>', '</font><font=%1>')
strLine, intAny = strLine:gsub('<font=(.-)>(.-)</font>', '<span style="font-family:%1;">%2</span>')
intSum = intSum + intAny
strLine = strLine:gsub('</font>', '')
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Data References ~ Evernote ~ Research Notes
Mike,
I have got back to some testing and trying to find how imports into Evernote fail. Usually when they do fail, Evernote puts its failed version of the enex with an error message in a temporary folder, but not always!
URLs
One of the ones that was puzzling me was things go wrong when the Research Note includes a url. Anyway, I have fixed that one.
needs to be
<th> and <td>
We have touched on this one before. We now have:
In the section that follows which addresses Alignment I am still not clear how to adapt the code to change both the opening and closing <th> </th> to <td> </td> as we are only covering the closing </th>.
Tables
For a successful import I have found that tables don't need <div> and </div> either on each line or across the block.
Now the <div> is put in here at the end of the section.
If I take the <div> </div> out the table works but the other lines that needed <div> all fail!
So as an example I don't want this:
but this:
Could you kindly assist, please?
Graham
I have got back to some testing and trying to find how imports into Evernote fail. Usually when they do fail, Evernote puts its failed version of the enex with an error message in a temporary folder, but not always!
URLs
One of the ones that was puzzling me was things go wrong when the Research Note includes a url. Anyway, I have fixed that one.
Code: Select all
strLine, intAny = strLine:gsub('<web="([^"]+)"?,?"?([^"]-)">','<a href=%1>%2</a>')Code: Select all
strLine, intAny = strLine:gsub('<web="([^"]+)"?,?"?([^"]-)">','<a href="%1">%2</a>')We have touched on this one before. We now have:
Code: Select all
strLine, intAny = strLine:gsub('<row>(.-)</row>$',function(strRow) return '<tr><td>'..(strRow:gsub('|','</td><td>'))..'</td></tr>' ) Code: Select all
-- Alignment <align="r"> <align="c"> <align="j">
strLine, intAny = strLine:gsub('(..-)<align="r">(.-)</th>','%1<div style="text-align:right;">%2</div></th>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('(..-)<align="c">(.-)</th>','%1<div style="text-align:center;">%2</div></th>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('(..-)<align="j">(.-)</th>','%1<div style="text-align:justify;">%2</div></th>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('<align="r">(.-)$','<div style="text-align:right;">%1</div>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('<align="c">(.-)$','<div style="text-align:center;">%1</div>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('<align="j">(.-)$','<div style="text-align:justify;">%1</div>')
intSum = intSum + intAnyFor a successful import I have found that tables don't need <div> and </div> either on each line or across the block.
Now the <div> is put in here at the end of the section.
Code: Select all
table.insert(arrLine,"<div>"..strLine.."</div>")So as an example I don't want this:
Code: Select all
<div>Title: Research <b>Note</b> with urls and table</div>
<div>Type: <u>Tasks</u> </div>
<div>Repository: </div>
<div>Date: </div>
<div>Description: <i>Grave</i> </div>
<div>Status: <s>open</s> </div>
<<div><br/></div>
<div><br/></div>
<div><table><col style="width:786px;"></col><col style="width:171px;"></col><col style="width:126px;"></col></div>
<div><tr><td> Task Description </td><td> Status </td><td> Date Completed </td></tr></div>
<div><tr><td> Record: "Elizabeth MAYES" </td><td> </td><td> </td></tr></div>
<div><tr><td> Wife's grave? </td><td> </td><td> </td></tr></div>
<div><tr><td> </td><td> </td><td> </td></tr></div>
<div><tr><td> </td><td> </td><td> </td></tr></div>
<div><tr><td> </td><td> </td><td> </td></tr></div>
<div><tr><td> </td><td> </td><td> </td></tr></div>
<div></table></div>
<div><br/></div>Code: Select all
div>Title: Research <b>Note</b> with urls and table</div>
<div>Type: <u>Tasks</u> </div>
<div>Repository: </div>
<div>Date: </div>
<div>Description: <i>Grave</i> </div>
<div>Status: <s>open</s> </div>
<<div><br/></div>
<div><br/></div>
<table><col style="width:786px;"></col><col style="width:171px;"></col><col style="width:126px;"></col>
<tr><td> Task Description </td><td> Status </td><td> Date Completed </td></tr>
<tr><td> Record: "Elizabeth MAYES" </td><td> </td><td> </td></tr>
<tr><td> Wife's grave? </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
<tr><td> </td><td> </td><td> </td></tr>
</table>
<div><br/></div>Graham
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Data References ~ Evernote ~ Research Notes
URL
That correction I had also spotted in my plugin.
Alignment
For that only </th> needs changing to </td>
It is just looking for <align="?"> prior to cell end </td> or line end $ there is no <td> involved
BTW: Every div in that section should be span
Tables
In stead of table.insert(arrLine,"<div>"..strLine.."</div>") use this to remove div from table lines:
That correction I had also spotted in my plugin.
Alignment
For that only </th> needs changing to </td>
It is just looking for <align="?"> prior to cell end </td> or line end $ there is no <td> involved
BTW: Every div in that section should be span
Tables
In stead of table.insert(arrLine,"<div>"..strLine.."</div>") use this to remove div from table lines:
Code: Select all
strLine = "<div>"..strLine.."</div>"
strLine = strLine:gsub('^<div><table>(.*)</col></div>$','<table>%1</col>')
strLine = strLine:gsub('^<div><tr>(.*)</tr></div>$','<tr>%1</tr>')
strLine = strLine:gsub('^<div></table></div>$','</table>')
table.insert(arrLine,strLine)
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Data References ~ Evernote ~ Research Notes
Thank you. That all works in my test file now. When I have confirmed a few other scenarios I'll post the updated plugin.
Graham
Graham
Re: Data References ~ Evernote ~ Research Notes
As I suspected, we still have an issue with the Alignment section.
If I, say, set align:right in the table the import fails.
It generates a line:
I thought I could fix this by adding a new line to the section in your previous reply
but that generates a line that fails:
because the </span> is at the end of the line.
If I manually reposition </span> to this:
It imports without error but the align:right is ignored in the resulting note!
Graham
If I, say, set align:right in the table the import fails.
It generates a line:
Code: Select all
<div><tr><td> Task Description </td><td> <span style="text-align:right;">Status </td><td> Date Completed </td></tr></span></div>Code: Select all
strLine = strLine:gsub('^<div><tr>(.*)</span></div>$','<tr>%1</span>')Code: Select all
<tr><td> Task Description </td><td> <span style="text-align:right;">Status </td><td> Date Completed </td></tr></span>If I manually reposition </span> to this:
Code: Select all
<tr><td> Task Description </td><td> <span style="text-align:right;">Status </span></td><td> Date Completed </td></tr>Graham
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Data References ~ Evernote ~ Research Notes
I suspect you still have </th> instead of </td> in these lines:
I have tested it and it produces the span structure you produced by hand.
Maybe Evernote does not support alignment in table cells?
Try creating a table in Evernote with alignment in cells and export in HTML format to discover what it likes.
Code: Select all
-- Alignment <align="r"> <align="c"> <align="j">
strLine, intAny = strLine:gsub('(..-)<align="r">(.-)</td>','%1<span style="text-align:right;">%2</span></td>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('(..-)<align="c">(.-)</td>','%1<span style="text-align:center;">%2</span></td>')
intSum = intSum + intAny
strLine, intAny = strLine:gsub('(..-)<align="j">(.-)</td>','%1<span style="text-align:justify;">%2</span></td>')
intSum = intSum + intAny
Maybe Evernote does not support alignment in table cells?
Try creating a table in Evernote with alignment in cells and export in HTML format to discover what it likes.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Data References ~ Evernote ~ Research Notes
I think I have unravelled Evernote's handling of alignment in tables.
It doesn't recognise <span style="text-align:right;"> although it does preserve it in the import and even exporting it again.
It handles alignment like this <td style="text-align:right;"> so I have modified the Alignment section. I have removed the lines like:
and replaced with
Does my new pattern matching <td>%s-<align="r">(.-)</td> look OK?
I have also taken out these lines but not sure what the impact is, do I need them?
Thanks,
Graham
It doesn't recognise <span style="text-align:right;"> although it does preserve it in the import and even exporting it again.
It handles alignment like this <td style="text-align:right;"> so I have modified the Alignment section. I have removed the lines like:
Code: Select all
strLine, intAny = strLine:gsub('(..-)<align="r">(.-)</td>','%1<span style="text-align:right;">%2</span></td>') Code: Select all
strLine, intAny = strLine:gsub('<td>%s-<align="r">(.-)</td>','<td style="text-align:right;">%1</td>') I have also taken out these lines but not sure what the impact is, do I need them?
Code: Select all
strLine, intAny = strLine:gsub('<align="r">(.-)$','<span style="text-align:right;">%1</span>')Graham
- tatewise
- Megastar
- Posts: 27087
- Joined: 25 May 2010 11:00
- Family Historian: V7
- Location: Torbay, Devon, UK
- Contact:
Re: Data References ~ Evernote ~ Research Notes
Good detective work! I might adopt that table alignment form in my Export Gedcom File plugin. The pattern is OK.
You do need those other three strLine:gsub('<align="r">(.-)$'... lines for alignment of whole lines outside tables.
You do need those other three strLine:gsub('<align="r">(.-)$'... lines for alignment of whole lines outside tables.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry
Re: Data References ~ Evernote ~ Research Notes
Here is the latest version 0.9 which I have also added to the Wiki page.
Please be aware that Evernote uses some non-standard conventions with its own XML format (ENML). The product is also currently supporting two versions 6.x and 10.x. You need to have version 6.x installed for this plugin to work as the new version does not (yet) support import folders.
Graham
Please be aware that Evernote uses some non-standard conventions with its own XML format (ENML). The product is also currently supporting two versions 6.x and 10.x. You need to have version 6.x installed for this plugin to work as the new version does not (yet) support import folders.
Graham