question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to tell if a given tag name is a block tag?

See original GitHub issue

Given a tag name, how can I pro-grammatically tell if the tag is a block tag?

“Blocks” are tags that contain a block of template code which is delimited by a {% end<TAGNAME> %} tag.

In Ruby Liquid, I can do it with the following code:

Liquid::Template.tags[tag_name].ancestors.include?(Liquid::Block)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
harttlecommented, Feb 22, 2019

I’m considering introduce a BlockTag type, for which liquid automatically parse until the corresponding end tag. Then you can test the type either by instanceof or .type property.

0reactions
harttlecommented, Mar 10, 2019

Since there’s no plan to support this, closing.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Block-level elements - HTML: HyperText Markup Language
In this article, we'll examine HTML block-level elements and how they differ from inline-level elements.
Read more >
How to detect if an in memory DOM element is a block element?
The only way I see to do what you're describing is to hardcode the list of phrasing-only element types and check the tag...
Read more >
HTML Block and Inline Elements - W3Schools
A block-level element always starts on a new line, and the browsers automatically add some space (a margin) before and after the element....
Read more >
Block and Inline Elements
You can now wrap links around block level elements. An example makes this clear. It's common to mark up the name of the...
Read more >
Getting block tag names - Autodesk Community - AutoCAD
It verifies that selected entity IS a block and HAS some attributes. ... (with drop-down list) to select one from these found tag...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found