New upstream version 7.30
Georges Khaznadar
5 years ago
0 | Version 7.30 | |
1 | * src | |
2 | making it compile on debian buster | |
0 | 3 | Version 7.29 |
1 | 4 | * src |
2 | 5 | making server mode work again |
3 | 3 | \DefineVerbatimEnvironment{Highlighting}{Verbatim}{commandchars=\\\{\}} |
4 | 4 | % Add ',fontsize=\small' for more characters per line |
5 | 5 | \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 | |
6 | 10 | \newcommand{\KeywordTok}[1]{\textbf{{#1}}} |
7 | 11 | \newcommand{\DataTypeTok}[1]{\underline{{#1}}} |
8 | 12 | \newcommand{\DecValTok}[1]{{#1}} |
9 | 13 | \newcommand{\BaseNTok}[1]{{#1}} |
10 | 14 | \newcommand{\FloatTok}[1]{{#1}} |
15 | \newcommand{\ConstantTok}[1]{{#1}} | |
11 | 16 | \newcommand{\CharTok}[1]{{#1}} |
17 | \newcommand{\SpecialCharTok}[1]{{#1}} | |
12 | 18 | \newcommand{\StringTok}[1]{{#1}} |
19 | \newcommand{\VerbatimStringTok}[1]{{#1}} | |
20 | \newcommand{\SpecialStringTok}[1]{{#1}} | |
21 | \newcommand{\ImportTok}[1]{{#1}} | |
13 | 22 | \newcommand{\CommentTok}[1]{\textit{{#1}}} |
23 | \newcommand{\DocumentationTok}[1]{\textit{{#1}}} | |
24 | \newcommand{\AnnotationTok}[1]{\textit{{#1}}} | |
25 | \newcommand{\CommentVarTok}[1]{\textit{{#1}}} | |
14 | 26 | \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}}} | |
15 | 38 | \newcommand{\AlertTok}[1]{\textbf{{#1}}} |
16 | \newcommand{\FunctionTok}[1]{{#1}} | |
17 | \newcommand{\RegionMarkerTok}[1]{{#1}} | |
18 | 39 | \newcommand{\ErrorTok}[1]{\textbf{{#1}}} |
19 | 40 | \newcommand{\NormalTok}[1]{{#1}} |
41 | ||
42 | ||
43 | ||
44 | ||
45 | ||
20 | 46 | \newcommand{\myfigurewithoutcaption}[1]{{\bfseries \myfigurebabel{ }#1}} |
21 | 47 | \newcommand{\myfigurewithcaption}[2]{{\bfseries \myfigurebabel{ }#1{\quad}}#2} |
22 | 48 | \renewcommand{\iff}{\Longleftrightarrow} |
0 | 0 | Name: mediawiki2latex |
1 | Version: 7.29 | |
1 | Version: 7.30 | |
2 | 2 | License: GPL |
3 | 3 | License-File: LICENSE |
4 | 4 | Author: Dirk Hünniger <dirk.hunniger@googlemail.com> |
152 | 152 | Babel |
153 | 153 | BaseFont |
154 | 154 | Compiler |
155 | Font | |
156 | 155 | FontTool |
157 | 156 | GetImages |
158 | 157 | Hex |
177 | 176 | WikiHelper |
178 | 177 | WikiLinkHelper |
179 | 178 | |
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 | |
181 | 180 | Hs-Source-Dirs: src |
182 | 181 | Main-Is: mediawiki2latex.hs |
183 | 182 |
23 | 23 | import Data.List.Split |
24 | 24 | import MagicStrings |
25 | 25 | import Codec.Binary.UTF8.String |
26 | import Data.Map.Strict hiding (map) | |
26 | import Data.Map.Strict hiding (map, take, drop) | |
27 | 27 | import Data.ByteString.UTF8 (toString) |
28 | 28 | import Data.List |
29 | 29 | import Data.Maybe |
30 | 30 | import Data.Char |
31 | 31 | import MediaWikiParseTree |
32 | import qualified Data.Map.Strict as Map | |
32 | import qualified Data.Map.Strict as Map hiding (take, drop) | |
33 | 33 | import MediaWikiParser |
34 | 34 | import SimpleContributors |
35 | 35 | import UrlAnalyse |
33 | 33 | where filename |
34 | 34 | = reverse ((takeWhile (/= '/')) (reverse (getttf f))) |
35 | 35 | 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) ++ "]" | |
37 | 37 | innermono |
38 | = "[" ++(if os=="linux" then "Path=" ++ pathname else "")++ (midmono f) ++ "]{" ++ filename ++ "}" | |
38 | = "{" ++ filename ++ "}"++"[" ++(if os=="linux" then "Path=" ++ pathname else "")++ (midmono f) ++ "]" | |
39 | 39 | mid i |
40 | 40 | | i `elem` |
41 | 41 | [ComputerModernRoman, ComputerModernRomanBold, |
2770 | 2770 | = do let g = case reverse l of |
2771 | 2771 | [] -> [] |
2772 | 2772 | (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)) | |
2775 | 2783 | st <- get |
2776 | 2784 | case |
2777 | 2785 | do aa <- Map.lookup "lang" a |
2791 | 2799 | (replace2 |
2792 | 2800 | (replace2 |
2793 | 2801 | ((formatLaTeXBlock defaultFormatOpts) |
2794 | (highlightAs j f)) | |
2802 | (highlightAs j newlines)) | |
2795 | 2803 | "'" |
2796 | 2804 | "\\textquotesingle{}") |
2797 | 2805 | "\n" |
2799 | 2807 | "{Shaded}\\newline\n" |
2800 | 2808 | "{Shaded}\n") |
2801 | 2809 | "{Highlighting}[]\\newline\n\\newline\n" |
2802 | "{Highlighting}[]\n\n") | |
2810 | "{Highlighting}[]\n") | |
2803 | 2811 | "{Highlighting}\\newline\n" |
2804 | 2812 | "{Highlighting}\n") |
2805 | 2813 | " " |
2809 | 2817 | "$" |
2810 | 2818 | "\\$") |
2811 | 2819 | "{Highlighting}[]\\newline\n" |
2812 | "{Highlighting}[]\n\n") | |
2820 | "{Highlighting}[]\n") | |
2813 | 2821 | "&" |
2814 | 2822 | "\\&") "_" "\\_") "^" "\\^{}" |
2815 | 2823 | lll<-mapM doFonts gg |
0 | 0 | {-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-} |
1 | 1 | module Parallel where |
2 | 2 | import Control.Concurrent.MVar |
3 | import Control.Concurrent | |
4 | import Control.DeepSeq | |
5 | 3 | |
6 | 4 | {-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-} |
7 | 5 | |
34 | 32 | {-DHUN| alias to switch between forkOS and forkIO for testing DHUN-} |
35 | 33 | |
36 | 34 | myFork :: MVar Int -> IO () -> IO () |
37 | myFork v x = x | |
35 | myFork _ x = x | |
38 | 36 | |
39 | 37 | |
40 | 38 |
7 | 7 | import System.IO.Strict |
8 | 8 | import Data.Time.Clock.POSIX |
9 | 9 | |
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) | |
10 | 16 | |
11 | 17 | myprint :: String -> IO () |
12 | 18 | myprint s |
198 | 198 | |
199 | 199 | versionHeader :: String |
200 | 200 | versionHeader |
201 | = "mediawiki2latex version 7.29\n" ++ (usageInfo header options) | |
201 | = "mediawiki2latex version 7.30\n" ++ (usageInfo header options) | |
202 | 202 | |
203 | 203 | {-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-} |
204 | 204 |