From: pho Date: Thu, 11 Oct 2007 23:28:28 +0000 (+0900) Subject: record before experimental changes X-Git-Url: https://git.cielonegro.org/gitweb.cgi?a=commitdiff_plain;h=ee964fa000ff558084db1477cc4edc3b85a39256;p=Rakka.git record before experimental changes darcs-hash:20071011232828-62b54-45a538761fb0c1ac01d9b32bfc223f3c0fd4dc4c.gz --- diff --git a/Rakka/Wiki.hs b/Rakka/Wiki.hs index c5c2c68..3011b13 100644 --- a/Rakka/Wiki.hs +++ b/Rakka/Wiki.hs @@ -13,7 +13,7 @@ type WikiPage = [WikiElement] data WikiElement - = Block !BlockElement + = Block !BlockElement | Inline !InlineElement deriving (Eq, Show) diff --git a/Rakka/Wiki/Formatter.hs b/Rakka/Wiki/Formatter.hs index f523938..1382769 100644 --- a/Rakka/Wiki/Formatter.hs +++ b/Rakka/Wiki/Formatter.hs @@ -5,6 +5,7 @@ module Rakka.Wiki.Formatter import Control.Arrow import Control.Arrow.ArrowList +import Data.Char import Data.List import Data.Maybe import Network.URI @@ -80,9 +81,10 @@ formatPageLink :: (ArrowXml a) => a (URI, InlineElement) XmlTree formatPageLink = proc (baseURI, PageLink page fragment text) -> let uri = case (page, fragment) of - (Just x, Just y) -> mkPageFragmentURI baseURI x y - (Just x, Nothing) -> mkPageURI baseURI x + (Just x, Just y) -> mkPageFragmentURI baseURI (fix x) y + (Just x, Nothing) -> mkPageURI baseURI (fix x) (Nothing, Just y) -> nullURI { uriFragment = ('#':y) } + fix = (\ (x:xs) -> toUpper x : xs) . map (\ c -> if c == ' ' then '_' else c) href = uriToString id uri "" dLabel = fromMaybe "" page ++ fromMaybe "" (fmap ('#':) fragment) label = fromMaybe dLabel text diff --git a/Rakka/Wiki/Parser.hs b/Rakka/Wiki/Parser.hs index 968e645..52e430a 100644 --- a/Rakka/Wiki/Parser.hs +++ b/Rakka/Wiki/Parser.hs @@ -3,7 +3,6 @@ module Rakka.Wiki.Parser ) where -import Data.Char import Rakka.Wiki import Text.ParserCombinators.Parsec @@ -73,10 +72,8 @@ text = text' >>= return . Text pageLink :: Parser InlineElement pageLink = do string "[[" - page <- option Nothing $ - do x <- satisfy (\ c -> not (elem c "#|]" || isLower c)) - xs <- many (noneOf "#|]") - return $ Just (x:xs) + page <- option Nothing + (many1 (noneOf "#|]") >>= return . Just) fragment <- option Nothing (char '#' >> many1 (noneOf "|]") >>= return . Just) text <- option Nothing diff --git a/defaultPages/Help/Syntax b/defaultPages/Help/Syntax index ece7fb9..136a295 100644 --- a/defaultPages/Help/Syntax +++ b/defaultPages/Help/Syntax @@ -12,11 +12,24 @@ ===== Heading 5 ===== -== Verbatim == +== &lt;nowiki&gt; tags == +<nowiki> +[[Wiki]] markup is ignored here +but the text is reformatted. +</nowiki> + +== &lt;pre&gt; tags == +<pre> +[[Wiki]] markup is ignored here + and reformatting is also disabled. +</pre> + +== Leading spaces == This is a - verbatim + preformatted text. + [[Foo|Wiki markup is interpretted in here.]] == Horizontal Line == ---- @@ -48,6 +61,8 @@ blah blah blah blah... == Link == * [[Page]] +* [[page]] +* [[space in a page name]] * [[Page|Link to "Page"]] * [[Page#Heading]] * [[#Heading]] diff --git a/defaultPages/MainPage b/defaultPages/MainPage index 4ab9d1e..7128d09 100644 --- a/defaultPages/MainPage +++ b/defaultPages/MainPage @@ -20,6 +20,8 @@ Another paragraph... == Link == [[Page]] +[[page]] +[[space in a page name]] [[Page|Link to "Page"]] [[Page#Heading]] [[#Heading]]