Add superscript tag dynamically

Avatar

Avatar

samr99530769

Avatar

samr99530769

samr99530769

14-12-2020

All, I have a problem statement where webhe have supposed to show ® as superscript.But this has not been aded by content author so now am trying to update dynamically . Is there any suggested approach

AEM

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar

BrianKasingli

MVP

Avatar

BrianKasingli

MVP

BrianKasingli
MVP

15-12-2020

@samr99530769, you can inject this XML block into your touchUI cq_dialog.xml

<subsuperscript
   jcr:primaryType="nt:unstructured"
   features="*"/>

Full list of richText options can be found here, https://gist.github.com/briankasingli/1a7e3e12deaa2e076645b09d30039b46

 

Answers (3)

Answers (3)

Avatar

Avatar

vanegi

Employee

Avatar

vanegi

Employee

vanegi
Employee

15-12-2020

Hi @samr99530769

You can install the package that contains a Touch UI component that uses the RTE including superscript tag plugin as described in below documentation link. 

 

More details at:

https://helpx.adobe.com/experience-manager/using/touchUI_RTE_configure.html#:~:text=You%20can%20crea...

 

Thanks!!

Avatar

Avatar

KiranVedantam1992

Avatar

KiranVedantam1992

KiranVedantam1992

14-12-2020

Superscript is a plugin that is available in RTE. You can enable and author it as per your requirement.

 

Advantages:

Authoring activity

No code changes

One time activity

No technical knowledge needed

 

Disadvantages:

Time-consuming

 

Reference: https://experienceleague.adobe.com/docs/experience-manager-65/administering/operations/rich-text-edi...

 

If you want to add it programmatically, you need to search the nodes that need the tag to be added and update the node.

 

Pros:

Less time consuming

 

Cons:

Depending upon the content, the updation might take time and might impact the server performance

As this is one-time activity (hopefully) the code is useless next time

 

Thanks,

Kiran Vedantam

Avatar

Avatar

shelly-goel

MVP

Avatar

shelly-goel

MVP

shelly-goel
MVP

14-12-2020

@samr99530769  To update the content programmatically, you can create a custom servlet which can take content path as input and then using QueryBuilder/ QueryManger find all the nodes under the specified path that contains the character to be superscripted.

Iterate through the list of nodes and parse the "text" property and update the property adding <sup> </sup> tags around the character using string operations. Save the node and replicate if needed.

Query would be something like this: SELECT * FROM [nt:base] AS s WHERE ISDESCENDANTNODE([/content/<your-site-path>]) and CONTAINS(s.*, '<string to be superscripted>')