post

206 JSJ PostCSS with Ben Briggs

02:30 - Ben Briggs

03:03 - PostCSS

07:16 - What problems was PostCSS designed to solve for developers?

09:46 - Using PostCSS vs Sass

14:02 - Using Future Features

16:28 - Tool Fatigue

23:39 - When should people start thinking about using PostCSS?

31:24 - Postprocessing

33:43 - Shipping Apps with Emojis?

36:21 - Where does PostCSS end and where does css-modules begin?

Picks

Chet Corcos: Functional Programming for JavaScript People (Aimee)
Operation Code Scholarship (Aimee)
Web Platform Daily Digest (Ben)
Cadbury Caramel Eggs (Joe)
Hello World Podcast (Joe)
React Rally (Dave)




post

JSJ 429: Learning about Postman with Joyce Lin

JavaScript Remote Conf 2020

May 13th to 15th - register now!

Join us as we talk to Joyce Lin, a developer relations advocate with Postman, and we talk about this amazing tool for interacting with APIs. We discuss it’s more well-known features, and also learn about other less well known, but very powerful features that allow users to greatly increase the usefulness of the tool, both for front end and back end developers.

Panel

  • Aimee Knight
  • Steve Edwards

Guest

  • Joyce Lin

Sponsors

____________________________________________________________

"The MaxCoders Guide to Finding Your Dream Developer Job" by Charles Max Wood is now available on Amazon. Get Your Copy Today!

____________________________________________________________

Links

Picks

Steve Edwards:

Joyce Lin:

Follow JavaScript Jabber on Twitter > @JSJabber




post

You should see yourself [electronic resource] : Jewish identity in postmodern American culture / edited by Vincent Brook




post

A young Dutchman views post-Civil War America [electronic resource] : diary of Claude August Crommelin / Claude August Crommelin ; translated by Augustus J. Veenendaal, Jr. ; edited with an introduction by Augustus J. Veenendaal, Jr., and H. Roger Grant

Crommelin, Claude August, 1840-1874




post

Youngest recruits [electronic resource] : pre-war, war & post-war experiences in Western Côte d'Ivoire / Magali Chelpi-den Hamer

Chelpi-den Hamer, Magali




post

Youth employment in Sierra Leone [electronic resource] : sustainable livelihood opportunities in a post-conflict setting / Pia Peeters ... [et al.]




post

Youth prolonged [electronic resource] : old age postponed / Robert Weale

Weale, R. A. (Robert Alexander)




post

Living lightly : travels in post-consumer society / Walter and Dorothy Schwarz

Schwarz, Walter, 1930-




post

Decolonizing nature [electronic resource] : strategies for conservation in a post-colonial era / edited by William M. Adams and Martin Mulligan




post

Plasticizers derived from post-consumer PET: research trends and potential applications / Ewa Langer, Krzysztof Bortel, Marta Lenartowicz-Klik, Sylwia Waskiewicz

Online Resource




post

Compostable polymer materials / Ewa Rudnik

Online Resource




post

Paul's utilization of preformed traditions in 1 Timothy : an evaluation of the apostle's literary, rhetorical, and theological tactics / Mark M. Yarbrough

Yarbrough, Mark M., author




post

Abraham our father : Paul and the ancestors in postcolonial Africa / Israel Kamudzandu

Kamudzandu, Israel, author




post

The ministry of Paul the Apostle : history and redaction / G. Roger Greene

Greene, G. Roger, 1944- author




post

The doubt of the apostles and the resurrection faith of the early church : the post-resurrection appearance stories of the Gospels in ancient reception and modern debate / J.D. Atkins

Atkins, J. D., 1976- author




post

The Gospel of Mary of Magdala : Jesus and the first woman apostle / Karen L. King

King, Karen L., author




post

Post-synthetic modification of imine linkages of a covalent organic framework for its catalysis application

RSC Adv., 2020, 10,17396-17403
DOI: 10.1039/D0RA02142C, Paper
Open Access
  This article is licensed under a Creative Commons Attribution 3.0 Unported Licence.
Qianqian Yan, Huanjun Xu, Xuechao Jing, Hui Hu, Shenglin Wang, Chaoyuan Zeng, Yanan Gao
A new approach for post-synthetic modification of covalent organic frameworks has been developed based on the modification of the linkages and the resulting COF exhibited excellent catalytic performance towards cycloaddition of epoxides and CO2.
The content of this RSS Feed (c) The Royal Society of Chemistry




post

Effects of ozone treatment on SOD activity and genes in postharvest cantaloupe

RSC Adv., 2020, 10,17452-17460
DOI: 10.1039/D0RA00976H, Paper
Open Access
Huijie Zhang, Xiaojun Zhang, Chenghu Dong, Na Zhang, Zhaojun Ban, Li Li, Jinze Yu, Yunfeng Hu, Cunkun Chen
Ozone has been shown to play a positive role in the storage and preservation of agricultural products.
The content of this RSS Feed (c) The Royal Society of Chemistry




post

Using HTML5 elements in WordPress post content

