wrap long sentence in glass - google-glass

I have a small UI problem when trying to set a long sentence in glass, it displays like that:
Does anybody have an idea of wrapping the sentence to the next line? word wrap css code didn't work.
HTML Code:
<article>
<section>
<h1>Notes:</h1>
<ol class="text-x-small">
<li>Don't take the green one</li>
<li>Don't forget to check about the promotion we have tomorrow</li>
</ol>
</section>
<footer>
<p>Notes</p>
</footer>
</article>
Thanks for helping.

If you look here you'll find the default glass CSS. If you look under the lists section you'll find this gem:
ul li, ol li {
border-bottom: 1px solid #333;
padding: 6px 0;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
}
I'm not sure if you can include custom CSS styles in your HTML. If you can do something like this:
<article>
<style>
.wrap-li {
white-space: normal;
text-overflow: clip;
overflow: visible;
}
</style>
<section>
<h1>Notes:</h1>
<ol class="text-x-small">
<li class="wrap-li">Don't take the green one</li>
<li class="wrap-li">Don't forget to check about the promotion we have tomorrow</li>
</ol>
</section>
<footer>
<p>Notes</p>
</footer>
</article>
If the API doesn't accept defining styles in this way, you'd have to try to do this inline. Each li element would need to be:
<li style="white-space:normal;text-overflow:clip;overflow:visible">Don't take the green one</li>

I don't know if it is possible to wrap the text if it is too long with ol/li params. But you can make it with a table definition if you want:
<article>
<section>
<h1>Notes:</h1>
<table class="text-x-small">
<tbody>
<tr>
<td>
Don't take the green one
</td>
</tr>
<tr>
<td>
Don't forget to check about the promotion we have tomorrow
</td>
</tr>
</tbody>
</table>
</section>
<footer>
<p>Notes</p>
</footer>
</article>
Output:

Related

AWS SES New Virtual Deliverability Manager - Trackinglinks are not replaced in roundrect elements

