Skip to content

Graph parse bug #1590

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Aug 19, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Fixed a bug that was causing the focus info popup to appear blank
- Fixed a bug on the generate page causing extraneous ellipses to appear when hovering over a course to highlight its prerequisites
- Fixed a bug on the generate page where an extraneous info popup would appear when hovering over the top left corner of the graph viewing window
- Fixed a bug that led code to crash when parsing all pre-generated graphs from svg (i.e., program graphs)

### 🔧 Internal changes

Expand Down
43 changes: 24 additions & 19 deletions app/Svg/Parser.hs
Original file line number Diff line number Diff line change
Expand Up @@ -182,26 +182,31 @@ parseTextHelper :: GraphId -- ^ The Text's corresponding graph identifier.
-> [Text]
parseTextHelper _ _ _ _ [] = []
parseTextHelper key styles' trans globalTrans (headTag:restTags) =
let [[a, c, e], [b, d, f], _] = completeTrans
in [Text key
(fromAttrib "id" headTag) -- TODO: Why are we setting an id?
(readAttr "x" headTag, readAttr "y" headTag)
(TS.escapeHTML $ trim $ TS.innerText (headTag:restTags))
align
fill
[a, b, c, d, e, f]
]
if not $ any (TS.isTagOpenName "tspan") restTags
then
let [[a, c, e], [b, d, f], _] = completeTrans
in [Text key
(fromAttrib "id" headTag) -- TODO: Why are we setting an id?
(readAttr "x" headTag, readAttr "y" headTag)
(TS.escapeHTML $ trim $ TS.innerText (headTag:restTags))
align
fill
[a, b, c, d, e, f]
]
else
let tspanTags = TS.partitions (TS.isTagOpenName "tspan") (headTag:restTags)
in
concatMap (parseTextHelper key newStyle newTrans globalTrans) tspanTags
where
newStyle = styles headTag ++ styles'
currTrans = getTransform headTag
newTrans = matrixMultiply trans currTrans
completeTrans = matrixMultiply globalTrans newTrans
alignAttr = styleVal "text-anchor" newStyle
align = if T.null alignAttr
then "start"
else alignAttr
fill = styleVal "fill" newStyle

newStyle = styles headTag ++ styles'
currTrans = getTransform headTag
newTrans = matrixMultiply trans currTrans
completeTrans = matrixMultiply globalTrans newTrans
alignAttr = styleVal "text-anchor" newStyle
align = if T.null alignAttr
then "start"
else alignAttr
fill = styleVal "fill" newStyle

-- | Create a rectangle from a list of attributes.
parseRect :: Matrix
Expand Down