• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Code Scanning in RoboHelp 2020?

New Here ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

Is there a code scan in RoboHelp (i.e., looking for empty tags, multiple span tags on content, etc.)?    

 

I've been noticing when our team has edited, we are getting these types of code issues and looking for a quick way to find them and fix them without having to review the code line by line.   

 

Vicki5E13_0-1714578463450.png

 

Views

80

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

How are they editing? Not something I have seen that bad. 

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

 

Help others by clicking Correct Answer if the question is answered. Found the answer elsewhere? Share it here. "Upvote" is for useful posts.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
May 01, 2024 May 01, 2024

Copy link to clipboard

Copied

Not that I've ever heard of - that mess looks like residual Word cruft. As Peter asks, "how are they editing"?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
May 02, 2024 May 02, 2024

Copy link to clipboard

Copied

Afraid not, it's best to design structural rules to catch these things.

In this case, the rule seems rather simple from a programming point of view.

 

  1. Find all <span> tags in the topic.
  2. For each <span> tag, check if they have actual content.
  3. If false, remove <span> tag.

 

Or in actual code:

import os
from bs4 import BeautifulSoup

project_folder = 'C:\\Users\\XXX\\XXX\\GitHub\\RH\\Projects\\XXX\\contents'

def getLinks(project_folder):

    htm_files = []

    for root, dirs, files in os.walk(project_folder, topdown=False):
        for name in files:
            if name.endswith('.htm') or name.endswith('.hts'):
            htm_files.append(os.path.join(root, name))
    return htm_files

htm_files = getLinks(project_folder)

for htm_file in htm_files:
    with open(htm_file, 'r', encoding='utf-8') as file:
        data = file.read()
    soup = BeautifulSoup(data, 'html.parser')

    spans = soup.find_all('span')
    changes_were_made = False # to prevent saving every single file in project

    for span in spans:
        if len(span.contents) < 1:
            changes_were_made = True
            span.extract()

    if changes_were_made:
        with open(htm_topic, 'w', encoding='utf-8') as file:
            file.write(str(soup))

 

As you encounter more and more issues, the number of rules will expand. On our end, we have about a dozen or so rules at the moment.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
May 02, 2024 May 02, 2024

Copy link to clipboard

Copied

LATEST

Thanks!   Didn't think of that.    

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Resources
RoboHelp Documentation
Download Adobe RoboHelp