Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
<!doctype html>
<html lang="und" dir="auto" xmlns="http://www.w3.org/1999/xhtml" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office">

<head>
<title></title>
<!--[if !mso]><!-->
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<!--<![endif]-->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<style type="text/css">
#outlook a {
padding: 0;
}

body {
margin: 0;
padding: 0;
-webkit-text-size-adjust: 100%;
-ms-text-size-adjust: 100%;
}

table,
td {
border-collapse: collapse;
mso-table-lspace: 0pt;
mso-table-rspace: 0pt;
}

img {
border: 0;
height: auto;
line-height: 100%;
outline: none;
text-decoration: none;
-ms-interpolation-mode: bicubic;
}

p {
display: block;
margin: 13px 0;
}
</style>
<!--[if mso]>
<noscript>
<xml>
<o:OfficeDocumentSettings>
<o:AllowPNG/>
<o:PixelsPerInch>96</o:PixelsPerInch>
</o:OfficeDocumentSettings>
</xml>
</noscript>
<![endif]-->
<!--[if lte mso 11]>
<style type="text/css">
.mj-outlook-group-fix { width:100% !important; }
</style>
<![endif]-->
<!--[if !mso]><!-->
<link href="https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700" rel="stylesheet" type="text/css">
<style type="text/css">
@import url(https://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700);
</style>
<!--<![endif]-->
<style type="text/css">
@media only screen and (min-width:480px) {
.mj-column-px-300 {
width: 300px !important;
max-width: 300px;
}
}
</style>
<style media="screen and (min-width:480px)">
.moz-text-html .mj-column-px-300 {
width: 300px !important;
max-width: 300px;
}
</style>
</head>

<body style="word-spacing:normal;">
<div aria-roledescription="email" role="article" lang="und" dir="auto">
<!--[if mso | IE]><table align="center" border="0" cellpadding="0" cellspacing="0" class="" role="presentation" style="width:600px;" width="600" ><tr><td style="line-height:0px;font-size:0px;mso-line-height-rule:exactly;"><![endif]-->
<div style="margin:0px auto;max-width:600px;">
<table align="center" border="0" cellpadding="0" cellspacing="0" role="presentation" style="width:100%;">
<tbody>
<tr>
<td style="direction:ltr;font-size:0px;padding:20px 0;text-align:center;">
<!--[if mso | IE]><table role="presentation" border="0" cellpadding="0" cellspacing="0"><tr><td class="" style="vertical-align:top;width:300px;" ><![endif]-->
<div class="mj-column-px-300 mj-outlook-group-fix" style="font-size:0px;text-align:left;direction:ltr;display:inline-block;vertical-align:top;width:50%;">
<table border="0" cellpadding="0" cellspacing="0" role="presentation" style="vertical-align:top;" width="100%">
<tbody>
<tr>
<td align="left" style="font-size:0px;padding:10px 25px;word-break:break-word;">
<div style="font-family:Ubuntu, Helvetica, Arial, sans-serif;font-size:13px;line-height:1;text-align:left;color:#000000;">Column with pixel width and mobile-width</div>
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</td>
</tr>
</tbody>
</table>
</div>
<!--[if mso | IE]></td></tr></table><![endif]-->
</div>
</body>

</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<mjml>
<mj-body>
<mj-section>
<mj-column mobile-width="mobile-width" width="300px">
<mj-text>Column with pixel width and mobile-width</mj-text>
</mj-column>
</mj-section>
</mj-body>
</mjml>
3 changes: 2 additions & 1 deletion packages/mrml-core/src/mj_column/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ impl<'root> Renderer<'root, MjColumn, MjColumnExtra<'root>> {
} else if width.is_pixel() {
self.container_width
.as_ref()
.map(|w| Size::percent(width.value() / w.value()))
.map(|w| Size::percent(width.value() / w.value() * 100.0))
} else {
None
}
Expand Down Expand Up @@ -367,4 +367,5 @@ mod tests {
crate::should_render!(width, "mj-column-width");
// issues
crate::should_render!(border_issue_466, "mj-column-border-issue-466");
crate::should_render!(mobile_width_pixel, "mj-column-mobile-width-pixel");
}
1 change: 0 additions & 1 deletion packages/mrml-wasm/examples/browser/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
},
"devDependencies": {
"vite": "^8.0.8",
"vite-plugin-top-level-await": "^1.5.0",
"vite-plugin-wasm": "^3.4.1"
}
}
2 changes: 0 additions & 2 deletions packages/mrml-wasm/examples/browser/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import wasm from "vite-plugin-wasm";
import topLevelAwait from "vite-plugin-top-level-await";
import { defineConfig } from 'vite';

// https://vitejs.dev/config/
export default defineConfig({
plugins: [
wasm(),
topLevelAwait(),
],
build: {
target: 'esnext',
Expand Down
13 changes: 12 additions & 1 deletion scripts/update-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,24 @@ const cleanup = (content) => {
);
};

const fixMjmlInput = (content) => {
// mjml 4.x has a camelCase bug: getMobileWidth checks
// getAttribute('mobileWidth') !== 'mobileWidth', but the XML parser keeps
// the value as-is ("mobile-width"). Rewrite to the camelCase form so that
// the pixel-to-percent code path actually triggers.
return content.replace(
/mobile-width="mobile-width"/g,
'mobileWidth="mobileWidth"',
);
};

const handleFile = (dir, fname) => {
console.log(`👉 starting ${dir}/${fname}`);
return fsp
.readFile(`${dir}/${fname}.mjml`, { encoding: "utf8" })
.then((content) => {
console.log(`⌛️ converting ${dir}/${fname}.mjml`);
return mjml2html(content).html;
return mjml2html(fixMjmlInput(content)).html;
})
.then(pretty)
.then(cleanupIds)
Expand Down
Loading