This gem was last updated on the 01.11.2022 (dd.mm.yyyy notation), at 19:20:59 o'clock.

New ideas (playground)

We could replace:

<button onclick="show_source()">Click me</button>

With:

button.text('Click me').onclick('show_source')

This is currently not implemented, though. Need to think more about it first.

Using HTML headers

The following example shows how to use the h1 tag:

HtmlTags.h1('Hello world!') # => "<h1>\nHello world!\n</h1>"

You can include the module HtmlTags. Then you can just type h1().

Another example:

puts HtmlTags.div("Hello, #{name}") # => <div>Hello, 2</div>

HtmlTags.a

The HTML a tag is for hyperlinks; typically it contains a href entry.

You can pass a Hash, too, including a few supported JavaScript functions.

Example for the latter:

onclick: 'change_the_colour_to()'

Note that you still have to write the function somewhere and pull it into the .html file (or .cgi file or whatever else you are using). I added support for this in October 2021, as I needed to have clickable links that change colour upon being clicked. I used that to memorize which links I clicked, without having to depend on CSS.

Objectified HTML Tags

This is mostly for clarification. An objectified HTML tag is a HTML tag that can be used like an object.

Example:

Span.new('Hello world!') # => <span>Hello world!</span>

The html_tags gem currently does not support this, but support for this may be added in the future, depending on whether that use case turns out to be sufficiently useful.

How to use HtmLTags.a()

Usage example:

HtmlTags.a(
  remote_url: remote_url,
  text: title?.to_s,
  css_style: 'font-weight: bold; color: darkblue'
)

Contact information and mandatory 2FA coming up in 2022

If your creative mind has ideas and specific suggestions to make this gem more useful in general, feel free to drop me an email at any time, via:

shevy@inbox.lt

Before that email I used an email account at Google gmail, but in 2021 I decided to slowly abandon gmail for various reasons. In order to limit this explanation here, allow me to just briefly state that I do not feel as if I want to promote any Google service anymore, for various reasons.

Do keep in mind that responding to emails may take some time, depending on the amount of work I may have at that moment.

In 2022 rubygems.org decided to make 2FA mandatory for every gem owner: see https://blog.rubygems.org/2022/06/13/making-packages-more-secure.html

As I can not use 2FA, for reasons I will skip explaining here (see various github issue discussions in the past), this effectively means that Betty Li and others who run the show at rubygems.org will perma-ban me from using rubygems as a developer.

As I disagree with that decision completely, this will mean that all my gems will be removed from rubygems.org prior to that sunset date, e. g. before they permanently lock me out from the code that I used to maintain. It is pointless to want to discuss this with them anymore - they have made up their minds and decided that you can only use the code if 2FA is in place, even though the code itself works just fine. If you don't use 2FA you are effectively locked out from your own code; I consider this a malicious attack. See also how they limited discussions to people with mandatory 2FA on the ruby-bugtracker, thus banning everyone permanently without 2FA:

https://bugs.ruby-lang.org/issues/18800

Guess it may indeed be time to finally abandon ruby - not because ruby is a bad language, but there are people now in charge who really should not be part of ruby in the first place.