Regex not matching exact string - regex

Ihrer Bestellung auf Contorion.de verschickt wurde. Bitte entnehmen Sie genauere Informationen der unten stehenden Auflistung. </p></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="show-for-large valign-top last columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:0!important;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="20" colspan="3" class="_bt _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-top:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" class="_bl" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Bestelldatum:</strong> 19.08.2019<br><strong>Bestellnummer:</strong> DE605812349<br><strong>Kundennummer:</strong> DE2002778724<br></p><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">Bei Rückfragen bitte Bestellnummer angeben.</p></td><td width="20" class="_br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-right:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="10" colspan="3" class="_bb _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th></tr></tbody></table></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellspacing="0" cellpadding="0" class="hide-for-large" style="border-collapse:collapse;border-spacing:0;display:none;font-size:0;height:0;line-height:0;max-height:0;mso-hide:all;overflow:hidden;width:0"><tr style="mso-hide:all"><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;mso-hide:all;width:100%"><tr style="mso-hide:all"><td height="20" colspan="3" class="_bt _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-top:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr style="mso-hide:all"><td width="20" class="_bl" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-left:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left"><strong style="mso-hide:all">Bestelldatum:</strong> 19.08.2019<br style="mso-hide:all"><strong style="mso-hide:all">Bestellnummer:</strong> DE605812349<br style="mso-hide:all"><strong style="mso-hide:all">Kundennummer:</strong> DE2002778724<br style="mso-hide:all"></p><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">Bei Rückfragen bitte Bestellnummer angeben.</p></td><td width="20" class="_br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;border-right:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr style="mso-hide:all"><td height="10" colspan="3" class="_bb _bl _br" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></td></tr><tr style="mso-hide:all"><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;mso-hide:all;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="15" colspan="3" class="_bb" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table> <table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table class style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><th class="valign-top first columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:0!important;padding-right:10px;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" class="button primary" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td height="32" width="2" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/btn_left.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td height="32" class="valign-middle text-center button__bg" bgcolor="#60b0ff" align="center" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:center;vertical-align:middle;word-wrap:break-word"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td class="text-center" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:center;vertical-align:top;word-wrap:break-word">Sendung verfolgen</td></tr></table></td><td height="32" width="7" class="button__bg button__arrow" bgcolor="#60b0ff" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:left;vertical-align:middle;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/icon_arrow_btn.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" height="30" class="button__bg" bgcolor="#60b0ff" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#60b0ff;border-collapse:collapse!important;color:#fff;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td height="32" width="2" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img src="http://media.contorion.de/content/mails/btn/btn_right.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:left;max-width:100%;outline:0;text-decoration:none;width:auto"></td></tr></table></td></tr><tr><td height="15" colspan="2" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Rechnungsvermerk:</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><p class="float-right" style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">7740/PC-IMT</p></td></tr></tbody></table></td></tr><tr><td height="10" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">7740/PC-IMT</p></td></tr><tr><td height="15" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="valign-top columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:10px;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td class="valign-middle" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:middle;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Versendet mit</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><img width="56" height="30" class="float-right" src="https://media.contorion.de/content/mails/order/GLS.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;float:right;max-width:100%;mso-hide:all;outline:0;text-align:right;text-decoration:none;width:auto"></td></tr></tbody></table></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="56" height="30" src="https://media.contorion.de/content/mails/order/GLS.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td></tr> <tr><td height="15" colspan="2" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Sendungsnr.</strong></p></td><td class="hide-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;display:none;font-size:0;height:0;hyphens:auto;line-height:0;max-height:0;mso-hide:all;overflow:hidden;padding:0;text-align:left;vertical-align:top;width:0;word-wrap:break-word"><p class="float-right" style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;mso-hide:all;text-align:left">25147184307</p></td></tr></tbody></table></td></tr><tr><td height="10" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr class="show-for-large"><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">25147184307</p></td></tr></tbody></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th><th class="valign-top last columns large-6 small-12" style="Margin:0 auto;margin:0 auto;padding-bottom:0;padding-left:10px;padding-right:0!important;vertical-align:top;width:300px"><table style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><th><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>Lieferadresse</strong></p></td></tr><tr><td height="5" colspan="1" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left">Böllhoff Produktion GmbH<br> Product Center Injection Moulding Technology (PC IMT)<br>Sachbearbeitung Materialwirtschaft<br> Archimedesstr. 1-4 <br>33649 Bielefeld</p></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table></th><th class="expander" style="padding:0!important;visibility:hidden;width:0"></th></tr></table></th></tr></tbody></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></table><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td height="15" colspan="3" class="_bb" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-bottom:solid 1px #ccc!important;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr></tbody></table><table cellpadding="0" cellspacing="0" class="container" style="Margin:0!important;border-collapse:collapse;border-spacing:0;display:table;margin:0!important;text-align:inherit;width:640px"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tr><td width="23" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="23" height="23" src="https://media.contorion.de/content/mails/order/info-icon.png" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"> Die Sendung wurde mit GLS Paket versandt. Wenn Sie diese Sendung verfolgen möchten, benutzen Sie bitte diese Paketverfolgungsnummer: 25147184307. Diese Mail bestätigt, dass Ihr Paket an den Pakendienstleister übergeben wurde. Nach der Übergabe kann es bis zu 12 Stunden dauern, bis das Paket im Paketzentrum gescannt wird und weitere Informationen zur Sendungsverfolgung über obigen Link abrufbar sind.</p></td></tr></table></td><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="20" colspan="99" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr> <!-- Shipments --><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table class="_bt _br _bl" cellpadding="0" cellspacing="0" style="border-collapse:collapse;border-left:solid 1px #ccc!important;border-right:solid 1px #ccc!important;border-spacing:0;border-top:solid 1px #ccc!important;display:table;width:100%"><tr><td height="15" colspan="3" class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td class="bg-gray" width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p class="nomargin" style="Margin:0!important;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0!important;margin-bottom:0!important;margin-top:0!important;text-align:left"><strong>Ihre Teillieferung</strong></p></td><td class="bg-gray" width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class="bg-gray" style="-moz-hyphens:auto;-webkit-hyphens:auto;background:#f3f3f3;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td height="15" colspan="3" class style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td></tr><tr><td colspan="3" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><table cellspacing="0" cellpadding="0" style="border-collapse:collapse;border-spacing:0;display:table;width:100%"><tbody style="display:table;width:100%"><tr><td width="20" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td width="70" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><img width="42" height="42" src="http://media.contorion.de/media/images/products/din-1440-flache-scheibe-edelstahl-a4-12mm-produktklasse-a-91368379-0-rGZGVmCY-s.jpg" style="-ms-interpolation-mode:bicubic;clear:both;display:block;max-width:100%;outline:0;text-decoration:none;width:auto"></td><td width="10" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"></td><td style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!important;hyphens:auto;padding:0;text-align:left;vertical-align:top;word-wrap:break-word"><p style="Margin:0 0 10px 0;color:#333;font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>DIN 1440 Flache Scheibe Edelstahl A4 12mm Produktklasse A</strong></p></td><td width="10" class="show-for-large" font-family:Arial,Helvetica,sans-serif;font-size:13px;font-weight:400;line-height:1.3;margin:0 0 10px 0;text-align:left"><strong>DIN 316 Flügelschraube amerikansiche Form M10x50 Edelstahl A2 blank</strong></p></td><td width="10" class="show-for-large" style="-moz-hyphens:auto;-webkit-hyphens:auto;border-collapse:collapse!importantA233hov39YG3zxPW4unCSHAcWReP8A2hzLqM"></body></html>
I have this HTML where I am meant to match the articles/product items.
Here is the regex: <strong>(.*?)<\/strong><\/p><\/td><td width="10"
The second article matches perfectly, but the first one is matching too much and I need an exact match. <\/p><\/td><td width="10" should come exactly after </strong> but it is matching it way down the page.
I've tried using ^...$ but it isn't working for some reason..

