Skip to main content
Legend
June 13, 2024
Question

Script to remove Inline Formatting after import of HTML files?

  • June 13, 2024
  • 6 replies
  • 595 views

Hi there,

I am going to move a lot of HTML files created with a different tool to RH 2022.2.22 (I might even be using the newest version, but thats the one that is currently running stable for my current projects).

Most of the cleanup can be accomplished using RegEx, but I am wondering if there is some Script already existing to remove all Inline Formatting spans? Or do I have to ask some js developer?

What I want to do achieve is to somehow automatize these steps: Open topic, select all, remove inline formatting.

The setting in the project options to not allow inline formatting does not seem to have any impact on imported html files.

Any ideas welcome!

Thanks

Karin

    This topic has been closed for replies.

    6 replies

    Community Expert
    June 26, 2024

    Scripting was redone in RH New UI, so the ExtendScript that was available in Classic can't be used any more.  I think you have to use javascript libraries like electron etc now, but it's not really documented anywhere. there's a RH 2019 scripting guide which is outdated and inadequate and doesn't mention the libraries that are available by default or what is necessary to use others, but if you want to have a look, it's available from the Appendix in the online help.

    Legend
    June 14, 2024

    Thank you Rick! Thats good to know. I'll talk to a developer colleague and try to get something scripted to clean up the files before importing them.

    Thanks for your help!

    Karin

    Legend
    June 13, 2024

    Thanks anyway. It was worth a try 🙂

    frameexpert
    Community Expert
    Community Expert
    June 13, 2024

    ExtendScript has File and Folder objects that let you loop through a folder of file and open each one. I am not sure if Clear Formatting is available in ExtendScript, but a regular expression could be applied. If you want me to look at this, please send me a before/after sample offlist. Thank you. rick at frameexpert dot com

    Peter Grainge
    Community Expert
    Community Expert
    June 13, 2024

    Sorry but I've nothing better to offer.

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.
    Legend
    June 13, 2024

    Clear formatting does exactly what I want. My problem is, that I have to open each file to do so. I would prefer this to be automated instead of manually opening several hundred files. 

    Peter Grainge
    Community Expert
    Community Expert
    June 13, 2024

    In theory if you select all the content in a topic, the Clear Formatting icon (T shape top right) on the Content Properties should do it.

     

    I think the don't allow option is only when creating content, not existing topics with such styling.

     

    Plan B will be copy and then paste back using CTRL SHIFT V. That removes all styling. It makes a mess of tables but you'll soon see it's not impossible to recover them. Also images will get lost. Perhaps call it Plan D. 🙂

    ________________________________________________________

    My site www.grainge.org includes many free Authoring and RoboHelp resources that may be of help.

     

    Use menu (bottom right) to mark as Best Answer or to Highlight particularly useful replies. Found the answer elsewhere? Share it here.