indie wikis: add Wapopedia/Drawn To Life
This commit is contained in:
		
							parent
							
								
									501dcaa3fc
								
							
						
					
					
						commit
						155a277f26
					
				
					 2 changed files with 16 additions and 11 deletions
				
			
		|  | @ -60,11 +60,11 @@ | ||||||
|     (if (null? rest) |     (if (null? rest) | ||||||
|         `(cond ,@els) |         `(cond ,@els) | ||||||
|         `(cond |         `(cond | ||||||
|           ,@els |            ,@els | ||||||
|           [#t |            [#t | ||||||
|            (let ,(for/list ([var vars]) |             (let* ,(for/list ([var vars]) | ||||||
|                    (cdr var)) |                      (cdr var)) | ||||||
|              ,(transform-cond/var rest))])))) |               ,(transform-cond/var rest))])))) | ||||||
| 
 | 
 | ||||||
| ;; the syntax definitions and their tests go below here | ;; the syntax definitions and their tests go below here | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -20,6 +20,7 @@ | ||||||
| (define wikis | (define wikis | ||||||
|   '(((gallowmere) "MediEvil Wiki" "https://medievil.wiki/w/Main_Page" #f #f) |   '(((gallowmere) "MediEvil Wiki" "https://medievil.wiki/w/Main_Page" #f #f) | ||||||
|     ((fallout) "Fallout Wiki" "https://fallout.wiki/wiki/Fallout_Wiki" #f "https://fallout.wiki/api.php") |     ((fallout) "Fallout Wiki" "https://fallout.wiki/wiki/Fallout_Wiki" #f "https://fallout.wiki/api.php") | ||||||
|  |     ((drawntolife) "Wapopedia" "https://drawntolife.wiki/en/Main_Page" #f "https://drawntolife.wiki/w/api.php") | ||||||
|     )) |     )) | ||||||
| 
 | 
 | ||||||
| (define wikis-hash (make-hash)) | (define wikis-hash (make-hash)) | ||||||
|  | @ -58,8 +59,10 @@ | ||||||
|    [(not logo) (values #f '("Data table must have a \"Logo\" column"))] |    [(not logo) (values #f '("Data table must have a \"Logo\" column"))] | ||||||
|    [(null? logo) (values #f '("Logo table column must have a link"))] |    [(null? logo) (values #f '("Logo table column must have a link"))] | ||||||
|    (var href (get-attribute 'href (bits->attributes (car (hash-ref table 'logo))))) |    (var href (get-attribute 'href (bits->attributes (car (hash-ref table 'logo))))) | ||||||
|    [(not href) (values #f '("Logo table column must have a link"))] |    (var src (get-attribute 'src (bits->attributes (car (hash-ref table 'logo))))) | ||||||
|    [#t (values href null)])) |    (var true-src (or href src)) | ||||||
|  |    [(not true-src) (values #f '("Logo table column must have a link"))] | ||||||
|  |    [#t (values true-src null)])) | ||||||
| 
 | 
 | ||||||
| (define (get-api-endpoint wiki) | (define (get-api-endpoint wiki) | ||||||
|   (define main-page (third wiki)) |   (define main-page (third wiki)) | ||||||
|  | @ -77,7 +80,7 @@ | ||||||
|   (or override |   (or override | ||||||
|       (match main-page |       (match main-page | ||||||
|         [(regexp #rx"/$") (string-append main-page "Special:Search")] |         [(regexp #rx"/$") (string-append main-page "Special:Search")] | ||||||
|         [(regexp #rx"^(.*/w[^./]*/)" (list _ wiki-prefix)) (string-append wiki-prefix "Special:Search")] |         [(regexp #rx"^(.*/(?:en|w[^./]*)/)" (list _ wiki-prefix)) (string-append wiki-prefix "Special:Search")] | ||||||
|         [_ (error 'get-search-page "unknown url format: ~a" main-page)]))) |         [_ (error 'get-search-page "unknown url format: ~a" main-page)]))) | ||||||
| 
 | 
 | ||||||
| (define/memoize (get-redirect-content wikiname) #:hash hash | (define/memoize (get-redirect-content wikiname) #:hash hash | ||||||
|  | @ -109,8 +112,10 @@ | ||||||
|                          ,@body |                          ,@body | ||||||
|                          (p "This wiki's core community has wholly migrated away from Fandom. You should " |                          (p "This wiki's core community has wholly migrated away from Fandom. You should " | ||||||
|                             (a (@ (href ,go)) "go to " ,display-name " now!"))) |                             (a (@ (href ,go)) "go to " ,display-name " now!"))) | ||||||
|                     (div (@ (class "niwa__right")) |                     ,(if logo | ||||||
|                          (img (@ (class "niwa__logo") (src ,logo))))) |                          `(div (@ (class "niwa__right")) | ||||||
|  |                                (img (@ (class "niwa__logo") (src ,logo)))) | ||||||
|  |                          "")) | ||||||
|                ,(if (pair? links) |                ,(if (pair? links) | ||||||
|                     `(p (@ (class "niwa__feedback")) |                     `(p (@ (class "niwa__feedback")) | ||||||
|                         ,@(add-between links " / ")) |                         ,@(add-between links " / ")) | ||||||
|  | @ -122,4 +127,4 @@ | ||||||
|                     "")))] |                     "")))] | ||||||
|     [#t #f])) |     [#t #f])) | ||||||
| (module+ test | (module+ test | ||||||
|   ((get-redirect-content "gallowmere") "Gallowmere Historia")) |   (check-not-false ((get-redirect-content "gallowmere") "MediEvil Wiki"))) | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue