#lang racket/base (require racket/dict racket/function racket/list racket/string ; libs (prefix-in easy: net/http-easy) ; html libs html-parsing html-writing ; web server libs net/url web-server/http web-server/dispatchers/dispatch ; my libs "pure-utils.rkt" "xexpr-utils.rkt" "url-utils.rkt" "application-globals.rkt") (provide page-wiki) (module+ test (require rackunit) (define wiki-document '(*TOP* (div (@ (class "mw-parser-output")) (aside (@ (role "region") (class "portable-infobox pi-theme-wikia pi-layout-default")) (h2 (@ (class "pi-item pi-title") (data-source "title")) "Infobox Title") (figure (@ (class "pi-item pi-image") (data-sourec "image")) (a (@ (href "https://static.wiki.nocookie.net/nice-image.png") (class "image image-thumbnail") (title "")) (img (@ (src "https://static.wiki.nocookie.net/nice-image-thumbnail.png") (class "pi-image-thumbnail"))))) (div (@ (class "pi-item pi-data") (data-source "description")) (h3 (@ (class "pi-data-label")) "Description") (div (@ (class "pi-data-value")) "Mystery infobox!"))) (div (@ (data-test-collapsesection) (class "collapsible collapsetoggle-inline collapsed")) (i (b "This section is hidden for dramatic effect.")) (div (@ (class "collapsible-content")) (p "Another page link: " (a (@ (data-test-wikilink) (href "https://test.fandom.com/wiki/Another_Page") (title "Another Page")) "Another Page")))))))) (define (preprocess-html-wiki html) (define (rr* find replace contents) (regexp-replace* find contents replace)) ((compose1 ; fix navbox list nesting ; navbox on right of page has incorrect html "
  • " and the xexpr parser puts the
  • much further up the tree ; add a