Here are two ways to include HTML5 elements in your WordPress post content without WordPress’ wpautop function wrapping them in p tags or littering your code with line breaks.

HTML5 has several new elements that you may want to use in your post content to markup document sections, headers, footers, pullquotes, figures, or groups of headings. One way to safely include these elements in your posts is simple; the other way is a bit more complicated. Both ways rely on hand-coding the HTML5 markup in the WordPress editor’s HTML view.

If you are adding HTML5 elements to your post content then you should use an HTML5 doctype.

Disable wpautop for your theme

This is the simple way. Disable the wpautop function so that WordPress makes no attempt to correct your markup and leaves you to hand-code every line of your posts. If you want total control over every line of your HTML then this is the option for you.

To disable wpautop entirely add these lines to your theme’s functions.php:

remove_filter('the_excerpt', 'wpautop');
remove_filter('the_content', 'wpautop');

However, wpautop is generally quite useful if most of your posts are simple text content and you only occasionally want to include HTML5 elements. Therefore, modifying wpautop to recognise HTML5 elements might be more practical.

Modify wpautop to recognise HTML5 elements

WordPress’ wpautop is part of the core functions and can be found in this file within your WordPress installation: wp-includes/formatting.php. It controls how and where paragraphs and line breaks are inserted in excerpts and post content.

In order to create a modified version of WordPress’ core wpautop function I started off by duplicating it in my theme’s functions.php file.

What I’ve experimented with is disabling wpautop and adding a modified copy of it – which includes HTML5 elements in its arrayss – to my theme’s functions.php file.

Add the following to your theme’s functions.php file and you’ll be able to use section, article, aside, header, footer, hgroup, figure, details, figcaption, and summary in your post content. (Probably best to try this in a testing environment first!)

/* -----------------------------
MODIFIED WPAUTOP - Allow HTML5 block elements in wordpress posts
----------------------------- */

