Displaying the "Less Than" (<) symbol in our forum (and Dynamic Components)

Continuing the discussion from Definition to the Left Instance to the Right - in Outliner:

@Cadie,

The “Less Than” (LT) symbol causes the mini-editor in the forum software to start looking for allowed HTML tags. It keeps looking until it finds a “Greater Than” (GT) symbol. Once found, it looks at everything between them. If it’s allowed HTML, then it does the indicated action described. But if what it finds isn’t allowed HTML, it doesn’t display anything!

Here’s how I caused the word “indicated” above to appear as strikeout text:
<del>indicated</del>
That was an example of allowed HTML

What you want to do isn’t valid HTML, so we’ve got to find another way. I ran into this in another context (wanting to embed “<” in the description attribute of a Dynamic Component). The solution is use HTML Entities. For oddball characters like £ (if you have only $ on your keyboard), ±, ®, and lots more - as well as the LT symbol, they are how you can display symbols you can’t type - and get around the HTML display rules of the editor. Here’s how I did symbols I’ve already used:
&pound; <-- gave me the sign for the UK monetary unit &plusmn; <-- gave me the plus/minus &reg; <-- gave me the Registered Trademark symbol &lt; <-- gave me the Less Than sign
There are a number of reference pages that list these, just Google “html entities”.

What I’ve shown above is the “short” form - using mnemonics instead of the actual symbol. There is also a “long” form which isn’t mnemonic:
&#163; -- the UK Pound &#177; -- the plus/minus &#174; -- the Registered Trademark &#060; -- the Less Than
Note: ALL of the above cases, mnemonic or not, begin with an Ampersand (“&”) and end with a semicolon (“;”)! Many people when first trying to use these omit the semicolon.

As far as I know, within the forum editor, the mnemonic forms work well, and are much easier to remember. So, your workaround for the Outliner list could have appeared as:
Right Back <Leg>
by entering is as
Right Back &lt;Leg>

So why do I even mention the non-mnemonic? It turns out that the editor for Dynamic Component Attributes has a weird quirk: If you enter the mnemonic form, it replaces it with the actual character. It displays correctly in the Component Options box. But the NEXT time you edit it, it tries to interpret is as HTML and suppresses it (unless it is allowed, valid HTML)! However, if you use the non-mnemonic form, it keeps it as is, and only changes it to the desired character when displayed in the Component Options box. That’s the context where I first learned the HTML entities trick, so I tend to use the non-mnemonic form, even in places the mnemonic form works as expected!

2 Likes

Thanks for the info @sjdorst. I will make sure to use HTML Entities the next time.

You could I think also enter the character between backticks (`) or even the whole text from Outliner.

For the whole text, even better to use three backticks followed immediately by text on a new line, then your text that you don’t was to have mangled, then on a new line after that, three more backticks

The <backticks> work but produce a highlight.

The <HTML Entities> are pure.

1 Like

We used to be able to escape the less than and the greater than characters, within forum text, like this: ( \< and \> ). But escaping these characters is not supposed to work when the Discourse engine switches over to the CommonMark render library.

I know I’ve used these characters escaped many times in the past here. I hope that there is a search and replace feature that replaces my escaped situations with the proper character named entity notation.


See also: meta.discourse.org: Rendering text between < and >

The same quirk applies to the description and title in the 3D warehouse, when typing directly in the edit fields you’re ok, but when managing content by CSV for a featured catalog, HTML -tags are dismissed.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.

Reviving this post… I’m trying to get a + (plus symbol) to appear correctly in Generate Report (GR).
Using quotes on a single attribute kinda works, but if that attribute is references in a CHOOSE() function it throws errors.

Using HTML / Mnemonics will work in a DC value field, but in GR it comes out in raw HTML.
Using CHAR(43) or just a “+” seems to throw errors in the DC and then it won’t come out in GR either.

For example:
att1 = CHOOSE(att2,"+",CHAR(43),"&#43;")

Ideas?

use text as units, and display as text

It’s set as text by default and when I choose to display the attribute it works for that specific attribute.
It’s when I reference that attribute (with the + in it) in another text attribute with concatenate it fails.

I should have shown it like this:

att1 = CHOOSE(att2,"+",CHAR(43),"&#43;")
att2 = a drop down with choices... 
att3 = "1234"
att4 = att3 & att4 

att4 should then show: 1234+ but if fails.

I think it is related to the ‘nested IF’ problem that DC doesn’t evaluate or parses the same as ‘real’ programming languages.
Had some issues with a report for an automated cutter that needed /==/ , or /==\ etc.
I thought to concatenate shouldn’t be that difficult, but ended up by having a list to choose from with all the possible strings assembled , al ready…
DC (dɪˈziːz) :smiley:

have the option for “+” within the formula rather than a reference to stop it being evaluated.

The result is text and displayed as text initially in the options dialog as a seen attribute, then set to “users cannot see…” this assures the correct display in the report writer.
this technique is required to display metric units too (End user’s model units) other wise they are evaluated as inches

test.skp (23.3 KB)

Thanks for the suggestions. Unfortunately ‘no referencing’ is not a practical solution for the component I’m working on. There are so many conditionals until I reach the + sign, it would be ridiculous to add it to the original formula.

I guess I’ll have to resort to using some other creative symbol or text instead.

SUBSTITUTE(text,searchText,newText,occurrence) works in the final

test.skp (23.4 KB)

That’s a nice solution, but in my DC it’s still throwing errors. Probably because of multiple references. I tried using the substitute function in different levels but still no go. I’ll try to upload a better representation of my DC later.

you could PM it if require sensitivity

Well to answer the topic title with respect to the forum, you can just escape the less than symbol with a backslash … ie, \> will render as >.

OH! … I guess I already answered this above. (Apologies.)

IMO, The use in the forum has nothing to do with use in DCs and the two discussions should have been separate.