Today I tried the new "Virtual Deliverability Manager" feature of AWS SES. Here I immediately noticed a problem with our emails.
For Outlook, there is an extra markup element "v:roundrect" in our email template.
The href in this element is not replaced by the tracking link from AWS.
All other links from our template are successfully replaced.
Snippet of our Email-Template:
<div align="center">
<!--[if mso]>
<v:roundrect xmlns:v="urn:schemas-microsoft-com:vml" xmlns:w="urn:schemas-microsoft-com:office:word" href="https://MYWEBSITE.com/produkt/#Model.ProductNumber" style="height:40px;v-text-anchor:middle;width:200px;" arcsize="10%" strokecolor="#800500" fillcolor="#da251d">
<w:anchorlock/>
<center style="color:#ffffff;font-family:sans-serif;font-size:13px;font-weight:bold;">Jetzt Bestellen!</center>
</v:roundrect>
<![endif]-->
Jetzt Bestellen!
</div>
Link in other EmailClients (Correct - replaced):
Link in Outlook (Incorrect - Not replaced):
Has anyone had similar experience in this regard?
It looks like AWS SES only replaces the classic a-tag hrefs.
Unfortunately I didn't find anything in their documentation about this.
My temporary workaround:
(No fix!)
I changed the Html of my Template. As a result, the button in Outlook no longer has the desired rounded edges. But now the tracking works.
<div align="center">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td style="padding: 12px 18px 12px 18px; border-radius:5px; background-color: #da251d;" align="center">
<a rel="noopener" target="_blank" href="https://MYWEBSITE.com/produkt/#Model.ProductNumber" target="_blank" style="font-size: 18px; font-family: Helvetica, Arial, sans-serif; font-weight: bold; color: #ffffff; text-decoration: none; display: inline-block;">Jetzt Bestellen!</a>
</td>
</tr>
</table>
Currently AWS is scanning only the links that are presented in the email and converting them. There is only possibility to remove the specific links from tracking using additional ses:no-track
Here is an example:
<a ses:no-track href="aws.amazon.com">Amazon Web Services</a>
On the other hand they do not allow(YET, maybe in the future) to provide a field to specifically convert some links in the other elements (as in your case

XSLT: How to filter content from complex generated HTML pages?

Here can be found some very good examples how to use XSLT to filter and merge simple HTML pages.
There are a mass of single saved HTML-pages (that has been generated with ASP) like the following example, that should be filtered and merged together into one HTML to generate a book from it.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="../../../../external.html?link=http://www.w3.org/1999/xhtml" >
<head id="Head1"><title>
2021_0623.aspx
</title>
</style></head>
<body>
<div align="center">
<div class="aspNetHidden">
</div>
<table width="95%" id="table1" cellspacing="0" cellpadding="0" border="0" >
<tr>
<td>
</td>
<td width="100%" bgcolor="black" style="padding: 10px;">
<div align="center">
</div>
</td>
</tr>
<tr>
<td>
</td>
<td bgcolor="black" width="100%" height="20px" style="padding-left: 20px; padding-right: 20px; padding-bottom: 10px;">
<div class="align-left">
</div>
</td>
</tr>
<tr>
<td align="right" valign="top" style="padding-right: 10px">
<a href="" /></a><div id="Menu1">
<ul class="level1">
<li>Recent Updates</li>
</ul>
</div><a id="Menu1_SkipLink"></a>
</td>
<td width="100%" valign="top" bgcolor="white" style="padding: 20px;">
<p class="page-title">Library</p>
<p class="page-title-2">Library Text</p>
<div class="nav">
<table class="nav">
<tr class="nav">
<td class="nav-title">Some unneeded navigation</td>
<td class="nav">
</td>
</tr>
</table>
</div>
<p class="copyright">Copyright © 2021</p>
<p class="about"><strong>ABOUT THE CONTENTS.</strong></p>
<p class="text-title">Title of text</p>
<p class="text-date">August 22, 2021</p>
<p>text of interest.</p>
<p>more text of interest.</p>
<p class="separator-left-33"> </p>
<p class="footnote"><a id="_ftn1" href="#_ftnref1" name="_ftn1">[1]</a> a footnote of interest</p>
<p class="footnote"><a id="_ftn2" href="#_ftnref2" name="_ftn1">[2]</a> one more footnote of interest</p>
<div class="nav">
<table class="nav">
</table>
</div>
</td>
</tr>
<tr>
<td>
</td>
<td width="100%" height="45" align="left" valign="top" style="padding-left: 20px; padding-top: 5px;" bgcolor="black">
</td>
</tr>
</table>
</form>
</div>
</body>
</html>
The result should be to filter all contents beginning with the title
<p class="page-title">Library</p>
including the footnotes.
Is this possible with XSLT and maybe to show up the way to do this?
It would be nice to filter the unneeded navigation and maybe class="about" that is always the same.
But this can be done in several steps afterwards.
The expected output should be like this or can be a well formed HTML-page:
<p class="page-title">Library</p>
<p class="page-title-2">Library Text</p>
<p class="copyright">Copyright © 2021</p>
<p class="text-title">Title of text</p>
<p class="text-date">August 22, 2021</p>
<p>text of interest.</p>
<p>more text of interest.</p>
<p class="separator-left-33"> </p>
<p class="footnote"><a id="_ftn1" href="#_ftnref1" name="_ftn1">[1]</a> a footnote of interest</p>
<p class="footnote"><a id="_ftn2" href="#_ftnref2" name="_ftn1">[2]</a> one more footnote of interest</p>
xsltproc seems to have an option to process --html documents instead of XML ones so assuming that option allows you to parse your inputs into HTML without a namespace the XSLT 1 code
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:output method="html" indent="yes" version="5" doctype-system="about:legacy-doctype"/>
<xsl:template match="#* | node()">
<xsl:copy>
<xsl:apply-templates select="#* | node()"/>
</xsl:copy>
</xsl:template>
<xsl:template match="body">
<xsl:copy>
<xsl:variable name="start-element" select="//p[#class = 'page-title']"/>
<xsl:apply-templates select="$start-element | $start-element/following-sibling::p"/>
</xsl:copy>
</xsl:template>
</xsl:stylesheet>
If the HTML documents end up in that odd namespace your input carries you would have to bind a prefix to that namespace in XSLT 1 and select and match element nodes with qualified names using prefix:local-name e.g. xhtml:body or xhtml:p where the namespace declaration would be xmlns:xhtml="../../../../external.html?link=http://www.w3.org/1999/xhtml".
So here is the basic solution as perl script doing the needed extract:
#!/usr/bin/perl
my $LCount = 0; # Line count
my $ICount = 0; # Line ignore count
my $DCount = 0; # Line done count
my $Line; # actual line
if (#ARGV == 0) { # Kein Paramter -> Beschreibung
print "\n";
print "extract.pl [input-file] [output-file]\n";
print "\n";
exit;
}
if (#ARGV < 1) { die "To less parameter!\n"; }
if (#ARGV > 2) { die "To much parameter!\n"; }
my $InputFile = $ARGV[0];
my $OutputFile = $ARGV[1];
###############################################################################
# Main programm
###############################################################################
open(InFile, $InputFile) or die "Error opening '$InputFile': $!\n";
open(OutFile,"> $OutputFile") or die "Error opening '$OutputFile': $!\n";
while(defined($Line = <InFile>)) {
$LCount ++;
if ($Line =~ /^<p/) {
if ($Line =~ /class=\"about\"/) {
$ICount ++;
} else {
$DCount ++;
print OutFile $Line;
}
} else {
$ICount ++;
}
}
close(InFile) or die "Error closing '$InputFile': $! \n";
close(OutFile) or die "Error closing '$OutputFile': $! \n";
print "\n$LCount lines from $InputFile processed.\n";
print "$DCount lines extracted.\n";
print "$ICount lines ignored.\n\n";
With some lines more much more can be filtered out and the HTML framework is added optional.
But it is still interesting if this can be done similar simple with XSLT ...
In this special case the basic filtering could be done in a shell with a simple grep:
grep "<p" 1.html > out.html
The perl solution is preferred, because more options in the behaviour and filtering can be implemented.

How to Change Font Color with XSLT?

i would like to change the font colour of my title(i managed to give it a black background) into white. I figured i would make a font tag around it, which didn't seem to work. Any help would be appreciated(don't blame me, i am a newbie. And yes, i googled first)
<tr bgcolor="#000000">
<font face="courier" color="white">
<th>Black Components</th>
</font>
</tr>
It appears as a Black window with a black font in it
as a little bonus, if someone could tell me how to change the font style too, that would be amazing
Inside your table or another part of pdf you can use
<fo:block font-weight="bold" color="#ffffff"> your text or somethig else </fo:block>
In modern HTML, it is preferred to use CSS stylesheets instead of things like a bgcolor attribute or a font tag, as those are considered obsolete. The following should help you:
<tr style="background: black;">
<th style="color: white; font-style: italic; font-family: Courier, monospace;">Black Components</th>
</tr>
Professional websites also usually encapsulate such styles into classes so that you don't need to copy these attributes all the time. This would look like:
/* CSS file, e.g. main.css */
.row {
background: black;
}
.column-header {
color: white;
font-style: italic;
font-family: Courier, monospace;
}
<!-- HTML file, should reference main.css with a <link> tag inside <head> -->
<table>
<tr class="row">
<th class="column-header">Header 1</th>
<th class="column-header">Header 2</th>
</tr>
</table>
See also MDN documentation about CSS.

Foundation5 top bar icons and text

I am trying to achieve an iOS kind of look on a Zurb' Foundation 5 top menubar. I would like to have a icon font icon on top and the matching menu description below. Something that would look like this:
This is what I got now:
Having an icon first and following text is trivial with icon fonts:
<div class="contain-to-grid">
<nav class="top-bar" data-topbar>
<ul class="title-area">
<li class="name">
<h1>Site name</h1>
</li>
</ul>
<section class="top-bar-section">
<ul>
<li class="show-for-medium-up" id="people-menu" data-tooltip data-options="disable_for_touch:true" title="People"><i class="fi-results-demographics"></i> <span class="menu-heading"> option 1 </span></li>
<li id="assets-menu" data-tooltip data-options="disable_for_touch:true" title="Assets"><i class="fi-euro"></i> <span class="menu-heading"> option 2 </li>
<li id="documents-menu" data-tooltip data-options="disable_for_touch:true" title="Documents"><i class="fi-page-edit"></i> option 3 </li>
<li id="services-menu" data-tooltip data-options="disable_for_touch:true" title="Services"><i class="fi-info"></i> Option4 </li>
<li class="divider"></li>
<li id="login-menu" data-tooltip data-options="disable_for_touch:true" title="Sign in"><i class="fi-key"></i> </li>
<li id="logout-menu" data-tooltip data-options="disable_for_touch:true" title="Sign out">Example login <i class="icon-bell color6"></i> </li>
</ul>
</section>
Adding a < br > before the span does not help as it breaks the top bar even if span has zero margin/padding in CSS.
How can I get the icon and text stack up nicely above each other?
You'll need to override a few default Foundation styles, but it's definitely possible.
Give these styles a try:
.top-bar ul>li a:not(.button) {
line-height: 1em;
padding-top: 8px;
}
.top-bar ul>li a i {
display: block;
height: 16px;
margin: auto 0;
line-height: 1em;
text-align: center;
}
You'll likely need to adjust both the padding-top, line-height, and icon height values to match your particular design.

XSL If Statement used for when Link is clicked

I have an RSS feed being pulled through XSLT on an .xsl file. I have a "Show" Link that when clicked displays a hidden DIV with an Iframe that has the source of the unique RSS Item's full page.
The issue is since this DIV is hidden it actually loads all the iframe's source pages when the page is first viewed and boggs down the loading time considerably.
What i want to do is only have the iframe load the source after the "Show" button is clicked. How can i invoke this with an XSLT If Statement?
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:user="urn:my-extension-lib:date">
<xsl:template match="/">
<xsl:for-each select="rss/channel/item">
<div style="margin-bottom: 30px;">
<div style="margin: 5px;">
<div style="font-weight: bold;">
<a href="{link}" target="_blank" style="font-size: 10pt;">
<xsl:value-of select="title" />
</a>
</div>
<div>
<xsl:value-of select="user:GetFormattedDate(pubDate,'MMM d, yyyy hh:mm tt')" />
</div>
</div>
<div style="padding-left:30px">
Show
</div>
<div style="margin: 20px 20px 20px 40px;display:none" id="{guid}">
<iframe width="685" height="400" scrolling="yes" frameborder="yes" src="{link}"></iframe>
</div>
</div>
</xsl:for-each>
</xsl:template>
What I think you need to do is initially load a 'blank' page for each IFRAME. For example, a page called blank.htm, that is empty. Also, you may want to give each IFRAME an ID tag, so you can easily access it with Javascript to change the source
<iframe id="iframe{guid}" width="685" height="400" scrolling="yes" frameborder="yes" src="blank.htm"/>
Then, you can code your javascript like so, to show the DIV, and change the source of the IFRAME to the correct page.
function test(id, link)
{
document.getElementById(id).style.display = 'block';
document.getElementById("iframe" + id).src = link;
}
Here's an example of the whole stylesheet for you
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Test</title>
<script>
function test(id, link)
{
document.getElementById(id).style.display = 'block';
document.getElementById("iframe" + id).src = link;
}
</script>
</head>
<body>
<xsl:for-each select="rss/channel/item">
<div style="margin-bottom: 30px;">
<div style="margin: 5px;">
<div style="font-weight: bold;">
<a href="{link}" target="_blank" style="font-size: 10pt;">
<xsl:value-of select="title"/>
</a>
</div>
<div>
<xsl:value-of select="pubDate"/>
</div>
</div>
<div style="padding-left:30px">
Show
</div>
<div style="margin: 20px 20px 20px 40px;display:none" id="{guid}">
<iframe id="iframe{guid}" width="685" height="400" scrolling="yes" frameborder="yes" src="blank.htm"/>
</div>
</div>
</xsl:for-each>
</body>
</html>
</xsl:template>
</xsl:stylesheet>