function html5autop($pee, $br = 1) {
   if ( trim($pee) === '' )
      return '';
   $pee = $pee . "
"; // just to make things a little easier, pad the end
   $pee = preg_replace('|<br />s*<br />|', "

", $pee);
   // Space things out a little
    // *insertion* of section|article|aside|header|footer|hgroup|figure|details|figcaption|summary
   $allblocks = '(?:table|thead|tfoot|caption|col|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|map|area|blockquote|address|math|style|input|p|h[1-6]|hr|fieldset|legend|section|article|aside|header|footer|hgroup|figure|details|figcaption|summary)';
   $pee = preg_replace('!(<' . $allblocks . '[^>]*>)!', "
$1", $pee);
   $pee = preg_replace('!(</' . $allblocks . '>)!', "$1

", $pee);
   $pee = str_replace(array("
", "
"), "
", $pee); // cross-platform newlines
   if ( strpos($pee, '<object') !== false ) {
      $pee = preg_replace('|s*<param([^>]*)>s*|', "<param$1>", $pee); // no pee inside object/embed
      $pee = preg_replace('|s*</embed>s*|', '</embed>', $pee);
   }
   $pee = preg_replace("/

+/", "

", $pee); // take care of duplicates
// make paragraphs, including one at the end
   $pees = preg_split('/
s*
/', $pee, -1, PREG_SPLIT_NO_EMPTY);
   $pee = '';
   foreach ( $pees as $tinkle )
      $pee .= '<p>' . trim($tinkle, "
") . "</p>
";
   $pee = preg_replace('|<p>s*</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
// *insertion* of section|article|aside
   $pee = preg_replace('!<p>([^<]+)</(div|address|form|section|article|aside)>!', "<p>$1</p></$2>", $pee);
   $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee); // don't pee all over a tag
   $pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
   $pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
   $pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
   $pee = preg_replace('!<p>s*(</?' . $allblocks . '[^>]*>)!', "$1", $pee);
   $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*</p>!', "$1", $pee);
   if ($br) {
      $pee = preg_replace_callback('/<(script|style).*?</\1>/s', create_function('$matches', 'return str_replace("
", "<WPPreserveNewline />", $matches[0]);'), $pee);
      $pee = preg_replace('|(?<!<br />)s*
|', "<br />
", $pee); // optionally make line breaks
      $pee = str_replace('<WPPreserveNewline />', "
", $pee);
   }
   $pee = preg_replace('!(</?' . $allblocks . '[^>]*>)s*<br />!', "$1", $pee);
// *insertion* of img|figcaption|summary
   $pee = preg_replace('!<br />(s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol|img|figcaption|summary)[^>]*>)!', '$1', $pee);
   if (strpos($pee, '<pre') !== false)
      $pee = preg_replace_callback('!(<pre[^>]*>)(.*?)</pre>!is', 'clean_pre', $pee );
   $pee = preg_replace( "|
</p>$|", '</p>', $pee );

   return $pee;
}

// remove the original wpautop function
remove_filter('the_excerpt', 'wpautop');
remove_filter('the_content', 'wpautop');

// add our new html5autop function
add_filter('the_excerpt', 'html5autop');
add_filter('the_content', 'html5autop');

The results are not absolutely perfect but then neither is the original wpautop function. Certain ways of formatting the code will result in unwanted trailing </p> tags or a missing opening <p> tags.

For example, to insert a figure with caption into a post you should avoid adding the figcaption on a new line because an image or link appearing before the figcaption will end up with a trailing </p>.

<!-- this turns out ok -->
<figure>
  <a href="#"><img src="image.jpg" alt="" /></a><figcaption>A figure caption for your reading pleasure</figcaption>
</figure>

<!-- this turns out not so ok -->
<figure>
  <a href="#"><img src="image.jpg" alt="" /></a>
  <figcaption>A figure caption for your reading pleasure</figcaption>
</figure>

Another example would be when beginning the contents of an aside with a paragraph. You’ll have to leave a blank line between the opening aside tag and the first paragraph.

<aside>

This content could be a pullquote or information that is tangentially related to the surrounding content. But to get it wrapped in a paragraph you have to leave those blank lines either side of it before the tags.

</aside>

Room for improvement

Obviously there are still a few issues with this because if you format your post content in certain ways then you can end up with invalid HTML, even if it doesn’t actually affect the rendering of the page. But it seems to be pretty close!

Leave a comment or email me if you are using this function and find there that are instances where it breaks down. I ran numerous tests and formatting variations to try and iron out as many problems as possible but it’s unlikely that I tried or spotted everything.

Hopefully someone with more PHP and WordPress experience will be able to improve upon what I’ve been experimenting with, or find a simpler and more elegant solution that retains the useful wpautop functionality while allowing for the use of HTML5 elements in posts. Please share anything you find!




post

Coronavirus | Assam rights activist held for social media post

Rupa Rani Bhuyan, assistant professor of Mangaldoi College, was held for “misbehaving” with the police and “obstructing” them from investigating cases against her




post

JAMA Neurology : Effect of Dextroamphetamine on Poststroke Motor Recovery

Interview with Larry B. Goldstein, MD, author of Effect of Dextroamphetamine on Poststroke Motor Recovery: A Randomized Clinical Trial










post

RBL Bank declines 12% from day's high in a firm market post Q4 results

The bank's total revenue jumped 33 per cent YoY to Rs 1,522 crore from Rs 1,148 crore reported in Q4FY19, while its net interest income came in at Rs 1,021 crore, up 38 per cent YoY from Rs 739 crore




post

US President Barack Obama appoints Indian-American executive Ajay Banga to key administrative post



  • DO NOT USE Indians Abroad
  • World

post

Indian-American appointed to key federal aviation post



  • DO NOT USE Indians Abroad
  • World

post

US President Barack Obama re-nominates Indian-American Sunil Sabharwal to key administration post



  • DO NOT USE Indians Abroad
  • World

post

Barack Obama names Indian-American Yale professor to key admin post



  • DO NOT USE Indians Abroad
  • World

post

Cricket will witness changes post pandemic: Tendulkar

But with increased focus on social distancing and personal hygiene to contain the spread of the virus, the sport stares at a changing landscape.







post

Postdoctoral Researcher in Theory of Superconducting Quantum Simulations: University of Oulu

£Attractive: University of Oulu
For more latest jobs and jobs in Finland visit brightrecruits.com




post

Postdoctoral Researcher in Data Driven Prediction and Interpretation of Spectra, Applications in Climate Research: University of Oulu

£Attractive: University of Oulu
For more latest jobs and jobs in Finland visit brightrecruits.com







post

MPK / MPI-SD Joint Postdoctoral Position for Ultrafast Nonlinear Spectroscopy in Solids (Theory): POSTECH / Max Planck POSTECH/KOREA Res. Init.

£Attractive: POSTECH / Max Planck POSTECH/KOREA Res. Init.
For more latest jobs and jobs in Korea, Republic Of visit brightrecruits.com




post

The political campaign industry and the emergence of social media in post-authoritarian Indonesian electoral politics / Muninggar Sri Saraswati

Saraswati, Muninggar Sri, author




post

Employment and re-industrialisation in post Soeharto Indonesia / Mohammad Zulfan Tadjoeddin, Anis Chowdhury

Tadjoeddin, Mohammad Zulfan, author




post

The end of UMNO? : essays on Malaysia's former dominant party : new and expanded post GE-14 edition / editor, Bridget Welsh; contributors, John Funston, Clive Kessler, James Chin, Bridget Welsh; foreword: Saifuddin Abdullah ; post-GE14 foreword: Tengk




post

BASF, Clariant postpone annual meetings




post

Chemical outlook post COVID-19 is bleak

Early earnings figures from chemical makers are down




post

British science gets post-Brexit funding boost

Plans include creation of a high-risk, high-payoff research agency




post

Avian reservoirs [electronic resource] : virus hunters & birdwatchers in Chinese sentinels posts / Frédéric Keck.

Durham : Duke University Press, 2020.




post

Talent demand for remote jobs will continue to rise post lockdown: TimesJobs survey

The survey titled ‘Covid-19 and its impact on jobs at India Inc’ aims to understand the impact of the lockdown on the country’s employment scenario. It received 1,345 responses from HR professionals working in different sectors.