Created
March 19, 2018 15:59
-
-
Save jaytaylor/f33584c280260488978592644be79a35 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"github.com/jaytaylor/html2text" | |
) | |
func main() { | |
inp := ` <html><head><meta http-equiv=3D"Content-Type" content=3D"text/html; charset=3Diso-8859-=1"><style type=3D"text/css" style=3D"display:none;"><!-- P {margin-top:0;margi=n-bottom:0;} --></style></head><body dir=3D"ltr"><div id=3D"divtagdefaultwrapper" style=3D"font-size:12pt;color:#000000;font=-family:Calibri,Helvetica,sans-serif;" dir=3D"ltr"><p style=3D"margin-top:0;margin-bottom:0"><br></p><p style=3D"margin-top:0;margin-bottom:0"><br></p><div id=3D"Signature"><div id=3D"divtagdefaultwrapper" dir=3D"ltr" style=3D"font-size:12pt; color=:rgb(0,0,0); background-color:rgb(255,255,255); font-family:Calibri,Arial,H=elvetica,sans-serif,EmojiFont,"Apple Color Emoji","Segoe UI =Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji&=quot;,EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI E=moji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji&q=uot;,EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Em=oji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji&qu=ot;,EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emo=ji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji&quo=t;,EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoj=i",NotoColorEmoji,"Segoe UI Symbol","Android Emoji"=;,EmojiSymbols,EmojiFont,"Apple Color Emoji","Segoe UI Emoji=",NotoColorEmoji,"Segoe UI Symbol","Android Emoji"=,EmojiSymbols"><p>XXX</p><p>XXX</p><p><span style=3D"font-size:12pt">O: 804-293-0554</span><br></p><p><span style=3D"font-size:12pt">C: 804-874-5520</span></p><p><span style=3D"font-size:12pt"><br></span></p><p><br></p></div></div><br><br><div style=3D"color: rgb(0, 0, 0);"><hr style=3D"display:inline-block;width:98%" tabindex=3D"-1"><div id=3D"divRplyFwdMsg" dir=3D"ltr"><font face=3D"Calibri, sans-serif" st=yle=3D"font-size:11pt" color=3D"#000000"><b>From:</b> RVATECH <invite@ev=entbrite.com><br><b>Sent:</b> Thursday, March 15, 2018 5:14 PM<br><b>To:</b>XXX<br><b>Subject:</b> XXX</font><div> </div></div><div><table align=3D"center" width=3D"640" style=3D"margin:0 auto; font-family:'=Helvetica Neue',Helvetica,Arial,sans-serif; font-size:13px; background-imag=e:url(https://cdn.evbstatic.com/s3-s3/marketing/emails/invites/BGTexture.pn=g); background-color:#F4F9F7"><tbody><tr><td><table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" width=3D"560" align==3D"center" style=3D"margin:0 auto"><thead><tr><td height=3D"40"> </td></tr></thead><tbody><tr><td><table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" width=3D"560"><tbody><tr id=3D"x_invite_body_main" bgcolor=3D"#020930"><td valign=3D"top"><table width=3D"560" border=3D"0" cellpadding=3D"0" cellspacing=3D"0"><tbody><tr><td style=3D"line-height:9px"><img width=3D"560" height=3D"9" style=3D"user=-select: none;" src=3D"https://cdn.evbstatic.com/s3-s3/marketing/emails/inv=ites/topcorners.gif"></td></tr><tr><td><table width=3D"560" cellspacing=3D"0" cellpadding=3D"0" style=3D"border-le=ft:1px solid #dedede; border-right:1px solid #dedede; border-top:0; border-=bottom:0; padding:0"><tbody><tr><td width=3D"29"></td><td width=3D"500" class=3D"x_customize_change" style=3D"color:#ffffff; font=-family:'Helvetica Neue',Helvetica,Arial,sans-serif; text-align:left"><div style=3D"text-align:center; margin-top:30px; margin-bottom:0px"><p style=3D"font-size:17px; line-height:21px"><strong id=3D"x_invite_body_s=alutation_all" style=3D"display:inline"><span id=3D"x_invite_body_salutatio=n" class=3D"x_customize_change" style=3D"color:#ffffff">Hello XXX,</span></strong><br><span class=3D"x_customize_change" style=3D"font-size:13px; font-weight:400=; line-height:18px; margin-top:0; color:#ffffff">You are invited to the fol=lowing event:</span></p><a href=3D"https://somelink.com" style=3D"font-size:24px; line-=height:26px; text-transform:uppercase; color:#de1b2b; text-decoration:none"= id=3D"LPlnk13229" previewremoved=3D"true">XXX </a></div><div style=3D"margin-top:24px"><img alt=3D"divider" width=3D"500" height=3D="8" style=3D"user-select: none;" src=3D"https://cdn.evbstatic.com/s3-s3/mar=keting/emails/invites/lottering.png"></div><table width=3D"500" border=3D"0" cellspacing=3D"0" cellpadding=3D"0" style==3D"margin:20px 0 0 0"><tbody><tr><td id=3D"x_invite_body_logo" width=3D"250" valign=3D"top" style=3D"display=:inline"><a href=3D"https://somelink.com" target=3D"_blank" id=3D"LPlnk874071" previewremoved=3D"true"><img width==3D"225" style=3D"border: 0px; user-select: none;" src=3D"https://somelink.com"></a></td><td width=3D"250" valign=3D"top" style=3D"font-size:13px; line-height:18px;= font-family:'Helvetica Neue',Helvetica,Arial,sans-serif"><p class=3D"x_customize_change" style=3D"line-height:18px; margin-top:0; co=lor:#ffffff">Event to be held at the following time, date, and location: </p><p class=3D"x_customize_change" style=3D"color:#ffffff; width:200px">Thursd=ay, April 12, 2018 from 6:00 PM to 8:00 PM (EDT)</p><p class=3D"x_customize_change" style=3D"color:#ffffff"><b>TBA</b><br>XXX<br><br><a href=3D"https://somelink.com" target=3D"_blank" style=3D"colo=r:#de1b2b; text-decoration:none" id=3D"LPlnk378860" previewremoved=3D"true"=>View Map</a></p></td></tr></tbody></table><table width=3D"500" border=3D"0" cellpadding=3D"0" cellspacing=3D"0" style==3D"font-size:14px; font-family:'Helvetica Neue',Helvetica,Arial,sans-serif=; line-height:18px; margin:20px 0 24px 0"><tbody><tr><td width=3D"250" valign=3D"middle"><div id=3D"x_invite_rsvp_on" style=3D""><table width=3D"100%" cellpadding=3D"0" cellspacing=3D"0" border=3D"0"><tbody><tr><td width=3D"30%" height=3D"41"><table width=3D"100%" border=3D"0" cellspacing=3D"0" cellpadding=3D"0"><tbody><tr><td><table border=3D"0" cellspacing=3D"0" cellpadding=3D"0"><tbody><tr><td align=3D"center" bgcolor=3D"#F6682F" style=3D"-webkit-border-radius:40p=x; -moz-border-radius:40px; border-radius:40px; background:url(https://evbd=n.eventbrite.com/s3-s3/static/images/django/background/glass_light-trans.pn=g) repeat-x 0 50% #F6682F"><a href=3D"https://somelink.com" target=3D"_blank" style=3D"font-size=:15px; font-weight:bold; font-family:Helvetica,Arial,sans-serif; color:#fff=fff; text-decoration:none; -webkit-border-radius:40px; -moz-border-radius:4=0px; border-radius:40px; padding:10px 18px; border:1px solid #F6682F; displ=ay:inline-block" id=3D"LPlnk307099" previewremoved=3D"true"><strong style==3D"color:#ffffff">Yes</strong></a></td></tr></tbody></table></td></tr></tbody></table></td><td width=3D"15%" style=3D"padding:12px 0 12px 10px"><a href=3D"https://somelink.com" target=3D"_blank" style=3D"vertical-=align:middle; display:inline-block; color:#de1b2b; text-decoration:none; fo=nt-size:14px" id=3D"LPlnk819839" previewremoved=3D"true">No</a></td><td width=3D"55%" style=3D"padding:12px 0 12px 10px"><a href=3D"https://somelink.com" target=3D"_blank" style=3D"ver=tical-align:middle; display:inline-block; color:#de1b2b; text-decoration:no=ne; font-size:14px" id=3D"LPlnk701221" previewremoved=3D"true">Maybe</a></td></tr></tbody></table></div></td><td width=3D"250" valign=3D"middle"></td></tr></tbody></table><img alt=3D"divider" width=3D"500" height=3D"8" style=3D"user-select: none;=" src=3D"https://cdn.evbstatic.com/s3-s3/marketing/emails/invites/lottering=.png"><table width=3D"500" border=3D"0" cellpadding=3D"0" cellspacing=3D"0" style==3D"font-size:13px; font-family:'Helvetica Neue',Helvetica,Arial,sans-serif=; line-height:18px; padding:20px 0 24px 0"><tbody><tr><td><div id=3D"x_invite_body_custom_message" width=3D"500" style=3D"word-break:=break-word; overflow:hidden"><div class=3D"x_customize_change x_js-message-content" style=3D"color:#ffff=ff"><p style=3D"text-align:center"><strong><span style=3D"font-family:tahoma,ar=ial,helvetica,sans-serif; font-size:medium">XXX</span></strong></p><p style=3D"text-align:center"> </p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif">6-8 p.m. - Reception</span></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif">7 p.m. - Unveiling of finalists</span></p><p style=3D"text-align:center"> </p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"><strong>Thank you to our reception sponsors!</strong></sp=an></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"><img alt=3D"CGI" style=3D"user-select: none;" src=3D"http=s://cdn.evbuc.com/eventlogos/246107924/1200pxcgilogo.svg.png"></span></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"><em>Title Sponsor</em></span></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"> </span></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"><strong><img alt=3D"Suntrust" style=3D"user-select: none;=" src=3D"https://cdn.evbuc.com/eventlogos/246107924/800pxsuntrustbankslogo.=svg.png"></strong></span></p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif"><em>Meet the Finalists Reception Sponsor</em></span></p><p style=3D"text-align:center"> </p><p style=3D"text-align:center"><span style=3D"font-family:tahoma,arial,helv=etica,sans-serif">Please direct all questions to Lindsay at<a href=3D"mailto:lindsay@rvatech.com" rel=3D"nofollow" style=3D"color:#de1=b2b; text-decoration:none" id=3D"LPlnk461801" previewremoved=3D"true">lindsay@rvatech.com</a>.</span></p><p>We hope you can make it!Cheers,RVATECH</p></div></div></td></tr></tbody></table></td><td width=3D"29"></td></tr></tbody></table></td></tr><tr><td style=3D"line-height:9px"><img alt=3D"eventbrite" width=3D"560" height==3D"9" style=3D"user-select: none;" src=3D"https://cdn.evbstatic.com/s3-s3/=marketing/emails/invites/bottomcorners.gif"></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table></td></tr></tbody></table><table border=3D"0" cellpadding=3D"0" cellspacing=3D"0" align=3D"center" st=yle=3D"width:640px; margin:0 auto; background-image:url(https://cdn.evbstat=ic.com/s3-s3/marketing/emails/invites/BGTexture.png); background-color:#F4F=9F7"><tbody><tr><td><table width=3D"600" id=3D"x_footer_container" align=3D"center" style=3D"wi=dth:600px; margin:0 auto; padding-bottom:25px"><tbody><tr><td colspan=3D"2"><img width=3D"600" style=3D"width: 600px; user-select: no=ne;" src=3D"https://cdn.evbstatic.com/s3-s3/static/images/django/util/line.=gif"></td></tr><tr><td style=3D"padding:0 10px 0 15px; font-family:Helvetica,Arial,sans-serif;= font-size:11px; color:#666; line-height:20px"><p style=3D"padding:10px 0 2px"><span style=3D"width:300px; word-wrap:break=-word">This invitation was sent to<a href=3D"mailto:xxx@xxx" style=3D"color:#666" id=3D"LPlnk443458=" previewremoved=3D"true">xxx@xxx</a> by the organizer of this event, <a href=3D"http://www=.eventbrite.com/org/6188835705" style=3D"color:#666" id=3D"LPlnk540770" pre=viewremoved=3D"true">RVATECH</a>.<br>To stop receiving invitations from this organizer, you can <a href=3D"http:=//www.eventbrite.com/inviteunsubscribe?email=3Dxxx%40xxx&oid==3D6145815&sig=3DAGNbPwFH7d_iblEYbJ4S676Ys-f9TIUobw&invite_id=3D140=52515" style=3D"color:#666" id=3D"LPlnk840276" previewremoved=3D"true">unsubscribe</a>. </span></p><p style=3D"padding:8px 0 10px"><span style=3D"padding:0">Eventbrite, Inc. =</span>| <span style=3D"padding:0 3px">155 5th St, 7th Floor </span>| <span style=3D"padding:0 3px">San Francisco,= CA 94103</span></p></td></tr></tbody></table></td></tr></tbody></table><img width=3D"1" height=3D"1" alt=3D"" style=3D"user-select: none;" src=3D"=https://somelink.com"></div></div></div></body></html>` | |
parsedHTML, err := html2text.FromString(inp, html2text.Options{PrettyTables: true}) | |
if err != nil { | |
// handle it | |
panic(err) | |
} | |
fmt.Printf("%s\n", parsedHTML) | |
} | |
/** | |
Output: | |
XXX | |
XXX | |
O: 804-293-0554 | |
C: 804-874-5520 | |
*From:* RVATECH <invite@ev=entbrite.com> | |
*Sent:* Thursday, March 15, 2018 5:14 PM | |
*To:* XXX | |
*Subject:* XXX | |
+-------------------------------------------------------------------------------------------------------------------------------------------+ | |
| +---------------------------------------------------------------------------------------------------------------------------------------+ | | |
| | | | | |
| | +-----------------------------------------------------------------------------------------------------------------------------------+ | | | |
| | | +-------------------------------------------------------------------------------------------------------------------------------+ | | | | |
| | | | | | | | | |
| | | | +--+---------------------------------------------------------------------------------------------------------------------+--+ | | | | | |
| | | | | | *Hello XXX,* You are invited to the fol=lowing event: XXX ( 3D"https://somelink.com" ) | | | | | |
| | | | | | | | +------------------------------+--------------------------------+ | ( 3D"https://somelink.com" | | | | | |
| | | | ) | Event | | | | to be held at the | | | following time, | | | | | |
| | | | date, and | | | | | | | location: Thursd=ay, April 12, | | | | | | |
| | | | | | 2018 from 6:00 PM | | | | to 8:00 PM | | | | | | | |
| | | | | (EDT) *TBA* XXX View Map ( | | | | | | | | | | | | |
| | | | 3D"https://somelink.com" ) | +------------------------------+--------------------------------+ | | | | | | | | |
| | | | | +--------------------------------------------------------------------------------------------------------------+--+ | | | | | | |
| | | | | | | | +----------------------------------------+--------------------------------+--------------------------------+ | | | | | |
| | | | | | | | | | | | +------------------------------------+ | No ( 3D"https://somelink.com" | Maybe ( | | | | | |
| | | | | | | | | | | | | | +--------------------------------+ | | ) | | | | | |
| | | | | | | | | 3D"https://somelink.com" ) | | | | | | | *Yes* ( | | | | | |
| | | | | | | | | | | | | | | | | | | |
| | | | | | | | | 3D"https://somelink.com" | | | | ) | | | | | | | | | |
| | | | | | | | | | | | | | +--------------------------------+ | | | | | |
| | | | | | | | | | | | | | | | | | | | | |
| | | | +------------------------------------+ | | | | | | | | | | | | | | |
| | | | | +----------------------------------------+--------------------------------+--------------------------------+ | | | | | | | | |
| | | | | | | +--------------------------------------------------------------------------------------------------------------+--+ | | | | | |
| | | | | | | | +--------------------------------+ | *XXX* 6-8 p.m. - Reception | | 7 p.m. - Unveiling of | | | | | |
| | | | | | | | | | finalists *Thank you to | | our reception sponsors!* | | Title | | | | | |
| | | | Sponsor ** Meet | | | | | | the Finalists Reception | | Sponsor Please | | | | | |
| | | | direct | | all questions to Lindsay | | | | | | at lindsay@rvatech.com ( | | | | | | | |
| | | | 3D"mailto:lindsay@rvatech.com" | | ). We hope you can make | | | | | | it!Cheers,RVATECH | | | | | |
| | | | | +--------------------------------+ | | | | | | | |
| | | | +--+---------------------------------------------------------------------------------------------------------------------+--+ | | | | | |
| | | | | | | | | |
| | | +-------------------------------------------------------------------------------------------------------------------------------+ | | | | |
| | +-----------------------------------------------------------------------------------------------------------------------------------+ | | | |
| +---------------------------------------------------------------------------------------------------------------------------------------+ | | |
+-------------------------------------------------------------------------------------------------------------------------------------------+ | |
+------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
| +--------------------------------------------------------------------------------------------------------------------------------------------------+ | | |
| | | | | |
| | This invitation was sent to xxx@xxx ( 3D"mailto:xxx@xxx" ) by the organizer of this event, RVATECH ( | | | |
| | 3D"http://www=.eventbrite.com/org/6188835705" ). To stop receiving invitations from this organizer, you can unsubscribe ( | | | |
| | 3D"http:=//www.eventbrite.com/inviteunsubscribe?email=3Dxxx%40xxx&oid==3D6145815&sig=3DAGNbPwFH7d_iblEYbJ4S676Ys-f9TIUobw&invite_id=3D140=52515" | | | |
| | ). Eventbrite, Inc. = | 155 5th St, 7th Floor | San Francisco,= CA 94103 | | | |
| +--------------------------------------------------------------------------------------------------------------------------------------------------+ | | |
+------------------------------------------------------------------------------------------------------------------------------------------------------+ | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment