Codebase list mediawiki2latex / f3a8188
New upstream version 7.30 Georges Khaznadar 5 years ago
9 changed file(s) with 58 addition(s) and 18 deletion(s). Raw diff Collapse all Expand all
0 Version 7.30
1 * src
2 making it compile on debian buster
03 Version 7.29
14 * src
25 making server mode work again
33 \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
44 % Add ',fontsize=\small' for more characters per line
55 \newenvironment{Shaded}{\begin{scriptsize}}{\end{scriptsize}}
6 \newcommand{\VerbBar}{|}
7 \newcommand{\VERB}{\Verb[commandchars=\\\{\}]}
8 \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}}
9 % Add ',fontsize=\small' for more characters per line
610 \newcommand{\KeywordTok}[1]{\textbf{{#1}}}
711 \newcommand{\DataTypeTok}[1]{\underline{{#1}}}
812 \newcommand{\DecValTok}[1]{{#1}}
913 \newcommand{\BaseNTok}[1]{{#1}}
1014 \newcommand{\FloatTok}[1]{{#1}}
15 \newcommand{\ConstantTok}[1]{{#1}}
1116 \newcommand{\CharTok}[1]{{#1}}
17 \newcommand{\SpecialCharTok}[1]{{#1}}
1218 \newcommand{\StringTok}[1]{{#1}}
19 \newcommand{\VerbatimStringTok}[1]{{#1}}
20 \newcommand{\SpecialStringTok}[1]{{#1}}
21 \newcommand{\ImportTok}[1]{{#1}}
1322 \newcommand{\CommentTok}[1]{\textit{{#1}}}
23 \newcommand{\DocumentationTok}[1]{\textit{{#1}}}
24 \newcommand{\AnnotationTok}[1]{\textit{{#1}}}
25 \newcommand{\CommentVarTok}[1]{\textit{{#1}}}
1426 \newcommand{\OtherTok}[1]{{#1}}
27 \newcommand{\FunctionTok}[1]{{#1}}
28 \newcommand{\VariableTok}[1]{{#1}}
29 \newcommand{\ControlFlowTok}[1]{\textbf{{#1}}}
30 \newcommand{\OperatorTok}[1]{{#1}}
31 \newcommand{\BuiltInTok}[1]{{#1}}
32 \newcommand{\ExtensionTok}[1]{{#1}}
33 \newcommand{\PreprocessorTok}[1]{\textbf{{#1}}}
34 \newcommand{\AttributeTok}[1]{{#1}}
35 \newcommand{\RegionMarkerTok}[1]{{#1}}
36 \newcommand{\InformationTok}[1]{\textit{{#1}}}
37 \newcommand{\WarningTok}[1]{\textit{{#1}}}
1538 \newcommand{\AlertTok}[1]{\textbf{{#1}}}
16 \newcommand{\FunctionTok}[1]{{#1}}
17 \newcommand{\RegionMarkerTok}[1]{{#1}}
1839 \newcommand{\ErrorTok}[1]{\textbf{{#1}}}
1940 \newcommand{\NormalTok}[1]{{#1}}
41
42
43
44
45
2046 \newcommand{\myfigurewithoutcaption}[1]{{\bfseries \myfigurebabel{ }#1}}
2147 \newcommand{\myfigurewithcaption}[2]{{\bfseries \myfigurebabel{ }#1{\quad}}#2}
2248 \renewcommand{\iff}{\Longleftrightarrow}
00 Name: mediawiki2latex
1 Version: 7.29
1 Version: 7.30
22 License: GPL
33 License-File: LICENSE
44 Author: Dirk Hünniger <dirk.hunniger@googlemail.com>
152152 Babel
153153 BaseFont
154154 Compiler
155 Font
156155 FontTool
157156 GetImages
158157 Hex
177176 WikiHelper
178177 WikiLinkHelper
179178
180 GHC-Options: -Wall -O2 -rtsopts "-with-rtsopts=-K1000M -N" -threaded -optl-Wl,-z,relro -optl-Wl,-z,now
179 GHC-Options: -Wall -fno-warn-orphans -O2 -rtsopts "-with-rtsopts=-K1000M -N" -threaded -optl-Wl,-z,relro -optl-Wl,-z,now
181180 Hs-Source-Dirs: src
182181 Main-Is: mediawiki2latex.hs
183182
2323 import Data.List.Split
2424 import MagicStrings
2525 import Codec.Binary.UTF8.String
26 import Data.Map.Strict hiding (map)
26 import Data.Map.Strict hiding (map, take, drop)
2727 import Data.ByteString.UTF8 (toString)
2828 import Data.List
2929 import Data.Maybe
3030 import Data.Char
3131 import MediaWikiParseTree
32 import qualified Data.Map.Strict as Map
32 import qualified Data.Map.Strict as Map hiding (take, drop)
3333 import MediaWikiParser
3434 import SimpleContributors
3535 import UrlAnalyse
3333 where filename
3434 = reverse ((takeWhile (/= '/')) (reverse (getttf f)))
3535 pathname = reverse ((dropWhile (/= '/')) (reverse (getttf f)))
36 inner = "[" ++ (if os=="linux" then "Path=" ++ pathname else "") ++ (mid f) ++ "]{" ++ filename ++ "}"
36 inner = "{" ++ filename ++ "}"++"[" ++ (if os=="linux" then "Path=" ++ pathname else "") ++ (mid f) ++ "]"
3737 innermono
38 = "[" ++(if os=="linux" then "Path=" ++ pathname else "")++ (midmono f) ++ "]{" ++ filename ++ "}"
38 = "{" ++ filename ++ "}"++"[" ++(if os=="linux" then "Path=" ++ pathname else "")++ (midmono f) ++ "]"
3939 mid i
4040 | i `elem`
4141 [ComputerModernRoman, ComputerModernRomanBold,
27702770 = do let g = case reverse l of
27712771 [] -> []
27722772 (x : xs) -> if x == (C '\n') then reverse xs else l
2773 let f = shallowFlatten (map renormalize (breakLines3 linewidth l))
2774 d <- treeToLaTeX2 (breakLines3 linewidth g)
2773 let xg = case g of
2774 (C '\n'): xs -> xs
2775 _ -> g
2776 let f = shallowFlatten (map renormalize (breakLines3 linewidth xg))
2777 let glines = (Map.lookup "line" a) /= Nothing
2778 let spg= splitOn "\n" f
2779 let spgl = length (show (length spg))
2780 let lino = linenumbers spgl 1 (length spg)
2781 let newlines = if glines then intercalate "\n" (map (\(k,v)->k++" "++v) (zip lino spg)) else f
2782 d <- treeToLaTeX2 (breakLines3 linewidth (if glines then map C newlines else xg))
27752783 st <- get
27762784 case
27772785 do aa <- Map.lookup "lang" a
27912799 (replace2
27922800 (replace2
27932801 ((formatLaTeXBlock defaultFormatOpts)
2794 (highlightAs j f))
2802 (highlightAs j newlines))
27952803 "'"
27962804 "\\textquotesingle{}")
27972805 "\n"
27992807 "{Shaded}\\newline\n"
28002808 "{Shaded}\n")
28012809 "{Highlighting}[]\\newline\n\\newline\n"
2802 "{Highlighting}[]\n\n")
2810 "{Highlighting}[]\n")
28032811 "{Highlighting}\\newline\n"
28042812 "{Highlighting}\n")
28052813 " "
28092817 "$"
28102818 "\\$")
28112819 "{Highlighting}[]\\newline\n"
2812 "{Highlighting}[]\n\n")
2820 "{Highlighting}[]\n")
28132821 "&"
28142822 "\\&") "_" "\\_") "^" "\\^{}"
28152823 lll<-mapM doFonts gg
00 {-DHUN| module for parallel computations. The paralellism is reached by forking threads with liftIO. When starting a thread and empty MVar is returned immediately. The MVar is filled on completing of the thread. Normal function can be lifted to threaded function operation on MVar of the parameters instead of the parameters themself. Thus it is possible to define dependencies of function on the return values of other functions and let the order of excecution evolove automatically, so a function is called as soon as all its parameters have been calculated. All functions considered in this module are understood to have an IO return type. This module is mainly used for paraller downloading from the web. DHUN-}
11 module Parallel where
22 import Control.Concurrent.MVar
3 import Control.Concurrent
4 import Control.DeepSeq
53
64 {-DHUN| takes a function of return type IO which takes on parameter and an MVar containing at the same type as the parameter of the function and returns and IO action containing an MVar containing the same type as the tyoe contained in the IO Action returned by the function. This function retuns immediately and passed an empty MVar as return type. As soon as the MVar containing the same type as the parameter of the function is ready for reading the the function is executed in a new thread. As soon as the function return a value, the it is written into the returned MVar. DHUN-}
75
3432 {-DHUN| alias to switch between forkOS and forkIO for testing DHUN-}
3533
3634 myFork :: MVar Int -> IO () -> IO ()
37 myFork v x = x
35 myFork _ x = x
3836
3937
4038
77 import System.IO.Strict
88 import Data.Time.Clock.POSIX
99
10 pad :: Int -> String -> String
11 pad n s = if length s < n then pad n (' ':s) else s
12
13
14 linenumbers :: Int -> Int -> Int -> [String]
15 linenumbers n mini maxi = if mini == maxi then [pad n (show mini)] else (pad n (show mini)):(linenumbers n (mini+1) maxi)
1016
1117 myprint :: String -> IO ()
1218 myprint s
198198
199199 versionHeader :: String
200200 versionHeader
201 = "mediawiki2latex version 7.29\n" ++ (usageInfo header options)
201 = "mediawiki2latex version 7.30\n" ++ (usageInfo header options)
202202
203203 {-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-}
204204