this is slow, but instead of matching everything inside the tag as you currently do .*?, you could insert a negative lookahead (?!<strong>) and match everything . except for characters followed by the opening tag you want to avoid, here <strong>
<strong>((.(?!<strong>))*?)<\/strong><\/p><\/td><td width="10"
this prevents the regex from matching any additional <strong> tags after the first matched one
if you want to prevent creating an additional group from the newly added parenthesis, you can make the inner part non-capturing
((?:.(?!<strong>))*?)

Related

Check how many users answered keeps returning first value

I am trying to see how many users answered each option however it will give me the result of how many people answered the first option. Result object is where all answered are saved to.
Do I need to make a loop in the html? Would this not work as you cant call Result in to html and filter it ? How would I go around doing this. I see the counter is staying to the first value and keeps looping for each option, but I am confused on a fix for this.
HTML
<!DOCTYPE html>
<html>
<head>
<title>Admin Panel</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.6.1/css/all.css" integrity="sha384-gfdkjb5BdAXd+lj+gudLWI+BXq4IuLW5IT+brZEZsLFm++aCMlF1V92rMkPaX4PP" crossorigin="anonymous">
<style>
body,
html {
margin: 0;
padding: 0;
height: 100%;
background: #7abecc !important;
}
.user_card {
width: 350px;
margin-top: auto;
margin-bottom: auto;
background: #74cfbf;
position: relative;
display: flex;
justify-content: center;
flex-direction: column;
padding: 10px;
box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
-webkit-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
-moz-box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
border-radius: 5px;
}
.form_container {
margin-top: 20px;
}
#form-title{
color: #fff;
}
#questionTitle {
text-align: left;
}
.login_btn {
width: 100%;
background: #33ccff !important;
color: white !important;
}
.login_btn:focus {
box-shadow: none !important;
outline: 0px !important;
}
.login_container {
padding: 0 2rem;
}
.input-group-text {
background: #f7ba5b !important;
color: white !important;
border: 0 !important;
border-radius: 0.25rem 0 0 0.25rem !important;
}
.input_user,
.input_pass:focus {
box-shadow: none !important;
outline: 0px !important;
}
#messages{
background-color: grey;
color: #fff;
padding: 10px;
margin-top: 10px;
}
</style>
</head>
<body>
<div class="container h-100">
<div class="d-flex justify-content-center h-100">
<div class="user_card">
<div>(-- <br/></div>
<div class="d-flex justify-content-center">
<h3 id="form-title">Question Statistics</h3>
</div>
<div class="d-flex justify-content-center form_container">
<form method="POST" action="">
{% csrf_token %}
<div class="input-group mb-3">
<h6 id="questionTitle"> {{question.QuestionText}} </h6>
</div>
<div> <h7> The Amount Of Users Who Answered Were: {{counter}} </h7> </div>
</br>
{% for option in options %}
<label for="{{ option.OptionID }}">{{ option.OptionText }} <br> This Option Was Chosen by: {{counter2}} Users</label> <br>
{% endfor %}
<div class="d-flex justify-content-center mt-3 login_container">
<input class="btn login_btn" type="submit" value="Submit">
</div>
</form>
</div>
{{form.errors}}
{% for message in messages %}
<p id='messages'>{{message}} </p>
{% endfor %}
</div>
</div>
</div>
</div>
</body>
</html>
Model
class Result(models.Model):
ResponseID = models.AutoField(primary_key=True, unique=True)
userID = models.ForeignKey(Account, on_delete=models.CASCADE)
QuestionsID = models.ForeignKey(Question, on_delete=models.CASCADE)
ChosenOptionID = models.ForeignKey(Option, on_delete=models.CASCADE)
def __str__(self):
return str(self.ResponseID)
VIEWS for statstic
def question_statistics(request, id):
question = Question.objects.get(QuestionsID = id)
options = Option.objects.filter(QuestionsID = question)
r = Result.objects.filter(QuestionsID = id)
counter = 0
for x in r:
counter+=1
a = Result.objects.filter(ChosenOptionID = options)
counter2 = 0
for y in options:
a = Result.objects.filter(ChosenOptionID = y)
for x in a:
counter2+=1
current_user = request.user
if current_user.is_admin:
pass
else:
messages.error("User is not admin")
return redirect('dashboardPage')
context = {'question' : question,
'options' : options,
'results' : r,
'counter' : counter,
'counter2' : counter}
return render(request, 'questionStatistic.html', context)
Your 'counter2': counter should be 'counter2': counter2. It's returning the answer to the first question because the variable you're calling is the counter for the first question.

Rendering a dictionary in a template

While rendering values of a dictionary in a template, some values are showed outside the html table. I cant realize why.
Any ideas?
Thanks in advance,
#This is how the dictionary is printed in console
[{'socio': 'Randazzo Walter Ariel 25', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': 'P', 'agosto': 'P', 'septiembre': 'P', 'octubre': 'P', 'noviembre': 'P', 'diciembre': 'P'}, {'socio': 'Silvi Edgardo Marcelo 31', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': '-', 'agosto': '-', 'septiembre': '-', 'octubre': '-', 'noviembre': '-', 'diciembre': '-'}]
#this is how the template is rendered
#Template:
<!DOCTYPE html>
{% load static %}
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Listados</title>
<style>
* {
color: black;
}
body {
font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
color: black;
}
.name-company {
font-size: 30px;
padding: 0;
margin: 0;
font-weight: bold;
text-transform: uppercase;
text-align: center;
}
table thead tr th {
border: 1px solid black !important;
padding: 3px;
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.img-logo {
margin-top: 10px;
width: 75px;
height: 75px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<img src="{{ icon }}" width="140" height="32" style="text-align: right;">
<p style="text-align: right;margin-top: 2px;">
</p>
<br>
<p style="text-align: left;margin-top: 2px;">
Año: {{ano}}
</p>
<br>
<div class="container-fluid">
<table class="table" style="width: 100%;">
<thead>
<tr style="border: 1px solid black;">
<th style="width: 30%; text-align: center;">SOCIO</th>
<th style="width: 25%; text-align: center;">ENE</th>
<th style="width: 25%; text-align: center;">FEB</th>
<th style="width: 25%; text-align: center;">MAR</th>
<th style="width: 25%; text-align: center;">ABR</th>
<th style="width: 25%; text-align: center;">MAY</th>
<th style="width: 25%; text-align: center;">JUN</th>
<th style="width: 25%; text-align: center;">JUL</th>
<th style="width: 25%; text-align: center;">AGO</th>
<th style="width: 25%; text-align: center;">SEP</th>
<th style="width: 25%; text-align: center;">OCT</th>
<th style="width: 25%; text-align: center;">NOV</th>
<th style="width: 25%; text-align: center;">DIC</th>
</tr>
</thead>
<tbody>
{% for pago in pagos %}
<tr {% if forloop.first %}style="padding-top: 3px;" {% endif %}>
<td class="text-center">{{ pago.socio }}</td>
<td class="text-center">{{ pago.enero }}</td>
<td class="text-center">{{ pago.febrero }}</td>
<td class="text-center">{{ pago.marzo }}</td>
<td class="text-center">{{ pago.abril }}</td>
<td class="text-center">{{ pago.mayo }}</td>
<td class="text-center">{{ pago.junio }}</td>
<td class="text-center">{{ pago.julio }}</td>
<td class="text-center">{{ pago.agosto }}</td>
<td class="text-center">{{ pago.septiembre }}</td>
<td class="text-center">{{ pago.octubre }}</td>
<td class="text-center">{{ pago.noviembre }}</td>
<td class="text-center">{{ pago.diciembre }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</body>
</html>
#view
def get(self,request,*args,**kwargs):
anolistado = self.kwargs['ano']
listainfopagosanual=[]
sociosdet=[]
#devuelve el numero de socio
def numerodesocio(soc):
nrosocio=""
for c in soc:
if c.isnumeric():
nrosocio+=c
return nrosocio
#Lista de socios con pagos
pagosdet=PagosDetail.objects.all().select_related('pago').filter( ano_pago=anolistado).order_by('pago__numero_socio__numero_socio')
for det in pagosdet:
if str(det.pago.numero_socio) not in sociosdet:
sociosdet.append(str(det.pago.numero_socio))
#Por cada socio guardo los meses pagos
for soc in sociosdet:
nrosocio=numerodesocio(soc)
pagosdet1=PagosDetail.objects.all().select_related('pago').filter( ano_pago=anolistado,pago__numero_socio=nrosocio)
EneroPago="-";FebreroPago="-";MarzoPago="-";AbrilPago="-";MayoPago="-";JunioPago="-";JulioPago="-";AgostoPago="-";SeptiembrePago="-";OctubrePago="-";NoviembrePago="-";DiciembrePago="-"
for det in pagosdet1:
mespago=str(det.mes_pago)
if mespago=="Enero":
EneroPago="P"
if mespago=="Febrero":
FebreroPago="P"
if mespago=="Marzo":
MarzoPago="P"
if mespago=="Abril":
AbrilPago="P"
if mespago=="Mayo":
MayoPago="P"
if mespago=="Junio":
JunioPago="P"
if mespago=="Julio":
JulioPago="P"
if mespago=="Agosto":
AgostoPago="P"
if mespago=="Septiembre":
SeptiembrePago="P"
if mespago=="Octubre":
OctubrePago="P"
if mespago=="Noviembre":
NoviembrePago="P"
if mespago=="Diciembre":
DiciembrePago="P"
listainfopagosanual.append({'socio':soc,'enero':EneroPago,'febrero':FebreroPago,'marzo':MarzoPago,'abril':AbrilPago,'mayo':MayoPago,'junio':JunioPago,'julio':JulioPago,'agosto':AgostoPago,'septiembre':SeptiembrePago,'octubre':OctubrePago,'noviembre':NoviembrePago,'diciembre':DiciembrePago})
print (listainfopagosanual)
try:
template= get_template('socios/invoice_socioscuotas_anual.html')
context={
'ano': anolistado,
'pagos': listainfopagosanual,
'icon': '{}{}'.format(settings.STATIC_URL,'core/img/adicrareng.jpg'),
}
html=template.render(context)
response= HttpResponse(content_type='application/pdf')
pisaStatus=pisa.CreatePDF(html, dest=response,link_callback=self.link_callback)
return response
except Exception as ex:
print(ex)
return HttpResponse(reverse_lazy('pagos:list'))
#Models
class Socios(models.Model):
numero_socio = models.AutoField(primary_key=True)
nombre = models.CharField(max_length=50)
apellido = models.CharField(max_length=50)
tipo_documento = models.CharField(max_length=3, choices=tipos_documento, default ='DNI')
documento = models.CharField(max_length=50)
fecha_nacimiento = models.DateField(null=True,blank=True)
nacionalidad = models.CharField(max_length=50)
status = models.CharField(max_length=1,choices=lista_status,default='Activo')
domicilio = models.CharField(max_length=50)
localidad = models.CharField(max_length=50)
provincia = models.CharField(max_length=2, choices=lista_provincia, default ='2')
codigo_postal = models.CharField(max_length=50)
celular = models.CharField(max_length=50)
telefono_fijo = models.CharField(max_length=50, null=True)
twitter = models.CharField(max_length=50, null=True)
facebook = models.CharField(max_length=100, null=True)
linkedin = models.CharField(max_length=100, null=True)
fecha_ingreso = models.DateField(default=datetime.now,null=False,blank=False)
email = models.EmailField(null=True)
titulo = models.CharField(max_length=100,null=True)
institucion = models.CharField(max_length=150,null=True)
class PagosHead(models.Model):
numero_pago = models.IntegerField()
numero_socio = models.ForeignKey(Socios, on_delete=models.CASCADE)
fecha_pago = models.DateField(default=datetime.now,null=True,blank=True)
importe_pago_total = models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
observaciones_pago = models.CharField(max_length=100,null=True)
numero_factura=models.CharField(max_length=14,default="00000-00000000",null=True,blank=True)
class PagosDetail(models.Model):
pago=models.ForeignKey(PagosHead,on_delete=models.CASCADE)
importe_pago = models.DecimalField(default=0.00,max_digits=9,decimal_places=2)
mes_pago = models.CharField(max_length=10)
ano_pago = models.SmallIntegerField(null=True)
#Final Rendered html Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Listados</title>
<style>
* {
color: black;
}
body {
font-family: "Roboto", "Lucida Grande", Verdana, Arial, sans-serif;
padding: 0;
margin: 0;
color: black;
}
.name-company {
font-size: 30px;
padding: 0;
margin: 0;
font-weight: bold;
text-transform: uppercase;
text-align: center;
}
table thead tr th {
border: 1px solid black !important;
padding: 3px;
}
table tbody tr td {
border: 1px solid black;
padding: 3px;
}
.img-logo {
margin-top: 10px;
width: 75px;
height: 75px;
margin-bottom: 10px;
}
</style>
</head>
<body>
<img src="/static/core/img/adicrareng.jpg" width="140" height="32" style="text-
align: right;">
<p style="text-align: right;margin-top: 2px;">
</p>
<br>
<p style="text-align: left;margin-top: 2px;">
Año: 2020
</p>
<br>
<div class="container-fluid">
<table class="table" style="width: 100%;">
<thead>
<tr style="border: 1px solid black;">
<th style="width: 30%; text-align: center;">SOCIO</th>
<th style="width: 25%; text-align: center;">ENE</th>
<th style="width: 25%; text-align: center;">FEB</th>
<th style="width: 25%; text-align: center;">MAR</th>
<th style="width: 25%; text-align: center;">ABR</th>
<th style="width: 25%; text-align: center;">MAY</th>
<th style="width: 25%; text-align: center;">JUN</th>
<th style="width: 25%; text-align: center;">JUL</th>
<th style="width: 25%; text-align: center;">AGO</th>
<th style="width: 25%; text-align: center;">SEP</th>
<th style="width: 25%; text-align: center;">OCT</th>
<th style="width: 25%; text-align: center;">NOV</th>
<th style="width: 25%; text-align: center;">DIC</th>
</tr>
</thead>
<tbody>
<tr style="padding-top: 3px;" >
<td class="text-center">Randazzo Walter Ariel 25</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
</tr>
<tr >
<td class="text-center">Silvi Edgardo Marcelo 31</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">P</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
<td class="text-center">-</td>
</tr>
</tbody>
</table>
</div>
</body>
</html>
I have modified a the structure of the data from list of dictionaries to a dictionary.
#Now This is how the dictionary is printed in console
{'25': {'socio': 'Randazzo Walter Ariel 25', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': 'P', 'agosto': 'P', 'septiembre': 'P', 'octubre': 'P', 'noviembre': 'P', 'diciembre': 'P'}, '31': {'socio': 'Silvi Edgardo Marcelo 31', 'enero': 'P', 'febrero': 'P', 'marzo': 'P', 'abril': 'P', 'mayo': 'P', 'junio': 'P', 'julio': '-', 'agosto': '-', 'septiembre': '-', 'octubre': '-', 'noviembre': '-', 'diciembre': '-'}}
This is how I populate the dictionary:
dictinfopagosanual[nrosocio]={'socio':soc,
'enero':EneroPago,
'febrero':FebreroPago,
'marzo':MarzoPago,
'abril':AbrilPago,
'mayo':MayoPago,
'junio':JunioPago,
'julio':JulioPago,
'agosto':AgostoPago,
'septiembre':SeptiembrePago,
'octubre':OctubrePago,
'noviembre':NoviembrePago,
'diciembre':DiciembrePago,
}
Then I render in the template as follow:
<tbody>
{% for key,value in pagos.items %}
<tr {% if forloop.first %}style="padding-top: 3px;" {% endif %}>
{% for key,value in value.items %}
<td class="text-center">{{ value }}</td>
{% endfor %}
</tr>
{% endfor %}
</tbody>

xhtml2pdf - Problem with displaying table rows using django forloop tag

What I am trying to do is to create an invoice pdf file with several table rows. Table rows would be created using for loop in Django. The problem is data inside for loop tag is not visible on the pdf file.
You can check the screenshots below. Django properly renders invoice.html template so the code is valid, but the pdf file contains empty frame without any table rows. To render pdf from html I am using xhtml2pdf.
how django render the invoice.html template
how pdf file looks like
invoice.html
<html>
<head>
{% load static %}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta charset="UTF-8">
<style>
#font-face {
font-family: Roboto;
src: url('{% static 'fonts/Roboto-Regular.ttf' %}');
}
#font-face {
font-family: Roboto-bold;
src: url('{% static 'fonts/Roboto-Bold.ttf' %}');
font-weight: bold;
}
#page {
size: a4 portrait;
#frame header_frame { /* Static Frame */
-pdf-frame-content: frame_header_left;
left: 50pt; width: 245pt; top: 30pt; height: 150pt;
}
#frame header_frame { /* Static Frame */
-pdf-frame-content: frame_header_right;
left: 300pt; width: 245pt; top: 50pt; height: 150pt;
}
#frame content_frame { /* Content Frame */
-pdf-frame-content: frame_invoice_number;
left: 50pt; width: 512pt; top: 170pt; height: 30pt;
}
#frame col1 {
-pdf-frame-content: frame_col1;
left: 50pt; width: 245pt; top: 220pt; height: 130pt;
}
#frame col2 {
-pdf-frame-content: frame_col2;
left: 300pt; width: 245pt; top: 220pt; height: 130pt;
}
#frame frame_services {
-pdf-frame-content: frame_services;
left: 50pt; width: 512pt; top: 380pt; height: 250pt;
-pdf-frame-border: 1;
}
#frame content_frame {
-pdf-frame-content: frame_summary;
left: 465pt; width: 100pt; top: 590pt; height: 50pt;
}
#frame content_frame {
-pdf-frame-content: frame_vat;
left: 50pt; width: 512pt; top: 590pt; height: 150pt;
}
#frame content_frame {
-pdf-frame-content: frame_signatures_left;
left: 50pt; width: 140pt; top: 725pt; height: 70pt;
}
#frame content_frame {
-pdf-frame-content: frame_signatures_right;
left: 400pt; width: 140pt; top: 725pt; height: 70pt;
left: 400pt; width: 140pt; top: 725pt; height: 70pt;
}
#frame content_frame {
-pdf-frame-content: footer_content;
left: 50pt; width: 512pt; top: 775pt; height: 50pt;
}
}
body {
background-color: white;
font-family: "Roboto", sans-serif;
}
.right{
font-size: 10px;
text-align: right;
}
.left{
text-align: left;
}
.invoice-number {
font-size: 18px;
font-family: "Roboto-bold", sans-serif;
}
.col-titles {
font-size: 16px;
text-decoration: underline;
font-family: "Roboto-bold", sans-serif;
}
.footer {
font-size: 8px;
text-align: center;
}
p{
font-size: 10px;
line-height: 0;
}
table {
border-bottom: 1px solid #ddd;
text-align: center;
}
td, td {
border-bottom: 1px solid #ddd;
vertical-align: middle;
}
.summary{
border-bottom: 1px solid #ddd;
}
.signatures {
border-top: 1px solid black;
font-size: 8px;
text-align: center;
}
th {
height: 36px;
}
td {
height: 25px;
}
</style>
</head>
<body>
<div>
<div>
<div id="frame_header_left" class="left">
<img src="{% static 'invoices/logo.png' %}" alt="logo" width="150" height="112">
</div>
<div id="frame_header_right" class="right">
<p>Miejsce wystawienia: Żabno</p>
<p>Data badania: {{ invoice.data_badania }}</p>
<p>Data wystawienia: {{ invoice.data_wystawienia_faktury }}</p>
</div>
</div>
<div id="frame_invoice_number">
<div class="invoice-number">
<h2>Faktura nr: {{ invoice.numer }}</h2>
</div>
</div>
<div id="frame_col1">
<p class="col-titles">Sprzedawca</p>
<div>
<p>MEDIKAP</p>
<p>ul. Plac Grunwaldzki 15B, 33-240 Żabno</p>
<p>NIP: 999999999</p>
<p>REGON: 9999999</p>
<p>Bank: ING Bank Śląski</p>
<p>Nr konta: 12 1234 1234 1243 1243 214 1244</p>
</div>
</div>
<div id="frame_col2">
<p class="col-titles">Nabywca</p>
<div>
<p> {{ invoice.firma}} </p>
<p> ul. {{ invoice.firma.ulica }} </p>
<p> {{ invoice.firma.kod_pocztowy }} {{ invoice.firma.miasto}}</p>
<p> NIP: {{ invoice.firma.nip }}</p>
<p> REGON: {{ invoice.firma.regon }}</p>
<p> forma płatności: {{ invoice.get_forma_platnosci_display}}</p>
</div>
</div>
<div id="frame_services">
<table>
<tr>
<th style="width: 50px;"> # </th>
<th style="width: 600px;"> Nazwa usługi</th>
<th style="width: 100px;"> Ilość</th>
<th style="width: 100px;"> Rabat[%]</th>
<th style="width: 100px;"> Cena usługi</th>
<th style="width: 100px;"> Wartość</th>
<th style="width: 100px;"> Wartość z rabatem:</th>
</tr>
{% for service in services_items %}
<tr>
<td> test </td>
<td> test </td>
</tr>
{% endfor %}
</table>
</div>
<div id="frame_summary" class="summary">
<p> : {{ service.get_total_value }} PLN</p>
<p> Wartość z uwzględnieniem {{ invoice.rabat}}% rabatu: {{ discounted_value|floatformat:"-2" }} PLN</p>
</div>
<div id="frame_vat">
<p> Podstawa zwolnienia z VAT: </p>
<p> Zwolnienie ze względu na zakres wykonywanych czynności (art. 43 ust.1) pkt 19 Ustawy o VAT</p>
</div>
<div id="frame_signatures_left">
<p class="signatures"> podpis osoby upoważnionej do odbioru faktury</p>
</div>
<div id="frame_signatures_right">
<p class="signatures"> podpis osoby upoważnionej do wystawienia faktury</p>
</div>
<div id="footer_content" >
<p class="footer">MEDIKAP Maria K.</p>
<p class="footer">Plac Grunwaldzki 15B, 33-240 Żabno</p>
<p class="footer">e-mail: gabinet.medikap#gmail.com tel: 539 993 332</p>
<p class="footer">NIP: 9930212793 REGON: 852441210</p>
</div>
</div>
</body>
</html>
views.py/DetailsInvoice
class DetailsInvoice(generic.View):
template_name = 'invoices/invoice_detail.html'
form_class = DetailInvoiceForm
success_url = reverse_lazy("invoices:list")
def get(self, request, invoice_id):
current_invoice = get_object_or_404(Invoice, id=invoice_id)
form = self.form_class(instance=current_invoice)
request.session['invoice_id'] = current_invoice.id
services = Service.objects.all()
all_service_items = ServiceItem.objects.all().filter(faktura = current_invoice).order_by('usluga')
context = {
'invoice': current_invoice,
'form' : form,
'services' : services,
'services_items' : all_service_items,
}
return render(request, self.template_name, context)
def post(self, request, invoice_id):
current_invoice = get_object_or_404(Invoice, id=invoice_id)
form = self.form_class(request.POST, instance=current_invoice)
all_service_items = ServiceItem.objects.all().filter(faktura=current_invoice)
context = {
'invoice' : current_invoice,
}
pdf = render_to_pdf('invoices/invoice.html', context)
services_assigned_to_invoice = current_invoice.uslugi.all()
if 'update-data' in request.POST and form.is_valid():
for service in all_service_items:
service_item = get_object_or_404(ServiceItem, id=service.id)
quantity_input = request.POST.get('quantity-' + str(service.id))
discount_input = request.POST.get('discount-' + str(service.id))
service_item.ilosc = int(quantity_input)
service_item.rabat = int(discount_input)
service_item.save()
form.save()
for service_item in all_service_items:
if service_item.usluga not in services_assigned_to_invoice:
service_item.delete()
for single_service in services_assigned_to_invoice:
new_service_item, created = ServiceItem.objects.get_or_create(usluga=single_service, faktura=current_invoice)
messages.success(request, 'Pomyślnie zaktualizowane dane')
return HttpResponseRedirect(self.request.META.get('HTTP_REFERER'))
if 'view-pdf' in request.POST:
return HttpResponse(pdf, content_type='application/pdf')
if 'download-pdf' in request.POST:
response = HttpResponse(pdf, content_type='application/pdf')
filename = f"Faktura {current_invoice.numer}.pdf"
content = "attachment; filename={}".format(filename)
response['Content-Disposition'] = content
return response
else:
return redirect('invoices:list')
rendering function
def render_to_pdf(template_src, context_dict={}):
template = get_template(template_src)
html = template.render(context_dict)
result = BytesIO()
pdf = pisa.pisaDocument(BytesIO(html.encode("utf-8")), result, link_callback=link_callback)
if not pdf.err:
return HttpResponse(result.getvalue(), content_type='application/pdf')
return None
You are not passing the same context variables to your PDF as the ones you are passing to your HTML template. To your HTML template you are passing:
context = {
'invoice': current_invoice,
'form' : form,
'services' : services,
'services_items' : all_service_items,
}
While to your PDF you are only passing:
context = {
'invoice' : current_invoice,
}
services_items is the one your PDF template seems to be missing. So because for service in services_items is an empty/non-existent list in your PDF template, it doesn't render any rows. In the future you can check this by adding an {% empty %} section to your for loop:
{% for service in services_items %}
<tr>
<td> test </td>
<td> test </td>
</tr>
{% empty %}
No items!
{% endfor %}

