@@ 112,6 112,14 @@ loadUserStyles styles = do
CSS.parse style (Txt.pack source) `loadFiles` files
loadFiles style [] = return style
+targetSel "" = [CSSTok.Ident "main"]
+targetSel ('#':id) = [CSSTok.Hash CSSTok.HUnrestricted $ Txt.pack id]
+targetSel _ = []
+
+rhapsodePseudoFilter url = CSSPseudo.addRewrite "link" "[src], [href]" $
+ CSSPseudo.addRewrite' "target" (targetSel $ uriFragment url) $
+ CSSPseudo.htmlPsuedoFilter Style.queryableStyleSheet
+
--------
---- Download assets
--------
@@ 137,7 145,7 @@ c_renderDoc c_session c_page rewriteURLs = do
session <- deRefStablePtr c_session
page <- deRefStablePtr c_page
css' <- retreiveStyles session $ css page
- let pseudoFilter = CSSPseudo.htmlPsuedoFilter Style.queryableStyleSheet
+ let pseudoFilter = rhapsodePseudoFilter $ url page
qCSS <- if rewriteURLs then do
assets <- downloadAssets session [
"audio/vnd.wav"