Simon-Initiative / course-digest

Tool to produce a summary or digest of OLI course package contents
MIT License
2 stars 0 forks source link

[ENHANCEMENT] strip id qualifiers from DND stylesheets [MER-2518] #193

Closed andersweinstein closed 1 year ago

andersweinstein commented 1 year ago

The Drag-and-Drops in the PC Hardware family of courses include stylesheets using element-id-qualified styles of the form

#dpch01_lbd08 table, #dpch01_lbd08 th, #dpch01_lbd08 td {
                border: 1px solid black;
                text-align:center;
                vertical-align:middle;
            }

These ids are not used on any parent element in the torus implementation, so these styles have no effect, preventing the implementation from working at all (b/c target table cells wind up having zero height.)

Rather than force author to fix all occurrences, this has digest tool detect and strip these ids from stylesheets.

Note detection by regex match relies on heuristic, the presence of an underscore, to distinguish ids from hex color specs of the form #ffe that may also occur within the stylesheet string. This is good enough for the cases we have to deal with, which follow this naming convention.

Also strips "all: initialize" which same stylesheets often included since it causes problems.