Bug 1033422

Summary: Bug: Code snippets missing
Product: [Community] PressGang CCMS Reporter: Misha H. Ali <mhusnain>
Component: DocBook-builderAssignee: Lee Newson <lnewson>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.2CC: lnewson, mcaspers
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2013-11-24 22:50:06 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
Example of missing code none

Description Misha H. Ali 2013-11-22 04:34:21 UTC
Created attachment 827565 [details]
Example of missing code

Description of problem:

Some code snippets in a guide I'm working on are just disappearing for no reason. If I use a direct link to a topic, the code appears properly but otherwise there are missing bits (see screenshot).

Lee Newson thinks it may be because of the spellchecked hence I've logged it for that component.

Comment 1 Misha H. Ali 2013-11-22 04:35:24 UTC
Set severity to high to request urgent action on this if possible.

Comment 2 Lee Newson 2013-11-22 05:05:54 UTC
I tracked this down to the new custom dictionary popups/highlighting. The problem is caused by the jQuery replaceWith() method on line 2974 of overlay.js.

Since the span text is "<namedCache" this is then parsed in the replaceWith() method, however since it isn't valid HTML it just gets replaced by a empty string.

Comment 3 Lee Newson 2013-11-22 05:23:11 UTC
I've done a partial fix on this, however there is still a low chance that this could still happen for custom dictionary entries that have the following characters:

<
>
"
'
&

Since the git repo hasn't been pushed by the looks of it, here is the change I made to line 2974:

// If the content has changed, ie a dictionary match was found, then update the span
if (textNode.textContent !== fixedText) {
    jQuery(textNode).replaceWith(fixedText);
}

The change should also have a small performance improvement as it's not having to recreate and then replace every span in the book.

Comment 4 Matthew Casperson 2013-11-24 22:45:21 UTC
<pre> and <a> elements are no longer modified by the style guide overlay code.

Comment 6 Lee Newson 2013-11-24 22:50:06 UTC
Marking as closed since Misha verified on IRC that it was working and with the extra fix Matt did it should fix all instances.