Skip to content

Commit 0984dc1

Browse files
Merge pull request #88 from creativecommons/wp-img-rendering
correct for wordpress specific `img` alignment classes
2 parents c11713a + a315a4d commit 0984dc1

File tree

3 files changed

+146
-3
lines changed

3 files changed

+146
-3
lines changed

src/context/blog-post.html

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,8 @@ <h1>What are the barriers to open culture? Here's what the CC community has to s
111111

112112
</header>
113113

114+
<div class="content">
115+
114116
<aside class="opening">
115117
<p>
116118
<span>part of the</span>
@@ -135,6 +137,11 @@ <h2>Let's Try This Again</h2>
135137

136138
<h3>Along The Way We Try</h3>
137139

140+
<figure>
141+
<img src="../imgs/image.jpg" class="alignright" />
142+
143+
<figcaption class="attribution">"<a href="https://thegreats.co/artworks/the-more-we-share-the-more-we-have-series-22">The More We Share, The More We Have (series 1/2)</a>" by <a href="https://thegreats.co/artists/pietro-soldi">Pietro Soldi</a> for Creative Commons &amp; Fine Acts is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></figcaption>
144+
</figure>
138145

139146
<p>Along with 600 million people, nine-year-old Chris Hadfield is glued to his television&mdash;watching intently as American astronaut Neil Armstrong glides down the ladder of the Lunar Module, and in one swift pounce, touches the dust of a familiar yet alien world. His words forever immortalized, "That's one small step for man, one giant leap for mankind."</p>
140147

@@ -203,6 +210,8 @@ <h2>Tags</h2>
203210
</ul>
204211
</article>
205212

213+
</div>
214+
206215
<article class="posts related">
207216
<h2>Related posts</h2>
208217

@@ -274,8 +283,6 @@ <h3><a href="#">Open Access in Practice: A Conversation with President Larry Kra
274283
</ul>
275284
</article>
276285

277-
278-
279286
</main>
280287

281288
<footer>

src/context/default-page.html

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,12 @@ <h3>Steps to launch</h3>
188188
<li>Land safely</li>
189189
</ol>
190190

191+
<figure>
192+
<img src="../imgs/image.jpg" class="alignright" />
193+
194+
<figcaption class="attribution">"<a href="https://thegreats.co/artworks/the-more-we-share-the-more-we-have-series-22">The More We Share, The More We Have (series 1/2)</a>" by <a href="https://thegreats.co/artists/pietro-soldi">Pietro Soldi</a> for Creative Commons &amp; Fine Acts is licensed under <a href="https://creativecommons.org/licenses/by-sa/4.0/">CC BY-SA 4.0</a></figcaption>
195+
</figure>
196+
191197
<p>For example, Alex G. Orphanos, a science communicator, engineer, and host of the Today in Space podcast, has put NASA's materials to use for over six years. In particular, he has used images from the Hubble Space Telescope and information from NASA Procurement to better explain space-related issues to his audience. Rachael Eidson, a business development specialist for <strong>Trenton Systems</strong> and social media influencer also routinely uses NASA's images in her collaborations with eco-fashion and accessory companies. In fact, it's hard to miss the resurgence of space-themed items, including t-shirts, mugs, bags, etc. featuring NASA's “meatball” logo. As the L.A. Times reported in 2019, “The NASA logo is having a moment.”</p>
192198

193199

src/css/style.css

Lines changed: 131 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,136 @@
456456

457457
/* patches */
458458

459-
main > article figure img, main > figure img {
459+
/* main > article figure img, main > figure img {
460460
width: 100%;
461+
} */
462+
463+
/* Classic Editor TinyMCE WYSIWYG editor image alignment */
464+
/* TODO: port in alignleft and alignright rules here as well? */
465+
main figure:has(img.aligncenter) {
466+
width: 100%;
467+
margin-left: 0;
468+
}
469+
470+
/* Classic Editor TinyMCE WYSIWYG editor image alignment, previous theme's markukp */
471+
/* presently <figure> */
472+
div[id^="attachment_"] {
473+
width: 120%;
474+
margin: 0;
475+
margin-left: -10%;
476+
margin-bottom: 3em;
477+
padding: 0;
478+
float: none;
479+
}
480+
481+
/* presently <img> */
482+
div[id^="attachment_"] img[class^="wp-image"]:not([width]) {
483+
width: 100%;
484+
}
485+
486+
/* presently <span class="attribution> */
487+
div[id^="attachment_"] p[id^="caption-attachment-"] {
488+
display: block;
489+
margin-top: 1em;
490+
font-size: 1em;
491+
}
492+
493+
div[id^="attachment_"].alignleft {
494+
margin-top: 2em;
495+
margin-right: 2em;
496+
margin-left: -10%;
497+
width: 50%;
498+
float: left;
499+
}
500+
501+
div[id^="attachment_"].alignleft:after {
502+
display: block;
503+
content: '';
504+
height: 3em;
505+
clear: both;
506+
}
507+
508+
div[id^="attachment_"].aligncenter {
509+
width: 100%;
510+
511+
margin-left: 0;
512+
}
513+
514+
div[id^="attachment_"].alignright {
515+
margin-top: 2em;
516+
margin-right: -10%;
517+
margin-left: 2em;
518+
width: 50%;
519+
float: right;
520+
}
521+
522+
div[id^="attachment_"].alignright:after {
523+
display: block;
524+
content: '';
525+
height: 2em;
526+
clear: both;
527+
}
528+
529+
main .content div[id^="attachment_"].alignleft {
530+
margin-left: 0;
531+
width: 40%;
532+
}
533+
534+
main .content div[id^="attachment_"].alignright {
535+
margin-right: 0;
536+
width: 40%;
537+
}
538+
539+
main .content figure:has(img.alignleft), .blog-post main figure:has(img.alignleft) {
540+
margin-right: 2em;
541+
margin-left: 0;
542+
width: 40%;
543+
float: left;
544+
}
545+
546+
main .content figure:has(img.alignright), .blog-post main figure:has(img.alignright) {
547+
margin-right: 0;
548+
margin-left: 2em;
549+
width: 40%;
550+
float: right;
551+
}
552+
553+
@media (max-width:400px) {
554+
555+
div[id^="attachment_"].alignleft {
556+
width: 100%;
557+
float: none;
558+
margin: 0;
559+
}
560+
561+
div[id^="attachment_"].alignright {
562+
width: 100%;
563+
float: none;
564+
margin: 0;
565+
}
566+
567+
main .content div[id^="attachment_"].alignleft {
568+
width: 100%;
569+
float: none;
570+
margin: 0;
571+
}
572+
573+
main .content div[id^="attachment_"].alignright {
574+
width: 100%;
575+
float: none;
576+
margin: 0;
577+
}
578+
579+
main .content figure:has(img.alignleft), .blog-post main figure:has(img.alignleft) {
580+
width: 100%;
581+
float: none;
582+
margin: 0;
583+
}
584+
585+
main .content figure:has(img.alignright), .blog-post main figure:has(img.alignright) {
586+
width: 100%;
587+
float: none;
588+
margin: 0;
589+
}
590+
461591
}

0 commit comments

Comments
 (0)