Is it possible to create a multilevel navigation with AMP sidebar?

I want to recreate our mobile page navigation for our AMP site. The problem is that it has multiple levels - so there are lists in the list. Like this:
<ul>
<li>section</li>
<li>
section
<span>some button that open a sub navigation via javascript</span>
<ul>
<li>subsection</li>
...
</ul>
</li>
...
</ul>
However even it's quite simple in AMP this seems to be tricky. I couldn't find any example. According to https://www.ampproject.org/docs/reference/components/amp-sidebar an amp-sidebar within an amp-sidebar is not possible since amp-sidebar has to be a child of body. Using a list in a list can't be used like on the mobile page that easily because: Javascript magic to toggle the subnav is restricted. :hover also won't work to show the subnav since it's for mobile devices.
Is there a valid solution to this problem and if yes how is it done?
Yes It is possible to create a multilevel navigation with AMP sidebar.
Here is example
Code :
<!doctype html>
<html amp>
<head>
<meta charset="utf-8">
<link rel="canonical" href="hello-world.html">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>body{-webkit-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-moz-animation:-amp-start 8s steps(1,end) 0s 1 normal both;-ms-animation:-amp-start 8s steps(1,end) 0s 1 normal both;animation:-amp-start 8s steps(1,end) 0s 1 normal both}#-webkit-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}#-moz-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}#-ms-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}#-o-keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}#keyframes -amp-start{from{visibility:hidden}to{visibility:visible}}</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<style amp-custom>
amp-sidebar {background: #f0f0f0;width: 215px;}
amp-sidebar .submenu {background: #f0f0f0;bottom: 0;/*box-shadow: 0 3px 20px 0 rgba(0, 0, 0, 0.075);*/left: 0;position: fixed;right: 0;top: 0;-webkit-transform: translateX(-100%);transform: translateX(-100%);-webkit-transition: -webkit-transform 233ms cubic-bezier(0, 0, 0.21, 1);transition: -webkit-transform 233ms cubic-bezier(0, 0, 0.21, 1);
transition: transform 233ms cubic-bezier(0, 0, 0.21, 1); transition: transform 233ms cubic-bezier(0, 0, 0.21, 1), -webkit-transform 233ms cubic-bezier(0, 0, 0.21, 1)}
amp-sidebar input:checked+.submenu {-webkit-transform: translateX(0);transform: translateX(0);overflow-y:auto;}
amp-sidebar input[type="checkbox"] {position: absolute;visibility: hidden}
amp-sidebar .menu-item {color: #000;display: block;position: relative;text-transform: none}
amp-sidebar .menu-layer .items {left: 0;position: absolute;right: 0;}/*** overflow-x: hidden;overflow-y: scroll; 27 june ***/
amp-sidebar .menu-layer .submenu .items {overflow-x: hidden;overflow-y: scroll;}
amp-sidebar .menu-layer.primary {height: 100%;position: relative}
amp-sidebar .menu-layer.primary .items { bottom: 0px;top:50px;padding: 0 10px;}
amp-sidebar .menu-layer.secondary { z-index: 2}
amp-sidebar .menu-layer.tertiary { z-index: 3}
amp-sidebar .menu-layer.secondary .items, amp-sidebar .menu-layer.tertiary .items {bottom:0;top:60px;}
amp-sidebar .has-sub-level::after {width: 15px;height: 15px;content: '';position: absolute;right: 15px; top: calc(50% - 8px); background:url(https://image.flaticon.com/icons/svg/271/271228.svg) no-repeat;}
amp-sidebar .close-button { border: 0; position: absolute;left: 10px;top: 10px; width: 35px;height: 35px;background:url(https://image.flaticon.com/icons/svg/32/32178.svg) no-repeat; background-size:25px; font-size: 0px;font-family:arial, sans-serif;}
amp-sidebar .return-button {color: #b3b3b3;left: 15px;position: absolute;top: 22px;font-size: 0px;}
amp-sidebar .return-button::before {border: 0;content: '';margin-right: 5px;position: relative;top: 0px;background: url(https://image.flaticon.com/icons/svg/109/109618.svg) no-repeat; width: 30px;height: 30px;display: block;}
amp-sidebar .submenu .return-button + #menu-button {display: none;}
amp-sidebar .menu-layer.secondary .items .level1 li {border-bottom: 1px solid #e4e4e4;padding: 8px 5px;}
.hamburger{-webkit-appearance:none;background:url(https://image.flaticon.com/icons/svg/128/128453.svg) no-repeat;border:0px;font-size:0px;width:48px;height:48px;padding:0;margin:5px; outline:none;z-index:99;background-position:center center;}
.sideNavi > a, .sideNavi > label, .items > a, .items > label {font-size:14px;text-decoration:none;padding: 8px 10px;font-family:arial, sans-serif;font-weight: bold;}
span.whats-new{color:#dc4a36;}
.secondary.submenu >.items>label{font-size:12px;text-transform: uppercase}
.submenu a{font-size: 12px;font-family:arial, sans-serif;padding: 5px 10px;}
span.top-sale-style{background:#3e3e3e;margin-left: 4px;font-size:10px;padding: 0px 3px;text-transform: capitalize;color:#fff;font-weight: bold;border-radius: 2px;display:inline-block;height:15px; line-height:15px;}
.top-new-style {background:#fff;border: 1px solid #e55049;border-radius: 2px;color: #e55049;
display: inline-block;font-size: 10px;font-weight: bold;margin-left: 4px;padding: 0px 3px;text-transform: capitalize;height:15px;line-height:15px;}
.sale-style {background:#3e3e3e;border-radius: 2px; color: #fff;display: inline-block;height: 15px;line-height: 15px;font-size: 10px; margin-left: 4px;padding: 0px 3px;text-transform: capitalize; vertical-align: middle;}
</style>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
</head>
<body>
<amp-sidebar id='sidebar' side='left' layout='nodisplay'>
<form class="menu-layer primary" action="/" target="_top">
<button type="reset" class="close-button" id="menu-button" on='tap:sidebar.toggle'>X</button>
<div class="items sideNavi">
<label class="menu-item item-layer-1 has-sub-level active"><input type="checkbox">
Lavel 1 (with sub menu)
<div class="submenu menu-layer secondary">
<div class="return-button">Back</div>
<button type="reset" class="close-button" id="menu-button" on='tap:sidebar.toggle'>X</button>
<div class="items">
<a class="menu-item item-layer-2" href="#">Lavel 2</a>
<a class="menu-item item-layer-2" href="#">Lavel 2</a>
</div>
</div>
</label>
<label class="menu-item item-layer-1 has-sub-level active"><input type="checkbox">
Lavel 1
<div class="submenu menu-layer secondary">
<div class="return-button">Back</div>
<button type="reset" class="close-button" id="menu-button" on='tap:sidebar.toggle'>X</button>
<div class="items">
<label class="menu-item item-layer-1 has-sub-level"><input type="checkbox">
Lavel 2
<div class="submenu menu-layer secondary">
<div class="return-button">Back</div>
<button type="reset" class="close-button" id="menu-button" on='tap:sidebar.toggle'>X</button>
<div class="items">
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
</div>
</div>
</label>
<label class="menu-item item-layer-1 has-sub-level"><input type="checkbox">
Lavel 2
<div class="submenu menu-layer secondary">
<div class="return-button">Back</div>
<button type="reset" class="close-button" id="menu-button" on='tap:sidebar.toggle'>X</button>
<div class="items">
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
<a class="menu-item item-layer-2" href="#">Lavel 3</a>
</div>
</div>
</label>
</div>
</div>
</label>
<a class="menu-item item-layer-3" href="#"> Lavel 1 (without sub menu) </a>
</div>
</form>
</amp-sidebar>
<button class="tab hamburger" id="menu-button" on='tap:sidebar.toggle'>=</button>
</body>
</html>
This is an alternate to the checkbox hack. Using amp-bind to switch classes and some accessibility consideration: https://codepen.io/RickRX/pen/BEzyJm (still WIP)
<!doctype html>
<html ⚡ lang="en">
<head>
<meta charset="utf-8">
<title>AMP Mobile Nav</title>
<link rel="canonical" href="index.php">
<meta name="viewport" content="width=device-width,minimum-scale=1,initial-scale=1">
<style amp-boilerplate>
body {
-webkit-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-moz-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
-ms-animation: -amp-start 8s steps(1, end) 0s 1 normal both;
animation: -amp-start 8s steps(1, end) 0s 1 normal both
}
#-webkit-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
#-moz-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
#-ms-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
#-o-keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
#keyframes -amp-start {
from {
visibility: hidden
}
to {
visibility: visible
}
}
</style><noscript><style amp-boilerplate>body{-webkit-animation:none;-moz-animation:none;-ms-animation:none;animation:none}</style></noscript>
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-sidebar" src="https://cdn.ampproject.org/v0/amp-sidebar-0.1.js"></script>
<script async custom-element="amp-bind" src="https://cdn.ampproject.org/v0/amp-bind-0.1.js"></script>
<style amp-custom>
body {
width: auto;
margin: 0;
padding: 0;
background: lightgrey;
font-family: "Lato", Arial, sans-serif;
font-size: 16px;
line-height: 1.6;
}
.headerbar {
background: #ffffff;
height: 50px;
width: 100%;
display: flex;
flex-direction: row;
}
.hamburger,
.site-name {
flex: 1 1 auto;
padding: 10px;
}
amp-sidebar,
amp-sidebar .submenu {
width: 100%;
height: 100%;
}
amp-sidebar .main-menu,
amp-sidebar .submenu {
overflow: auto;
}
amp-sidebar .submenu {
top: 0;
left: 0;
position: fixed;
}
amp-sidebar .hide-submenu {
visibility: hidden;
transform: translateX(-100%);
}
amp-sidebar .show-submenu {
visibility: visible;
transform: translateX(0);
}
amp-sidebar .hide-parent {
visibility: hidden;
}
amp-sidebar .truncate {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}
amp-sidebar .link-container {
display: block;
height: 44px;
line-height: 44px;
border-bottom: 1px solid #f0f0f0;
padding: 0 1rem;
}
amp-sidebar a {
min-width: 44px;
min-height: 44px;
text-decoration: none;
cursor: pointer;
}
amp-sidebar .submenu-icon {
padding-right: 44px;
}
amp-sidebar .submenu-icon::after {
position: absolute;
right: 0;
height: 44px;
width: 44px;
content: '';
background-size: 1rem;
background-image: url('data:image/svg+xml;utf8, <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M5 3l3.057-3 11.943 12-11.943 12-3.057-3 9-9z"/></svg>');
background-repeat: no-repeat;
background-position: center;
}
amp-sidebar .controls {
display: flex;
height: 50px;
background: #f0f0f0;
}
amp-sidebar .controls a {
display: flex;
justify-content: center;
align-items: center;
}
amp-sidebar .controls span {
line-height: 50px;
margin: 0 auto;
}
amp-sidebar nav>.controls>a:first-of-type {
visibility: hidden;
}
amp-sidebar .controls a svg {
height: 1rem;
width: 1rem;
}
amp-sidebar .link-icon {
float: left;
height: 44px;
margin-right: 0.75rem;
}
amp-sidebar .link-icon>svg {
height: 44px;
}
amp-sidebar {
background: #fff;
color: #232323;
fill: #232323;
text-transform: uppercase;
letter-spacing: 0.18rem;
font-size: 0.875rem;
}
amp-sidebar a {
color: #232323;
text-transform: none;
letter-spacing: normal;
}
div[class*="-sidebar-mask"] {
opacity: 0.8;
}
amp-sidebar a:hover {
text-decoration: underline;
fill: #232323;
}
amp-sidebar .view-all {
font-style: italic;
font-weight: bold;
}
</style>
</head>
<body>
<amp-sidebar id='header-sidebar' side='left' layout='nodisplay'>
<nav>
<div
class="controls"
[class]="hidePrimary ? 'controls hide-parent' : 'controls'"
aria-label="Menu controls">
<a
tabindex="0"
role="button"
aria-label="">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">Menu</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close Menu">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<div class="main-menu items"
role="menu"
aria-label="Menu links"
[class]="hidePrimary ? 'main-menu items hide-parent' : 'main-menu items'">
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="Mens"
aria-haspopup="true"
on="tap:AMP.setState({level_1_0: !level_1_0, hidePrimary: !hidePrimary})"
title="Mens">
Mens </a>
<div class="submenu hide-submenu"
[class]="(level_1_0 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideSecondary ? 'hide-parent' : '')"
role="menu"
aria-label="Mens">
<div
class="controls"
[class]="hideSecondary ? 'controls hide-parent' : 'controls'"
aria-label="Mens controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_1_0: !level_1_0, hidePrimary: !hidePrimary})"
aria-label="Return to Menu">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">Mens</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close Mens">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a class="link-container truncate" tabindex="0" href="/link" title="Clothing" >
Clothing </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Footwear" >
Footwear </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Accessories" >
Accessories </a>
<a class="link-container view-all truncate" href="/link" title="Mens" >
View All Mens </a>
</div>
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="Womens"
aria-haspopup="true"
on="tap:AMP.setState({level_1_1: !level_1_1, hidePrimary: !hidePrimary})"
title="Womens">
Womens </a>
<div class="submenu hide-submenu"
[class]="(level_1_1 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideSecondary ? 'hide-parent' : '')"
role="menu"
aria-label="Womens">
<div
class="controls"
[class]="hideSecondary ? 'controls hide-parent' : 'controls'"
aria-label="Womens controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_1_1: !level_1_1, hidePrimary: !hidePrimary})"
aria-label="Return to Menu">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">Womens</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close Womens">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a class="link-container truncate" tabindex="0" href="/link" title="Clothing" >
Clothing </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Footwear" >
Footwear </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Accessories" >
Accessories </a>
<a class="link-container view-all truncate" href="/link" title="Womens" >
View All Womens </a>
</div>
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="Kids"
aria-haspopup="true"
on="tap:AMP.setState({level_1_2: !level_1_2, hidePrimary: !hidePrimary})"
title="Kids">
Kids </a>
<div class="submenu hide-submenu"
[class]="(level_1_2 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideSecondary ? 'hide-parent' : '')"
role="menu"
aria-label="Kids">
<div
class="controls"
[class]="hideSecondary ? 'controls hide-parent' : 'controls'"
aria-label="Kids controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_1_2: !level_1_2, hidePrimary: !hidePrimary})"
aria-label="Return to Menu">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">Kids</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close Kids">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a class="link-container truncate" tabindex="0" href="/link" title="Clothing" >
Clothing </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Footwear" >
Footwear </a>
<a class="link-container truncate" tabindex="0" href="/link" title="Accessories" >
Accessories </a>
<a class="link-container view-all truncate" href="/link" title="Kids" >
View All Kids </a>
</div>
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="Brands"
aria-haspopup="true"
on="tap:AMP.setState({level_1_3: !level_1_3, hidePrimary: !hidePrimary})"
title="Brands">
Brands </a>
<div class="submenu hide-submenu"
[class]="(level_1_3 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideSecondary ? 'hide-parent' : '')"
role="menu"
aria-label="Brands">
<div
class="controls"
[class]="hideSecondary ? 'controls hide-parent' : 'controls'"
aria-label="Brands controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_1_3: !level_1_3, hidePrimary: !hidePrimary})"
aria-label="Return to Menu">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">Brands</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close Brands">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="A-B"
aria-haspopup="true"
on="tap:AMP.setState({level_2_0: !level_2_0, hideSecondary: !hideSecondary})"
title="A-B">
A-B </a>
<div class="submenu hide-submenu"
[class]="(level_2_0 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideTertiary ? 'hide-parent' : '')"
role="menu"
aria-label="A-B">
<div
class="controls"
[class]="hideTertiary ? 'controls hide-parent' : 'controls'"
aria-label="A-B controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_2_0: !level_2_0, hideSecondary: !hideSecondary})"
aria-label="Return to Brands">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">A-B</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close A-B">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a class="link-container truncate" tabindex="0" href="/link" title="Armani" >
Armani </a>
<a class="link-container truncate" tabindex="0" href="/link" title="BOSS" >
BOSS </a>
</div>
<a
class="link-container submenu-icon truncate"
role="menuitem"
tabindex="0"
aria-label="C-F"
aria-haspopup="true"
on="tap:AMP.setState({level_2_1: !level_2_1, hideSecondary: !hideSecondary})"
title="C-F">
C-F </a>
<div class="submenu hide-submenu"
[class]="(level_2_1 ? 'submenu show-submenu' : 'submenu hide-submenu') + ' ' + (hideTertiary ? 'hide-parent' : '')"
role="menu"
aria-label="C-F">
<div
class="controls"
[class]="hideTertiary ? 'controls hide-parent' : 'controls'"
aria-label="C-F controls">
<a
tabindex="0"
role="button"
on="tap:AMP.setState({level_2_1: !level_2_1, hideSecondary: !hideSecondary})"
aria-label="Return to Brands">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg> </a>
<span class="truncate">C-F</span>
<a
tabindex="0"
role="button"
on='tap:header-sidebar.toggle'
aria-label="Close C-F">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 20.188l-8.315-8.209 8.2-8.282-3.697-3.697-8.212 8.318-8.31-8.203-3.666 3.666 8.321 8.24-8.206 8.313 3.666 3.666 8.237-8.318 8.285 8.203z"/></svg> </a>
</div>
<a class="link-container truncate" tabindex="0" href="/link" title="Channel" >
Channel </a>
<a class="link-container truncate" tabindex="0" href="/link" title="CK Jeans" >
CK Jeans </a>
</div>
</div>
</div>
</nav>
</amp-sidebar>
<header class="headerbar">
<div class="hamburger" role="button" aria-label="mobile menu" on="tap:header-sidebar.toggle" tabindex="0">
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M24 6h-24v-4h24v4zm0 4h-24v4h24v-4zm0 8h-24v4h24v-4z"/></svg>
</div>
<div class="site-name">AMP Mobile Nav</div>
</header>
<div class="info">
<p>some content...</p>
</div>
</body>
</html>
You can try using the amp-nested-menu component. You just have to expand the amp-sidebar if you are using it. Here an example:
<amp-sidebar id="sidebar" layout="nodisplay" side="left">
<amp-nested-menu layout="fill">
<ul>
<li>
<div amp-nested-submenu-open class="nested-arrow">Test</div>
<div amp-nested-submenu>
<ul>
<li><div amp-nested-submenu-close>go back</div></li>
<li>First link</li>
....
</ul>
</div>
</li>
</ul>
</amp-nested-menu></amp-sidebar>

coldfusion replace function not working correctly

Here is a document, stored in a variable called templlet:
{{d
{{h
Dear Customer,
We were so pleased that you have signed up for one of our programs. Below please find a listing of what you signed up for.
{{r
Sincerely Yours,
John Jones
President
XYZ Corporation
I intend to replace the {{d {{h and {{r with information selected by the user. {{d is a date, {{h is a heading and {{r is a report. The code to do this replacement is:
<cfset templlet = Replace(templlet, "{{d", "#repdatemm#")>
<cfset templlet = Replace(templlet, "{{h", "#heading#")>
<cfset templlet = Replace(templlet, "{{r", "#letrep#")>
The {{d and {{h are working fine. The {{r is being replaced with letrep, but not where it is positioned in templlet. Here is sample output:
July 06, 2018
Mr. Joseph Smith
1632 S. Bailey St.
Philadelphia, PA 19145
Dear Customer,
We were so pleased that you have signed up for one of our programs. Below please find a listing of what you signed up for.
Sincerely Yours,
John Jones
President
XYZ Corporation
Activity Code....Amount.....Note
EarlyReg.........500.00.....by check
Parking ...........30.00.......by paypal
Report Total :...530.00
(sorry for all the dots here -- I couldn't figure out how to put spaces in).
You can see that the {{r in templlet is prior to the signature, but the report is appearing after the signature line.
I've tried leaving more room in templlet between the {{r and the signature, which made no difference. I tried putting the {{r in a div, which made no difference. I'm baffled about why this is coming out in the wrong place. Can anyone tell me what is going wrong here?
The problem is that the:
<table>
Enclosing the report is not closed properly.
This works:
<cfsavecontent variable="content">
<link rel="stylesheet" href="sample.css"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <script type = "text/javascript"> fieldsplitput('moxlet', '�', 'x_1', 1) </script> <p style="margin-left:40px">{{d</p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">{{h</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Dear Customer,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">We were so pleased that you have signed up for one of our programs. Apparently you live in the city of Philadelphia. Additionally we observe that you were referred to us by 191. Below please find a listing of what you signed up for.</span></span></p> <div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif"> <link rel="stylesheet" type = "text/css" href ="betty.css"/> <link rel="stylesheet" type = "text/css" href ="persrep.css"/> <style type="text/css"> #media print { table tr.page-break{page-break-before:always} } </style> <HTML> <head> <link rel="stylesheet" type = "text/css" href ="betty.css"/> </head> <body> </body> </html> <div style = "margin:auto;overflow:auto; " >{{r</span></span></p> </div> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">Sincerely Yours,</span></span></p> <p style="margin-left:40px"><span style="font-size:14px"><span style="font-family:georgia,serif">John Jones<br /> President<br /> XYZ Corporation</span></span></p>
</cfsavecontent>
<cfset date = "July 06, 2018">
<cfsavecontent variable="header">
Mr. Joseph Smith<br />
1632 S. Bailey St.<br />
Philadelphia, PA 19145
</cfsavecontent>
<cfsavecontent variable="report">
<table class = "reptable" id = 'reptable' > <tr><td> </td></tr> <td> </td> <td class = "repcolhead1">Activity Code</td> <td class = "repcolhead1">Amount Paid</td> <td class = "repcolhead1">Note</td> <td><input type = "text" id = "repfoc" class = "inpbl" value = "" style = "lineheight: 2px; width:2px" > </td> </tr> <script type = "text/Javascript"> thefocus('repfoc') function thefocus(id) { //alert("got to thefocus id is " + id); document.getElementById(id).focus(); } </script> <td style = "padding-left: 0px; padding-top: 10px " class = "repsubh"> State: PA </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left: 10px; " class = "repsubh"> Trans. Date: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "color: #141212; text-align: left;" > EarlyReg </td> <td class = "repcolrow" style = "color: #141212; text-align: right;" > 500.00 </td> <td class = "repcolrow" style = "color: #141212; text-align: left;" > </td> <tr> <!--up counter on this subhead where appropriate ---> <td style = "padding-left:10px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: 11-06-2017 </td> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-2-1','cnt-2-2', 'brk-2-4-1', 'brk-2-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td style = "padding-left:0px; vertical-align: middle; padding-top: 5px; padding-bottom:20px; " class = "repsubf"> Subtotal: PA </td> <!--up counter on this subhead where appropriate ---> <!--up counter on this subhead where appropriate ---> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-3-1','cnt-3-2', 'brk-3-4-1', 'brk-3-4-2') </script> <td class = "repcolrow" style = "text-align: right;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <td class = 'repsubf' style = "font-weight:bold"> Report Total : <br> <a class = "repnum" id = "cnt-4-1" style = ""> Count : </a> <a class = "repnum" id = "cnt-4-2" style = "; ">1 </a> </p> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <script> placecount('cnt-4-1','cnt-4-2', 'brk-4-4-1', 'brk-4-4-2') </script> <td class = "repcolrow" style = "text-align: right;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> 500.00 </a> </td> <td class = "repcolrow" style = "text-align: left;font-weight:bold; vertical-align:top; padding-top: 10px color:630D85 " > <a class = "repbordtop" style = "position:relative; top:4px"> </a> </td> <tr> <tr><td> </td></tr><table>
</cfsavecontent>
<cfset content = ReplaceNoCase(content,"{{d",date)>
<cfset content = ReplaceNoCase(content,"{{h",header)>
<cfset content = ReplaceNoCase(content,"{{r",report)>
<cfoutput>
#content#
</cfoutput>