Ficheiro:Artikel der Woche 2004 der deutschen Wikipedia mit Stand April 2021.pdf
Imagem numa resolução maior (1 239 × 1 752 píxeis, tamanho do ficheiro: 211,76 MB, tipo MIME: application/pdf, 966 páginas)
Esta imagem provém do Wikimedia Commons, um acervo de conteúdo livre da Wikimedia Foundation que pode ser utilizado por outros projetos.
|
Índice
Descrição do ficheiro
DescriçãoArtikel der Woche 2004 der deutschen Wikipedia mit Stand April 2021.pdf |
Deutsch: Kompilat der Artikel der Woche 2004 der deutschen Wikipedia mit Stand April 2021
|
Data | |
Origem | Obra do próprio (Layout + Satz) bzw. Abgeleitetes Werk (zugrundeliegende Quelle eines jeden Artikels ist im PDF am Ende eines jeden Artikels bzw. Kapitels verlinkt) |
Autor | Cmuelle8 |
mediawiki2latex Patch
Der Konverter baut nur ein Grundgerüst (tex Quelle), das geprüft/gesichtet und nachbearbeitet werden muss. Einige Schwachstellen:
- Farblegenden in den Bildbeschreibungen fehlen (Version 7.39 getestet),
- die Umwandlung der Infoboxen erfolgt farb- und rahmenlos,
- Bilder/Flaggen/Wappen/Karten aus Infoboxen werden nicht übernommen,
- Statistiken zu Bevölkerungsentwicklungen (graph Erweiterung)
- Klimadiagramme (Farbcodes der Zellen werden ignoriert)
- Kladogramme (da fehlt die Verästelung und die Astblätter erhalten falsche boxen, so daß Text-über-Text ausgegeben wird)
- Nach Zitaten wird der Folgeabsatz an den Zitat-Autor-Text geklebt, sofern Zitat-Autor/Werk im Artikel angegeben - hier fehlen Zeilenumbrüche, die der Konverter nicht in die tex Quelle ausgibt (scheint neben den anderen Problemen am einfachsten behebar zu sein)
- ..
für Debian / Ubuntu Quellen
diff -Nur mediawiki2latex-7.39.orig/debian/changelog mediawiki2latex-7.39/debian/changelog
--- mediawiki2latex-7.39.orig/debian/changelog 2020-02-08 12:07:05.000000000 +0100
+++ mediawiki2latex-7.39/debian/changelog 2021-04-19 16:44:50.000000000 +0200
@@ -1,3 +1,16 @@
+mediawiki2latex (7.39-1build7) focal; urgency=medium
+
+ * Functional changes:
+ * cli provides option -K / --chapexcl to filter out
+ chapters in bookmode
+ * mw-footer is now handled much better, repeating
+ content targeted for screen use is dropped
+ * when the bookpage is read the link caption,
+ if present, is used as a chapter title (may
+ override actual pagename / lemma of the link
+ target)
+
+
mediawiki2latex (7.39-1build1) focal; urgency=medium
* No-change rebuild with fixed binutils on arm64.
diff -Nur mediawiki2latex-7.39.orig/debian/control mediawiki2latex-7.39/debian/control
--- mediawiki2latex-7.39.orig/debian/control 2019-12-25 13:15:21.000000000 +0100
+++ mediawiki2latex-7.39/debian/control 2021-04-19 21:29:38.573569621 +0200
@@ -16,6 +16,7 @@
libghc-http-client-dev,
libghc-http-conduit-dev,
libghc-hxt-http-dev,
+ libghc-regex-tdfa-text-dev,
libghc-strict-dev,
libghc-temporary-dev,
libghc-url-dev,
diff -Nur mediawiki2latex-7.39.orig/debian/patches/series mediawiki2latex-7.39/debian/patches/series
--- mediawiki2latex-7.39.orig/debian/patches/series 2019-08-25 19:36:29.000000000 +0200
+++ mediawiki2latex-7.39/debian/patches/series 2021-04-19 21:48:14.393866777 +0200
@@ -1,2 +1,3 @@
10-Makefile.patch
30-typos.patch
+use_wikilinkcaptions_as_chapter_title_and_allow_chapter_exclusion_in_bookmode.patch
diff -Nur mediawiki2latex-7.39.orig/debian/patches/use_wikilinkcaptions_as_chapter_title_and_allow_chapter_exclusion_in_bookmode.patch mediawiki2latex-7.39/debian/patches/use_wikilinkcaptions_as_chapter_title_and_allow_chapter_exclusion_in_bookmode.patch
--- mediawiki2latex-7.39.orig/debian/patches/use_wikilinkcaptions_as_chapter_title_and_allow_chapter_exclusion_in_bookmode.patch 1970-01-01 01:00:00.000000000 +0100
+++ mediawiki2latex-7.39/debian/patches/use_wikilinkcaptions_as_chapter_title_and_allow_chapter_exclusion_in_bookmode.patch 2021-04-20 00:42:00.000000000 +0200
@@ -0,0 +1,507 @@
+Description: respect link captions in bookmode, cli regex filtering for bookmode
+ .
+ mediawiki2latex (7.39-1build7) focal; urgency=medium
+ .
+ * Functional changes:
+ * cli provides option -K / --chapexcl to filter out
+ chapters in bookmode
+ * mw-footer is now handled much better, repeating
+ content targeted for screen use is dropped
+ * when the bookpage is read the link caption,
+ if present, is used as a chapter title (may
+ override actual pagename / lemma of the link
+ target)
+Author: Cm8 <wonderworld@planetz.io>
+
+---
+The information above should follow the Patch Tagging Guidelines, please
+checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
+are templates for supplementary fields that you might want to add:
+
+Origin: <vendor|upstream|other>, <url of original patch>
+Bug: <url in upstream bugtracker>
+Bug-Debian: https://bugs.debian.org/<bugnumber>
+Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
+Forwarded: <no|not-needed|url proving that it has been forwarded>
+Reviewed-By: <name and email of someone who approved the patch>
+Last-Update: 2021-04-19
+
+Index: mediawiki2latex-7.39/document/headers/commands.tex
+===================================================================
+--- mediawiki2latex-7.39.orig/document/headers/commands.tex
++++ mediawiki2latex-7.39/document/headers/commands.tex
+@@ -85,7 +85,8 @@
+ \addtolength{\fnwidth}{-10mm}
+
+ \newcommand{\myhref}[2]
+-{{#2}\protect\footnote{ \begin{minipage}{\fnwidth} \ttfamily \url{#1} \end{minipage}}}
++%{{#2}\protect\footnote{ \begin{minipage}{\fnwidth} \ttfamily \url{#1} \end{minipage}}}
++{\href{#1}{#2}}
+
+ \newcommand{\mylref}[2]
+ {{#2}\protect\footnote{\mychapterbabel {$\text{}$} \ref{#1} \mypagebabel {$\text{}$} \pageref{#1}}}
+Index: mediawiki2latex-7.39/mediawiki2latex.cabal
+===================================================================
+--- mediawiki2latex-7.39.orig/mediawiki2latex.cabal
++++ mediawiki2latex-7.39/mediawiki2latex.cabal
+@@ -149,7 +149,9 @@ Executable mediawiki2latex
+ cereal,
+ network >= 2.3.0.13,
+ tagsoup,
+- word8
++ word8,
++ regex-tdfa,
++ regex-tdfa-text
+
+ Other-Modules:
+ All
+@@ -159,6 +161,7 @@ Executable mediawiki2latex
+ FontTool
+ GetImages
+ Hex
++ HtmlParser
+ HtmlRenderer
+ ImperativeState
+ LatexRenderer
+Index: mediawiki2latex-7.39/src/ImperativeState.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/ImperativeState.hs
++++ mediawiki2latex-7.39/src/ImperativeState.hs
+@@ -128,7 +128,7 @@ data ConvertState = NewTree String | Tre
+
+ data FullConfig = FullConfig{headers :: Maybe String,
+ resolution :: Integer, outputFilename :: String,
+- inputUrl :: String, runMode :: RunMode, paper :: String,
++ inputUrl :: String, runMode :: RunMode, chapExcl :: String, paper :: String,
+ vector :: Bool, copy :: Maybe String, mainPath :: String,
+ server :: Maybe Int, outputType :: OutputType,
+ selfTest :: Maybe (Integer, Integer), compile :: Maybe String,
+@@ -141,4 +141,4 @@ fullconfigbase
+ outputFilename = "", inputUrl = "", runMode = HTML No, paper = "A4",
+ vector = False, copy = Nothing, mainPath = "", server = Nothing,
+ outputType = PlainPDF, selfTest = Nothing, compile = Nothing,
+- imgctrb = Nothing, convert =Nothing, noparent=False}
++ imgctrb = Nothing, convert =Nothing, noparent=False, chapExcl = "^$"}
+Index: mediawiki2latex-7.39/src/LatexRenderer.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/LatexRenderer.hs
++++ mediawiki2latex-7.39/src/LatexRenderer.hs
+@@ -1009,6 +1009,8 @@ templateProcessor st ("main", ll)
+ = (st,
+ "Main Page: " ++
+ (wikiLinkToLaTeX (Map.findWithDefault [] "1" ll) st))
++templateProcessor st ("Dieser Artikel", _)
++ = (st, "")
+ templateProcessor st ("#invoke:Mathe f\252r Nicht-Freaks/Seite", _)
+ = (st, "")
+ templateProcessor st ("#invoke:Liste", _) = (st, "")
+@@ -2434,6 +2436,15 @@ treeToLaTeX2 ll
+ = do d <- treeToLaTeX2 l
+ return $ prefix ++ d ++ postfix
+
++ walkhdr :: String -> [Anything Char] -> String -> String -> Renderer String
++ walkhdr prefix l postfix nestlvl
++ = do st <- get
++ case nestlvl of
++ (_ : []) -> return $ prefix ++ (if trim (currentLabel st) == ""
++ then trim (currentUrl st)
++ else trim (currentLabel st)) ++ postfix
++ _ -> walktrim prefix l postfix
++
+ walktrim :: String -> [Anything Char] -> String -> Renderer String
+ walktrim prefix l postfix
+ = do st <- get
+@@ -2632,15 +2643,13 @@ treeToLaTeX2 ll
+ = do st <- get
+ if (getInTab st) > 0 then
+ walktrim ("{\\Large ") (uncenter l) ("}\n") else
+- walktrim ("\\" ++ (getsec s) ++ "{") (uncenter l)
+- ("}\n" ++ (getsecpost s))
++ walkhdr ("\\" ++ (getsec s) ++ "{") (uncenter l) ("}\n" ++ (getsecpost s)) s
+ nodeToLaTeX (Environment Tag (TagAttr ('h' : (x : [])) _) l)
+ = if x `elem` "123456" then
+ case reads [x] of
+ [] -> walk "" l ""
+ ((y, _) : _) -> let s = replicate y '=' in
+- walktrim ("\\" ++ (getsec s) ++ "{") (uncenter l)
+- ("}\n" ++ (getsecpost s))
++ walkhdr ("\\" ++ (getsec s) ++ "{") (uncenter l) ("}\n" ++ (getsecpost s)) s
+ else walk "" l ""
+ nodeToLaTeX (Environment Bold _ l) = walkbf l
+ nodeToLaTeX (Environment Italic _ l) = walkit l
+@@ -2650,8 +2659,10 @@ treeToLaTeX2 ll
+ nodeToLaTeX (Environment Tag (TagAttr "sup" _) l)
+ = do st <- get
+ walk ((fontsetter (font st)) ++ "\\textsuperscript{") l "}"
+- nodeToLaTeX (Environment Tag (TagAttr "li" _) l)
+- = walk "\\item{}" l ""
++ nodeToLaTeX (Environment Tag (TagAttr "li" a) l)
++ = case Map.lookup "id" a of
++ Just x | "footer-info" `isPrefixOf` x -> if "lastmod" `isSuffixOf` x then walkit l else return $ ""
++ _ -> walk "\\item{}" l ""
+ nodeToLaTeX (Environment Tag (TagAttr "a" d) l)
+ = do st <- get
+ if getInHeading st then treeToLaTeX2 l else
+@@ -2683,14 +2694,15 @@ treeToLaTeX2 ll
+ "}" ++ (itemEnvironmentParameters ":" (getF st)) ++ "\n\\item{}")
+ l
+ ("\n\\end{" ++ (itemEnvironmentName ":" (getF st)) ++ "}\n")
+- nodeToLaTeX (Environment Tag (TagAttr "ul" _) l)
++ nodeToLaTeX (Environment Tag (TagAttr "footer" _) l) = walk "" l ""
++ nodeToLaTeX (Environment Tag (TagAttr "ul" a) l)
+ = do st <- get
+- walk
+- ("\n\\begin{" ++
+- (itemEnvironmentName "*" (getF st)) ++
+- "}" ++ (itemEnvironmentParameters "*" (getF st)))
+- l
+- ("\n\\end{" ++ (itemEnvironmentName "*" (getF st)) ++ "}\n")
++ case Map.lookup "id" a of
++ Just g | "footer-" `isPrefixOf` g && g /= "footer-info" -> return $ ""
++ _ -> walk ("\n\\begin{" ++ (itemEnvironmentName "*" (getF st)) ++
++ "}" ++ (itemEnvironmentParameters "*" (getF st)))
++ l
++ ("\n\\end{" ++ (itemEnvironmentName "*" (getF st)) ++ "}\n")
+ nodeToLaTeX (Environment Tag (TagAttr "dir" _) l)
+ = do st <- get
+ walk
+@@ -2807,10 +2819,11 @@ treeToLaTeX2 ll
+ Nothing -> ""
+ Just _ -> "}"
+ in
+- if (Map.member "class" a) then
+- if (Map.findWithDefault [] "class" a) `elem` ["noprint", "topicon"]
+- then return $ beg ++ en else walk beg l en
+- else walk beg l en
++ if (Map.member "id" a) && (Map.findWithDefault [] "id" a) `elem` ["Vorlage_Dieser_Artikel", "Vorlage_Weiterleitungshinweis"]
++ then return $ ""
++ else if (Map.member "class" a) && (Map.findWithDefault [] "class" a) `elem` ["noprint", "topicon"]
++ then return $ beg ++ en
++ else walk beg l en
+ nodeToLaTeX (Environment Tag (TagAttr "span" a) l)
+ = if (Map.member "class" a) then
+ if
+@@ -2912,6 +2925,10 @@ treeToLaTeX2 ll
+ = do st <- get
+ put st{currentUrl = shallowFlatten l}
+ return ""
++ nodeToLaTeX (Environment DhunLabel _ l)
++ = do st <- get
++ put st{currentLabel = shallowFlatten l}
++ return ""
+ nodeToLaTeX (Environment NoWiki _ l) = walk "" l ""
+ nodeToLaTeX (Environment HDevLine _ l) = walk "" l ""
+ nodeToLaTeX (Environment PageBreak _ _) = return "\\pagebreak "
+Index: mediawiki2latex-7.39/src/Load.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/Load.hs
++++ mediawiki2latex-7.39/src/Load.hs
+@@ -14,7 +14,7 @@ import Text.Parsec.Prim
+ import Codec.Binary.UTF8.String as C
+ import Data.String.HT
+ import Data.ByteString as B
+- hiding (takeWhile, isInfixOf, intercalate, concat, map, sort)
++ hiding (dropWhile, takeWhile, isInfixOf, intercalate, concat, map, sort)
+ import Data.List.Split
+ import Data.Map as Map hiding (map)
+ import Data.List hiding (lookup)
+@@ -28,6 +28,8 @@ import System.Process
+ import HtmlParser (parseHtml)
+ import Data.Serialize as S (encode, decode)
+ import Data.Maybe (fromMaybe)
++import Text.Regex.TDFA
++import Text.Regex.TDFA.Text ()
+
+
+ notendyet ::
+@@ -155,28 +157,32 @@ runqBookIncludeAction dir
+
+ qBookIncludeActionbase :: FullConfig-> WikiUrl -> String -> ImperativeMonad String
+ qBookIncludeActionbase cfg wurl text
+- = if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}") else if isInfixOf "Category:" text then return ""
+- else
+- do pp <- (liftIO (print d)) >> myfun
+- case pp of
+- Just p -> do _ <- addContributors d Nothing
+- x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\n" ++ p)
+- st <- get
+- systempdir <- liftIO getTemporaryDirectory
+- tempdir <- liftIO $
+- createTempDirectory systempdir "MediaWiki2LaTeXParser"
+- liftIO $ Tools.writeFile (tempdir </> "input") x
+- _ <- liftIO $
+- system
+- ("mediawiki2latex -x " ++
+- (Hex.hex (show (fullconfigbase{compile = Just tempdir, runMode= runMode cfg}))))
+- case (loadacu st) of
+- Right base -> do t <- liftIO $ B.readFile (tempdir </> "output")
+- put st{loadacu = Right ((case S.decode t of {Right k->k;_->[]})++ base :: [Anything Char])}
+- Left base -> put st{loadacu = Left (tempdir: base)}
+- return x
+- _ -> return ""
++ = if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}")
++ else if isInfixOf "Category:" text then return ""
++ else if isInfixOf "Kategorie:" text then return ""
++ else if d =~ (chapExcl cfg) || e /= "" && e =~ (chapExcl cfg) then return ""
++ else
++ do pp <- (liftIO (print d)) >> myfun
++ case pp of
++ Just p -> do _ <- addContributors d Nothing
++ x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\ndhunparserlabel " ++ e ++ "\n\n" ++ p)
++ st <- get
++ systempdir <- liftIO getTemporaryDirectory
++ tempdir <- liftIO $
++ createTempDirectory systempdir "MediaWiki2LaTeXParser"
++ liftIO $ Tools.writeFile (tempdir </> "input") x
++ _ <- liftIO $
++ system
++ ("mediawiki2latex -x " ++
++ (Hex.hex (show (fullconfigbase{compile = Just tempdir, runMode= runMode cfg}))))
++ case (loadacu st) of
++ Right base -> do t <- liftIO $ B.readFile (tempdir </> "output")
++ put st{loadacu = Right ((case S.decode t of {Right k->k;_->[]})++ base :: [Anything Char])}
++ Left base -> put st{loadacu = Left (tempdir: base)}
++ return x
++ _ -> return ""
+ where d = (trim (takeWhile (/= '|') text))
++ e = (trim (dropWhile (== '|') (dropWhile (/= '|') text) ))
+ myfun = case (runMode cfg) of
+ HTML _ -> liftIO (getBookpage d (wurl))
+ (ExpandedTemplates _) -> (loadMediaWiki d wurl) >>= (return . Just)
+@@ -186,11 +192,16 @@ qBookIncludeAction :: FullConfig-> WikiU
+ qBookIncludeAction cfg wurl text
+ = do sst <- get
+ case (loadacu sst) of
+- Right _ -> if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}") else if isInfixOf "Category:" text then return "" else if (noparent cfg) && case text of {'/':_->False; _->True} &&(fromMaybe False (wurl >>= (return.not.((flip Data.List.isPrefixOf) text).(intercalate "/").(Data.List.dropWhile (=="wiki")).(splitOn "/").url_path.fst))) then return "" else
++ Right _ -> if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}")
++ else if isInfixOf "Category:" text then return ""
++ else if isInfixOf "Kategorie:" text then return ""
++ else if d =~ (chapExcl cfg) || e /= "" && e =~ (chapExcl cfg) then return ""
++ else if (noparent cfg) && case text of {'/':_->False; _->True} && (fromMaybe False (wurl >>= (return.not.((flip Data.List.isPrefixOf) text).(intercalate "/").(Data.List.dropWhile (=="wiki")).(splitOn "/").url_path.fst))) then return ""
++ else
+ do pp <- (liftIO (print d)) >> myfun
+ case pp of
+ Just p -> do _ <- addContributors d Nothing
+- x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\n" ++ p)
++ x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\ndhunparserlabel " ++ e ++ "\n\n" ++ p)
+ st <- get
+ systempdir <- liftIO getTemporaryDirectory
+ tempdir <- liftIO $ createTempDirectory systempdir "MediaWiki2LaTeXParser"
+@@ -215,6 +226,7 @@ qBookIncludeAction cfg wurl text
+
+
+ where d = (trim (takeWhile (/= '|') text))
++ e = (trim (dropWhile (== '|') (dropWhile (/= '|') text) ))
+ myfun = case (runMode cfg) of
+ HTML _ -> liftIO (getBookpage d (wurl))
+ (ExpandedTemplates _) -> (loadMediaWiki d wurl) >>= (return . Just)
+Index: mediawiki2latex-7.39/src/MagicStrings.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/MagicStrings.hs
++++ mediawiki2latex-7.39/src/MagicStrings.hs
+@@ -543,7 +543,7 @@ goodtags1
+ "sup", "big", "del", "map", "bdo", "var", "dfn", "kbd", "col",
+ "ins", "bdi", "dir", "img", "h1", "h2", "h3", "h4", "h5", "h6",
+ "li", "ul", "ol", "tt", "dd", "dl", "dt", "hr", "em", "b", "i",
+- "s", "u", "p", "q", "a"]
++ "s", "u", "p", "q", "a", "header", "footer", "nav"]
+
+ {-DHUN| HTML tags for tables rows in tables and so on, only lower case DHUN-}
+
+Index: mediawiki2latex-7.39/src/MediaWikiParseTree.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/MediaWikiParseTree.hs
++++ mediawiki2latex-7.39/src/MediaWikiParseTree.hs
+@@ -48,6 +48,7 @@ data EnvType = Wikilink
+ | ForbiddenTag
+ | Preformat
+ | DhunUrl
++ | DhunLabel
+ | Sub
+ | Sup
+ | Label
+Index: mediawiki2latex-7.39/src/MediaWikiParser.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/MediaWikiParser.hs
++++ mediawiki2latex-7.39/src/MediaWikiParser.hs
+@@ -402,7 +402,7 @@ wikilinkwhere = [TableColSep, TableHeadC
+
+ minparsers :: [MyParser Char]
+ minparsers
+- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
++ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
+ pagebreakp, htmlcharp, p302p, attrp, greekp, brparser, mytablep,
+ mytrsepp2, mytcolsepp2, mytcapp2, mythcolsepp2, annop, tagparser,
+ tagparserp, tagparser2, tagparser2p, tagparsert, tagparsert,
+@@ -413,7 +413,7 @@ minparsers
+
+ htmlminparsers :: [MyParser Char]
+ htmlminparsers
+- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
++ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
+ pagebreakp, htmlcharp, p302p, attrp, greekp, brparser, htmytablep,
+ htmytrsepp, htmytcolsepp, htmytcapp, htmythcolsepp, tagparser,
+ tagparserp, tagparser2, tagparser2p, tagparsert, tagparsert,
+@@ -429,7 +429,7 @@ imgparsers = [supp, subp, htmlcharp, p30
+
+ parsers :: [MyParser Char]
+ parsers
+- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
++ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
+ chapterp, prep, pagebreakp, htmlcharp, p302p, attrp, greekp,
+ brparser, wikilinkp, wikitablep, mytablep, wikiheadingp,
+ itempgrouppt, itempgroupp, itemlinep, boldp, italicp, tablecapp,
+@@ -532,6 +532,15 @@ dhunurlp
+ end = \ _ -> string "\n" >> return (), self = DhunUrl,
+ allowed = [Root, Tag]}
+
++dhunlabelp :: MyParser Char
++dhunlabelp
++ = baseParser{start =
++ \ _ ->
++ do _ <- string "\ndhunparserlabel "
++ return (Str ""),
++ end = \ _ -> string "\n" >> return (), self = DhunLabel,
++ allowed = [Root, Tag]}
++
+ {-DHUN| parses a Greek HTML entity. So a Greek letter or something similar DHUN-}
+
+ greekp :: MyParser Char
+Index: mediawiki2latex-7.39/src/MyState.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/MyState.hs
++++ mediawiki2latex-7.39/src/MyState.hs
+@@ -42,7 +42,8 @@ data MyState = MyState{getImages :: [Str
+ getInCode :: Bool, getTitle :: String,
+ templateMap :: Map String [String], urls :: Map String String,
+ urld :: WikiUrlData, getGalleryNumbers :: [Integer],
+- currentUrl :: String, fndict :: Map String [Anything Char],
++ currentUrl :: String, currentLabel :: String,
++ fndict :: Map String [Anything Char],
+ tablist :: [[String]], tabmap :: Map Int (Map Int Double),
+ fontStack :: [FontStyle], font :: Font, langu :: Maybe String,
+ forms :: Map String Int, lastChar :: Char, lastFontChanged :: Bool, getInCaption :: Bool, vector:: Bool}
+@@ -61,7 +62,7 @@ initialState
+ getInHeading = False, getInCenter = False, getInCode = False,
+ getTitle = "", templateMap = Map.fromList [], urls = Map.empty,
+ urld = BaseUrl (WikiBaseUrl ""), getGalleryNumbers = [],
+- currentUrl = "", fndict = Map.empty, tablist = [],
++ currentUrl = "", currentLabel = "", fndict = Map.empty, tablist = [],
+ tabmap = Map.empty,
+ fontStack =
+ [FontStyle{stylebase = Normal, bold = False, italic = False}],
+Index: mediawiki2latex-7.39/src/Server.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/Server.hs
++++ mediawiki2latex-7.39/src/Server.hs
+@@ -333,6 +333,13 @@ formPage m s
+ H.! A.name "msg"
+ H.! A.value (stringValue s)
+ H.tr $
++ do H.td "Chapter Exclude Regex (for Bookmode)"
++ H.td $
++ do H.input H.! A.style wwidth H.! A.type_ "text" H.!
++ A.id "msgEx"
++ H.! A.name "msgEx"
++ H.! A.value (stringValue s)
++ H.tr $
+ do H.td "Output Format"
+ H.td $
+ do H.select H.! A.style wwidth H.! A.name "output" $
+@@ -395,6 +402,7 @@ formPage m s
+ processForm :: ServerPart Response
+ processForm
+ = do msg <- lookBS "msg"
++ msgEx <- lookBS "msgEx"
+ paperOpt <- lookBS "paper"
+ vectorOpt <- lookBS "vector"
+ expansion <- lookBS "expansion"
+@@ -420,6 +428,7 @@ formPage m s
+ (toString (toStrict msg)))
+ then getRunmode ("BookMode" :: [Char]) else
+ getRunmode (toString (toStrict expansion)),
++ chapExcl = if (toString (toStrict msgEx)) == "" then "^$" else toString (toStrict msgEx),
+ paper = (toString (toStrict paperOpt)),
+ vector =
+ (toString (toStrict vectorOpt)) ==
+Index: mediawiki2latex-7.39/src/mediawiki2latex.hs
+===================================================================
+--- mediawiki2latex-7.39.orig/src/mediawiki2latex.hs
++++ mediawiki2latex-7.39/src/mediawiki2latex.hs
+@@ -32,6 +32,7 @@ data Flag = Verbose
+ | Featured String
+ | MediaWiki
+ | BookMode
++ | ChapExcl String
+ | HTML
+ | InternalTemplates
+ | Hex String
+@@ -97,6 +98,11 @@ mediawiki = "mediawiki"
+ bookmode :: String
+ bookmode = "bookmode"
+
++{-DHUN| String constant on for the chapexcl command line option. DHUN-}
++
++chapexcl :: String
++chapexcl = "chapexcl"
++
+ {-DHUN| String constant on for the html command line option. DHUN-}
+
+ html :: String
+@@ -172,6 +178,8 @@ options
+ "only include urls which a children of start url",
+ Option ['k'] [bookmode] (NoArg Main.BookMode)
+ "use book-namespace mode for expansion",
++ Option ['K'] [chapexcl] (ReqArg ChapExcl "REGEX")
++ "regex to exclude chapters in bookmode",
+ Option ['z'] [Main.zip] (NoArg Main.Zip)
+ "output zip archive of latex source",
+ Option ['b'] [epubOption] (NoArg Main.EPub) "output epub file",
+@@ -254,6 +262,12 @@ inputPredicate :: Flag -> Maybe String
+ inputPredicate (Input x) = Just x
+ inputPredicate _ = Nothing
+
++{-DHUN| predicate for the chapexcl option. see atMostOne and exactlyOne functions for details DHUN-}
++
++chapexclPredicate :: Flag -> Maybe String
++chapexclPredicate (ChapExcl x) = Just x
++chapexclPredicate _ = Nothing
++
+ {-DHUN| predicate for the templates option. see atMostOne and exactlyOne functions for details DHUN-}
+
+ templatesPredicate :: Flag -> Maybe String
+@@ -326,6 +340,7 @@ checkOpts cwd o
+ FullConfig{ImperativeState.headers = Nothing,
+ resolution = 300, outputFilename = "",
+ inputUrl = "", runMode = ImperativeState.HTML ImperativeState.No,
++ chapExcl = "^$",
+ paper = "A4", vector = False,
+ ImperativeState.copy = Nothing, mainPath = "",
+ server = Nothing, selfTest = Just (s, e),
+@@ -339,6 +354,7 @@ checkOpts cwd o
+ resolution = 300, outputFilename = "",
+ inputUrl = "",
+ runMode = ImperativeState.HTML ImperativeState.No,
++ chapExcl = "^$",
+ paper = "A4", vector = False,
+ ImperativeState.copy = Nothing,
+ mainPath = "", server = Just z,
+@@ -361,6 +377,10 @@ checkOpts cwd o
+ _ -> Right defaultResolution
+ outputVal <- exactlyOne outputPredicate output o
+ inputVal <- exactlyOne inputPredicate url o
++ chapexclOpt <- atMostOne chapexclPredicate chapexcl o
++ chapexclVal <- case chapexclOpt of
++ Just x -> Right x
++ _ -> Right "^$"
+ templatesVal <- atMostOne templatesPredicate templates o
+ headersVal <- atMostOne headersPredicate templates o
+ copyVal <- atMostOne copyPredicate copyOption o
+@@ -408,6 +428,7 @@ checkOpts cwd o
+ selfTest = Nothing,
+ outputFilename = outputVal,
+ inputUrl = inputVal, runMode = runModeVal,
++ chapExcl = chapexclVal,
+ paper = paperVal, vector = vectorVal,
+ copy = copyVal >>= (return . (cwd </>)),
+ mainPath =
für Vanilla Quellen
- Anwendbarkeit nicht getestet, evtl. muss 10-Makefile.patch, 30-typos.patch aus den Debian Quellen vorher angewandt werden, oder patch rejects manuell eingearbeitet werden -- empfohlen wird die Arbeit mit den Debian spezifischen Quellen von mediawiki2latex, siehe obiger Abschnitt
Index: mediawiki2latex-7.39/document/headers/commands.tex
===================================================================
--- mediawiki2latex-7.39.orig/document/headers/commands.tex
+++ mediawiki2latex-7.39/document/headers/commands.tex
@@ -85,7 +85,8 @@
\addtolength{\fnwidth}{-10mm}
\newcommand{\myhref}[2]
-{{#2}\protect\footnote{ \begin{minipage}{\fnwidth} \ttfamily \url{#1} \end{minipage}}}
+%{{#2}\protect\footnote{ \begin{minipage}{\fnwidth} \ttfamily \url{#1} \end{minipage}}}
+{\href{#1}{#2}}
\newcommand{\mylref}[2]
{{#2}\protect\footnote{\mychapterbabel {$\text{}$} \ref{#1} \mypagebabel {$\text{}$} \pageref{#1}}}
Index: mediawiki2latex-7.39/mediawiki2latex.cabal
===================================================================
--- mediawiki2latex-7.39.orig/mediawiki2latex.cabal
+++ mediawiki2latex-7.39/mediawiki2latex.cabal
@@ -149,7 +149,9 @@ Executable mediawiki2latex
cereal,
network >= 2.3.0.13,
tagsoup,
- word8
+ word8,
+ regex-tdfa,
+ regex-tdfa-text
Other-Modules:
All
@@ -159,6 +161,7 @@ Executable mediawiki2latex
FontTool
GetImages
Hex
+ HtmlParser
HtmlRenderer
ImperativeState
LatexRenderer
Index: mediawiki2latex-7.39/src/ImperativeState.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/ImperativeState.hs
+++ mediawiki2latex-7.39/src/ImperativeState.hs
@@ -128,7 +128,7 @@ data ConvertState = NewTree String | Tre
data FullConfig = FullConfig{headers :: Maybe String,
resolution :: Integer, outputFilename :: String,
- inputUrl :: String, runMode :: RunMode, paper :: String,
+ inputUrl :: String, runMode :: RunMode, chapExcl :: String, paper :: String,
vector :: Bool, copy :: Maybe String, mainPath :: String,
server :: Maybe Int, outputType :: OutputType,
selfTest :: Maybe (Integer, Integer), compile :: Maybe String,
@@ -141,4 +141,4 @@ fullconfigbase
outputFilename = "", inputUrl = "", runMode = HTML No, paper = "A4",
vector = False, copy = Nothing, mainPath = "", server = Nothing,
outputType = PlainPDF, selfTest = Nothing, compile = Nothing,
- imgctrb = Nothing, convert =Nothing, noparent=False}
+ imgctrb = Nothing, convert =Nothing, noparent=False, chapExcl = "^$"}
Index: mediawiki2latex-7.39/src/LatexRenderer.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/LatexRenderer.hs
+++ mediawiki2latex-7.39/src/LatexRenderer.hs
@@ -1009,6 +1009,8 @@ templateProcessor st ("main", ll)
= (st,
"Main Page: " ++
(wikiLinkToLaTeX (Map.findWithDefault [] "1" ll) st))
+templateProcessor st ("Dieser Artikel", _)
+ = (st, "")
templateProcessor st ("#invoke:Mathe f\252r Nicht-Freaks/Seite", _)
= (st, "")
templateProcessor st ("#invoke:Liste", _) = (st, "")
@@ -2434,6 +2436,15 @@ treeToLaTeX2 ll
= do d <- treeToLaTeX2 l
return $ prefix ++ d ++ postfix
+ walkhdr :: String -> [Anything Char] -> String -> String -> Renderer String
+ walkhdr prefix l postfix nestlvl
+ = do st <- get
+ case nestlvl of
+ (_ : []) -> return $ prefix ++ (if trim (currentLabel st) == ""
+ then trim (currentUrl st)
+ else trim (currentLabel st)) ++ postfix
+ _ -> walktrim prefix l postfix
+
walktrim :: String -> [Anything Char] -> String -> Renderer String
walktrim prefix l postfix
= do st <- get
@@ -2632,15 +2643,13 @@ treeToLaTeX2 ll
= do st <- get
if (getInTab st) > 0 then
walktrim ("{\\Large ") (uncenter l) ("}\n") else
- walktrim ("\\" ++ (getsec s) ++ "{") (uncenter l)
- ("}\n" ++ (getsecpost s))
+ walkhdr ("\\" ++ (getsec s) ++ "{") (uncenter l) ("}\n" ++ (getsecpost s)) s
nodeToLaTeX (Environment Tag (TagAttr ('h' : (x : [])) _) l)
= if x `elem` "123456" then
case reads [x] of
[] -> walk "" l ""
((y, _) : _) -> let s = replicate y '=' in
- walktrim ("\\" ++ (getsec s) ++ "{") (uncenter l)
- ("}\n" ++ (getsecpost s))
+ walkhdr ("\\" ++ (getsec s) ++ "{") (uncenter l) ("}\n" ++ (getsecpost s)) s
else walk "" l ""
nodeToLaTeX (Environment Bold _ l) = walkbf l
nodeToLaTeX (Environment Italic _ l) = walkit l
@@ -2650,8 +2659,10 @@ treeToLaTeX2 ll
nodeToLaTeX (Environment Tag (TagAttr "sup" _) l)
= do st <- get
walk ((fontsetter (font st)) ++ "\\textsuperscript{") l "}"
- nodeToLaTeX (Environment Tag (TagAttr "li" _) l)
- = walk "\\item{}" l ""
+ nodeToLaTeX (Environment Tag (TagAttr "li" a) l)
+ = case Map.lookup "id" a of
+ Just x | "footer-info" `isPrefixOf` x -> if "lastmod" `isSuffixOf` x then walkit l else return $ ""
+ _ -> walk "\\item{}" l ""
nodeToLaTeX (Environment Tag (TagAttr "a" d) l)
= do st <- get
if getInHeading st then treeToLaTeX2 l else
@@ -2683,14 +2694,15 @@ treeToLaTeX2 ll
"}" ++ (itemEnvironmentParameters ":" (getF st)) ++ "\n\\item{}")
l
("\n\\end{" ++ (itemEnvironmentName ":" (getF st)) ++ "}\n")
- nodeToLaTeX (Environment Tag (TagAttr "ul" _) l)
+ nodeToLaTeX (Environment Tag (TagAttr "footer" _) l) = walk "" l ""
+ nodeToLaTeX (Environment Tag (TagAttr "ul" a) l)
= do st <- get
- walk
- ("\n\\begin{" ++
- (itemEnvironmentName "*" (getF st)) ++
- "}" ++ (itemEnvironmentParameters "*" (getF st)))
- l
- ("\n\\end{" ++ (itemEnvironmentName "*" (getF st)) ++ "}\n")
+ case Map.lookup "id" a of
+ Just g | "footer-" `isPrefixOf` g && g /= "footer-info" -> return $ ""
+ _ -> walk ("\n\\begin{" ++ (itemEnvironmentName "*" (getF st)) ++
+ "}" ++ (itemEnvironmentParameters "*" (getF st)))
+ l
+ ("\n\\end{" ++ (itemEnvironmentName "*" (getF st)) ++ "}\n")
nodeToLaTeX (Environment Tag (TagAttr "dir" _) l)
= do st <- get
walk
@@ -2807,10 +2819,11 @@ treeToLaTeX2 ll
Nothing -> ""
Just _ -> "}"
in
- if (Map.member "class" a) then
- if (Map.findWithDefault [] "class" a) `elem` ["noprint", "topicon"]
- then return $ beg ++ en else walk beg l en
- else walk beg l en
+ if (Map.member "id" a) && (Map.findWithDefault [] "id" a) `elem` ["Vorlage_Dieser_Artikel", "Vorlage_Weiterleitungshinweis"]
+ then return $ ""
+ else if (Map.member "class" a) && (Map.findWithDefault [] "class" a) `elem` ["noprint", "topicon"]
+ then return $ beg ++ en
+ else walk beg l en
nodeToLaTeX (Environment Tag (TagAttr "span" a) l)
= if (Map.member "class" a) then
if
@@ -2912,6 +2925,10 @@ treeToLaTeX2 ll
= do st <- get
put st{currentUrl = shallowFlatten l}
return ""
+ nodeToLaTeX (Environment DhunLabel _ l)
+ = do st <- get
+ put st{currentLabel = shallowFlatten l}
+ return ""
nodeToLaTeX (Environment NoWiki _ l) = walk "" l ""
nodeToLaTeX (Environment HDevLine _ l) = walk "" l ""
nodeToLaTeX (Environment PageBreak _ _) = return "\\pagebreak "
Index: mediawiki2latex-7.39/src/Load.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/Load.hs
+++ mediawiki2latex-7.39/src/Load.hs
@@ -14,7 +14,7 @@ import Text.Parsec.Prim
import Codec.Binary.UTF8.String as C
import Data.String.HT
import Data.ByteString as B
- hiding (takeWhile, isInfixOf, intercalate, concat, map, sort)
+ hiding (dropWhile, takeWhile, isInfixOf, intercalate, concat, map, sort)
import Data.List.Split
import Data.Map as Map hiding (map)
import Data.List hiding (lookup)
@@ -28,6 +28,8 @@ import System.Process
import HtmlParser (parseHtml)
import Data.Serialize as S (encode, decode)
import Data.Maybe (fromMaybe)
+import Text.Regex.TDFA
+import Text.Regex.TDFA.Text ()
notendyet ::
@@ -155,28 +157,32 @@ runqBookIncludeAction dir
qBookIncludeActionbase :: FullConfig-> WikiUrl -> String -> ImperativeMonad String
qBookIncludeActionbase cfg wurl text
- = if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}") else if isInfixOf "Category:" text then return ""
- else
- do pp <- (liftIO (print d)) >> myfun
- case pp of
- Just p -> do _ <- addContributors d Nothing
- x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\n" ++ p)
- st <- get
- systempdir <- liftIO getTemporaryDirectory
- tempdir <- liftIO $
- createTempDirectory systempdir "MediaWiki2LaTeXParser"
- liftIO $ Tools.writeFile (tempdir </> "input") x
- _ <- liftIO $
- system
- ("mediawiki2latex -x " ++
- (Hex.hex (show (fullconfigbase{compile = Just tempdir, runMode= runMode cfg}))))
- case (loadacu st) of
- Right base -> do t <- liftIO $ B.readFile (tempdir </> "output")
- put st{loadacu = Right ((case S.decode t of {Right k->k;_->[]})++ base :: [Anything Char])}
- Left base -> put st{loadacu = Left (tempdir: base)}
- return x
- _ -> return ""
+ = if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}")
+ else if isInfixOf "Category:" text then return ""
+ else if isInfixOf "Kategorie:" text then return ""
+ else if d =~ (chapExcl cfg) || e /= "" && e =~ (chapExcl cfg) then return ""
+ else
+ do pp <- (liftIO (print d)) >> myfun
+ case pp of
+ Just p -> do _ <- addContributors d Nothing
+ x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\ndhunparserlabel " ++ e ++ "\n\n" ++ p)
+ st <- get
+ systempdir <- liftIO getTemporaryDirectory
+ tempdir <- liftIO $
+ createTempDirectory systempdir "MediaWiki2LaTeXParser"
+ liftIO $ Tools.writeFile (tempdir </> "input") x
+ _ <- liftIO $
+ system
+ ("mediawiki2latex -x " ++
+ (Hex.hex (show (fullconfigbase{compile = Just tempdir, runMode= runMode cfg}))))
+ case (loadacu st) of
+ Right base -> do t <- liftIO $ B.readFile (tempdir </> "output")
+ put st{loadacu = Right ((case S.decode t of {Right k->k;_->[]})++ base :: [Anything Char])}
+ Left base -> put st{loadacu = Left (tempdir: base)}
+ return x
+ _ -> return ""
where d = (trim (takeWhile (/= '|') text))
+ e = (trim (dropWhile (== '|') (dropWhile (/= '|') text) ))
myfun = case (runMode cfg) of
HTML _ -> liftIO (getBookpage d (wurl))
(ExpandedTemplates _) -> (loadMediaWiki d wurl) >>= (return . Just)
@@ -186,11 +192,16 @@ qBookIncludeAction :: FullConfig-> WikiU
qBookIncludeAction cfg wurl text
= do sst <- get
case (loadacu sst) of
- Right _ -> if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}") else if isInfixOf "Category:" text then return "" else if (noparent cfg) && case text of {'/':_->False; _->True} &&(fromMaybe False (wurl >>= (return.not.((flip Data.List.isPrefixOf) text).(intercalate "/").(Data.List.dropWhile (=="wiki")).(splitOn "/").url_path.fst))) then return "" else
+ Right _ -> if isInfixOf "Vorlage" text then return ("{{" ++ text ++ "}}")
+ else if isInfixOf "Category:" text then return ""
+ else if isInfixOf "Kategorie:" text then return ""
+ else if d =~ (chapExcl cfg) || e /= "" && e =~ (chapExcl cfg) then return ""
+ else if (noparent cfg) && case text of {'/':_->False; _->True} && (fromMaybe False (wurl >>= (return.not.((flip Data.List.isPrefixOf) text).(intercalate "/").(Data.List.dropWhile (=="wiki")).(splitOn "/").url_path.fst))) then return ""
+ else
do pp <- (liftIO (print d)) >> myfun
case pp of
Just p -> do _ <- addContributors d Nothing
- x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\n" ++ p)
+ x <- noinclude wurl ("\n\ndhunparserurl " ++ d ++ "\n\ndhunparserlabel " ++ e ++ "\n\n" ++ p)
st <- get
systempdir <- liftIO getTemporaryDirectory
tempdir <- liftIO $ createTempDirectory systempdir "MediaWiki2LaTeXParser"
@@ -215,6 +226,7 @@ qBookIncludeAction cfg wurl text
where d = (trim (takeWhile (/= '|') text))
+ e = (trim (dropWhile (== '|') (dropWhile (/= '|') text) ))
myfun = case (runMode cfg) of
HTML _ -> liftIO (getBookpage d (wurl))
(ExpandedTemplates _) -> (loadMediaWiki d wurl) >>= (return . Just)
Index: mediawiki2latex-7.39/src/MagicStrings.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/MagicStrings.hs
+++ mediawiki2latex-7.39/src/MagicStrings.hs
@@ -543,7 +543,7 @@ goodtags1
"sup", "big", "del", "map", "bdo", "var", "dfn", "kbd", "col",
"ins", "bdi", "dir", "img", "h1", "h2", "h3", "h4", "h5", "h6",
"li", "ul", "ol", "tt", "dd", "dl", "dt", "hr", "em", "b", "i",
- "s", "u", "p", "q", "a"]
+ "s", "u", "p", "q", "a", "header", "footer", "nav"]
{-DHUN| HTML tags for tables rows in tables and so on, only lower case DHUN-}
Index: mediawiki2latex-7.39/src/MediaWikiParseTree.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/MediaWikiParseTree.hs
+++ mediawiki2latex-7.39/src/MediaWikiParseTree.hs
@@ -48,6 +48,7 @@ data EnvType = Wikilink
| ForbiddenTag
| Preformat
| DhunUrl
+ | DhunLabel
| Sub
| Sup
| Label
Index: mediawiki2latex-7.39/src/MediaWikiParser.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/MediaWikiParser.hs
+++ mediawiki2latex-7.39/src/MediaWikiParser.hs
@@ -402,7 +402,7 @@ wikilinkwhere = [TableColSep, TableHeadC
minparsers :: [MyParser Char]
minparsers
- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
+ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
pagebreakp, htmlcharp, p302p, attrp, greekp, brparser, mytablep,
mytrsepp2, mytcolsepp2, mytcapp2, mythcolsepp2, annop, tagparser,
tagparserp, tagparser2, tagparser2p, tagparsert, tagparsert,
@@ -413,7 +413,7 @@ minparsers
htmlminparsers :: [MyParser Char]
htmlminparsers
- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
+ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
pagebreakp, htmlcharp, p302p, attrp, greekp, brparser, htmytablep,
htmytrsepp, htmytcolsepp, htmytcapp, htmythcolsepp, tagparser,
tagparserp, tagparser2, tagparser2p, tagparsert, tagparsert,
@@ -429,7 +429,7 @@ imgparsers = [supp, subp, htmlcharp, p30
parsers :: [MyParser Char]
parsers
- = [doctagparser, metatagparser, supp, subp, dhunurlp, itagparser,
+ = [doctagparser, metatagparser, supp, subp, dhunurlp, dhunlabelp, itagparser,
chapterp, prep, pagebreakp, htmlcharp, p302p, attrp, greekp,
brparser, wikilinkp, wikitablep, mytablep, wikiheadingp,
itempgrouppt, itempgroupp, itemlinep, boldp, italicp, tablecapp,
@@ -532,6 +532,15 @@ dhunurlp
end = \ _ -> string "\n" >> return (), self = DhunUrl,
allowed = [Root, Tag]}
+dhunlabelp :: MyParser Char
+dhunlabelp
+ = baseParser{start =
+ \ _ ->
+ do _ <- string "\ndhunparserlabel "
+ return (Str ""),
+ end = \ _ -> string "\n" >> return (), self = DhunLabel,
+ allowed = [Root, Tag]}
+
{-DHUN| parses a Greek HTML entity. So a Greek letter or something similar DHUN-}
greekp :: MyParser Char
Index: mediawiki2latex-7.39/src/MyState.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/MyState.hs
+++ mediawiki2latex-7.39/src/MyState.hs
@@ -42,7 +42,8 @@ data MyState = MyState{getImages :: [Str
getInCode :: Bool, getTitle :: String,
templateMap :: Map String [String], urls :: Map String String,
urld :: WikiUrlData, getGalleryNumbers :: [Integer],
- currentUrl :: String, fndict :: Map String [Anything Char],
+ currentUrl :: String, currentLabel :: String,
+ fndict :: Map String [Anything Char],
tablist :: [[String]], tabmap :: Map Int (Map Int Double),
fontStack :: [FontStyle], font :: Font, langu :: Maybe String,
forms :: Map String Int, lastChar :: Char, lastFontChanged :: Bool, getInCaption :: Bool, vector:: Bool}
@@ -61,7 +62,7 @@ initialState
getInHeading = False, getInCenter = False, getInCode = False,
getTitle = "", templateMap = Map.fromList [], urls = Map.empty,
urld = BaseUrl (WikiBaseUrl ""), getGalleryNumbers = [],
- currentUrl = "", fndict = Map.empty, tablist = [],
+ currentUrl = "", currentLabel = "", fndict = Map.empty, tablist = [],
tabmap = Map.empty,
fontStack =
[FontStyle{stylebase = Normal, bold = False, italic = False}],
Index: mediawiki2latex-7.39/src/Server.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/Server.hs
+++ mediawiki2latex-7.39/src/Server.hs
@@ -333,6 +333,13 @@ formPage m s
H.! A.name "msg"
H.! A.value (stringValue s)
H.tr $
+ do H.td "Chapter Exclude Regex (for Bookmode)"
+ H.td $
+ do H.input H.! A.style wwidth H.! A.type_ "text" H.!
+ A.id "msgEx"
+ H.! A.name "msgEx"
+ H.! A.value (stringValue s)
+ H.tr $
do H.td "Output Format"
H.td $
do H.select H.! A.style wwidth H.! A.name "output" $
@@ -395,6 +402,7 @@ formPage m s
processForm :: ServerPart Response
processForm
= do msg <- lookBS "msg"
+ msgEx <- lookBS "msgEx"
paperOpt <- lookBS "paper"
vectorOpt <- lookBS "vector"
expansion <- lookBS "expansion"
@@ -420,6 +428,7 @@ formPage m s
(toString (toStrict msg)))
then getRunmode ("BookMode" :: [Char]) else
getRunmode (toString (toStrict expansion)),
+ chapExcl = if (toString (toStrict msgEx)) == "" then "^$" else toString (toStrict msgEx),
paper = (toString (toStrict paperOpt)),
vector =
(toString (toStrict vectorOpt)) ==
Index: mediawiki2latex-7.39/src/mediawiki2latex.hs
===================================================================
--- mediawiki2latex-7.39.orig/src/mediawiki2latex.hs
+++ mediawiki2latex-7.39/src/mediawiki2latex.hs
@@ -32,6 +32,7 @@ data Flag = Verbose
| Featured String
| MediaWiki
| BookMode
+ | ChapExcl String
| HTML
| InternalTemplates
| Hex String
@@ -97,6 +98,11 @@ mediawiki = "mediawiki"
bookmode :: String
bookmode = "bookmode"
+{-DHUN| String constant on for the chapexcl command line option. DHUN-}
+
+chapexcl :: String
+chapexcl = "chapexcl"
+
{-DHUN| String constant on for the html command line option. DHUN-}
html :: String
@@ -172,6 +178,8 @@ options
"only include urls which a children of start url",
Option ['k'] [bookmode] (NoArg Main.BookMode)
"use book-namespace mode for expansion",
+ Option ['K'] [chapexcl] (ReqArg ChapExcl "REGEX")
+ "regex to exclude chapters in bookmode",
Option ['z'] [Main.zip] (NoArg Main.Zip)
"output zip archive of latex source",
Option ['b'] [epubOption] (NoArg Main.EPub) "output epub file",
@@ -254,6 +262,12 @@ inputPredicate :: Flag -> Maybe String
inputPredicate (Input x) = Just x
inputPredicate _ = Nothing
+{-DHUN| predicate for the chapexcl option. see atMostOne and exactlyOne functions for details DHUN-}
+
+chapexclPredicate :: Flag -> Maybe String
+chapexclPredicate (ChapExcl x) = Just x
+chapexclPredicate _ = Nothing
+
{-DHUN| predicate for the templates option. see atMostOne and exactlyOne functions for details DHUN-}
templatesPredicate :: Flag -> Maybe String
@@ -326,6 +340,7 @@ checkOpts cwd o
FullConfig{ImperativeState.headers = Nothing,
resolution = 300, outputFilename = "",
inputUrl = "", runMode = ImperativeState.HTML ImperativeState.No,
+ chapExcl = "^$",
paper = "A4", vector = False,
ImperativeState.copy = Nothing, mainPath = "",
server = Nothing, selfTest = Just (s, e),
@@ -339,6 +354,7 @@ checkOpts cwd o
resolution = 300, outputFilename = "",
inputUrl = "",
runMode = ImperativeState.HTML ImperativeState.No,
+ chapExcl = "^$",
paper = "A4", vector = False,
ImperativeState.copy = Nothing,
mainPath = "", server = Just z,
@@ -361,6 +377,10 @@ checkOpts cwd o
_ -> Right defaultResolution
outputVal <- exactlyOne outputPredicate output o
inputVal <- exactlyOne inputPredicate url o
+ chapexclOpt <- atMostOne chapexclPredicate chapexcl o
+ chapexclVal <- case chapexclOpt of
+ Just x -> Right x
+ _ -> Right "^$"
templatesVal <- atMostOne templatesPredicate templates o
headersVal <- atMostOne headersPredicate templates o
copyVal <- atMostOne copyPredicate copyOption o
@@ -408,6 +428,7 @@ checkOpts cwd o
selfTest = Nothing,
outputFilename = outputVal,
inputUrl = inputVal, runMode = runModeVal,
+ chapExcl = chapexclVal,
paper = paperVal, vector = vectorVal,
copy = copyVal >>= (return . (cwd </>)),
mainPath =
Licenciamento
- Pode:
- partilhar – copiar, distribuir e transmitir a obra
- recombinar – criar obras derivadas
- De acordo com as seguintes condições:
- atribuição – Tem de fazer a devida atribuição da autoria, fornecer uma hiperligação para a licença e indicar se foram feitas alterações. Pode fazê-lo de qualquer forma razoável, mas não de forma a sugerir que o licenciador o apoia ou subscreve o seu uso da obra.
- partilha nos termos da mesma licença – Se remisturar, transformar ou ampliar o conteúdo, tem de distribuir as suas contribuições com a mesma licença ou uma licença compatível com a original.
Elementos retratados neste ficheiro
retrata
Um valor sem um elemento no repositório Wikidata
28 abril 2021
application/pdf
615b61bcb2ca514f29a32760cbf36b58ab98ef05
222 047 417 byte
1 752 pixel
1 239 pixel
Histórico do ficheiro
Clique uma data e hora para ver o ficheiro tal como ele se encontrava nessa altura.
Data e hora | Miniatura | Dimensões | Utilizador | Comentário | |
---|---|---|---|---|---|
atual | 04h19min de 28 de abril de 2021 | 1 239 × 1 752, 966 páginas (211,76 MB) | Cmuelle8 | Uploaded own work with UploadWizard |
Utilização local do ficheiro
Não há nenhuma página que use este ficheiro.
Metadados
Este ficheiro contém informação adicional, provavelmente adicionada a partir da câmara digital ou scanner utilizada para criar ou digitalizar a imagem. Caso o ficheiro tenha sido modificado a partir do seu estado original, alguns detalhes poderão não refletir completamente as mudanças efetuadas.
Software utilizado | LaTeX with hyperref |
---|---|
Programa de conversão | xdvipdfmx (20190824) |
Criptografado | no |
Tamanho da página | 595.28 x 841.89 pts (A4) |
Versão do formato PDF | 1.5 |