Codebase list mediawiki2latex / c758972
New upstream version 7.45 Georges Khaznadar 2 years ago
6 changed file(s) with 24 addition(s) and 5 deletion(s). Raw diff Collapse all Expand all
0 Version 7.45
1 * src
2 remove navigation toolsbars
03 Version 7.44
14 * src
25 user agent header added to https requests
00 Name: mediawiki2latex
1 Version: 7.44
1 Version: 7.45
22 License: GPL
33 License-File: LICENSE
44 Author: Dirk Hünniger <dirk.hunniger@googlemail.com>
6767 String ->
6868 WikiUrl -> (Integer, String) -> IO (Maybe ([String], Integer, URL))
6969 getImagePage dir u (i, ss)
70 = do l <- (mapM (geturl . unify . exportURL . modpath2 ss)
70 = do l <- (mapM (geturl . kds.unify . exportURL . modpath2 ss)
7171 (parses u))
7272 :: IO [String]
7373 let xx = (map (getImageUrl2) (zip l (parses u))) :: [Maybe String]
8585 where go :: (URL, Maybe String) -> [(URL, String)]
8686 go (uu, Just x) = [(uu, x)]
8787 go _ = []
88 kds ('h':'t':'t':'p':'s':':':'/':'/':xs)=('h':'t':'t':'p':'s':':':'/':'/':(kds xs))
89 kds ('/':'/':xs)='/':(kds xs)
90 kds (x:xs) = x:( kds xs)
91 kds [] = []
8892
8993 {-DHUN| downloads a single image form the wiki. It takes the temporary image download directory as first parameter. It takes a tuple as second input parameter. The first element of the tuple is the image number so just an integer that can be used to identify the image uniquely) . The second element of the tupele is image include string of the image from the wiki source, that is the text in between the square brackets as second input parameter. It takes the WikiUrl of the wiki websitze currently being processed as thrird parameter. See function getImages in this module for documentation on the returned data type DHUN-}
9094
19791979 | (Map.lookup "class" m) == (Just "editsection") = []
19801980 printPrepareNode (Environment Tag (TagAttr "span" m) _)
19811981 | (Map.lookup "class" m) == (Just "mw-editsection") = []
1982 printPrepareNode (Environment Tag (TagAttr "div" m) _)
1983 | (Map.lookup "id" m) == (Just "mw-navigation") = []
1984 printPrepareNode (Environment Tag (TagAttr "div" m) _)
1985 | (Map.lookup "id" m) == (Just "mw-panel") = []
1986 printPrepareNode (Environment Tag (TagAttr "ul" m) _)
1987 | (Map.lookup "id" m) == (Just "footer-places") = []
1988 printPrepareNode (Environment Tag (TagAttr "ul" m) _)
1989 | (Map.lookup "id" m) == (Just "footer-icons") = []
1990 printPrepareNode (Environment Tag (TagAttr "div" m) _)
1991 | (Map.lookup "id" m) == (Just "mw-panel") = []
19821992 printPrepareNode (Environment Tag (TagAttr "a" m) l)
19831993 = case (Map.lookup "class" m) of
19841994 (Just "image") -> imgfun m (printPrepareTree l) Nothing
258258
259259 getBookpage :: String -> WikiUrl -> IO (Maybe String)
260260 getBookpage ss u
261 = do l <- mapM ((geturl2) . unify) ((map ((++("/"++ss)).exportURL)) (parses u))
261 = do l <- mapM ((geturl2) . unify) ((map attach) (map exportURL (parses u)))
262262 lll <- return (seq l l)
263263 return $
264264 (listToMaybe $ concat (map maybeToList (map go lll))) >>=
265265 (return)
266266 where
267267 go x =if (x==(UTF8Str.fromString [])) then Nothing else Just (UTF8Str.toString x)
268
268 attach x = case reverse x of
269 '/':xs -> ((reverse xs)++("/"++ss))
270 xs-> ((reverse xs)++("/"++ss))
269271
270272 {-DHUN| Loads the wikitext of an article form a mediawiki server when mediawiki2latex is running with the --mediawiki option. This function downloads the orignial wikitext source without expanding the templates. This is going to happen later by call to getExpandedPage. The first parmeter is lemma to load. The second paramerter is the WikiUrl to the server hosting the wiki. The return value is a pair. The first element of it is the wikitext source of the article. The second element of it is the URL under which the article was downloaded DHUN-}
271273
202202
203203 versionHeader :: String
204204 versionHeader
205 = "mediawiki2latex version 7.44\n" ++ (usageInfo header options)
205 = "mediawiki2latex version 7.45\n" ++ (usageInfo header options)
206206
207207 {-DHUN| print the version string of mediawiki2latex. Takes the output of the compilerOpts function as input. Prints the version string if no options were given or the version command was given does noting otherwise DHUN-}
208208