From ace1b98b247b32e719a72a04fafe9fbffc1c49b0 Mon Sep 17 00:00:00 2001 From: pho Date: Wed, 24 Oct 2007 15:15:14 +0900 Subject: [PATCH] Implemented dummy trackback commands darcs-hash:20071024061514-62b54-b7cf1ed1b108702cba371091df744f5e9976d42a.gz --- Rakka.cabal | 2 +- Rakka/Environment.hs | 8 ++++--- Rakka/Page.hs | 8 ++++++- Rakka/Plugin.hs | 31 ------------------------- Rakka/Wiki/Interpreter/Trackback.hs | 35 +++++++++++++++++++++++++++++ Rakka/Wiki/Parser.hs | 3 +-- defaultPages/SideBar/Left | 4 ++++ defaultPages/StyleSheet/Default | 29 +++++++++++++++++------- 8 files changed, 74 insertions(+), 46 deletions(-) delete mode 100644 Rakka/Plugin.hs create mode 100644 Rakka/Wiki/Interpreter/Trackback.hs diff --git a/Rakka.cabal b/Rakka.cabal index 7df3dc4..c250b7e 100644 --- a/Rakka.cabal +++ b/Rakka.cabal @@ -42,7 +42,6 @@ Main-Is: Other-Modules: Rakka.Environment Rakka.Page - Rakka.Plugin Rakka.Resource Rakka.Resource.Index Rakka.Resource.Object @@ -55,6 +54,7 @@ Other-Modules: Rakka.Wiki.Interpreter Rakka.Wiki.Interpreter.Base Rakka.Wiki.Interpreter.Image + Rakka.Wiki.Interpreter.Trackback Rakka.Wiki.Interpreter.Outline Rakka.Wiki.Engine Rakka.Wiki.Formatter diff --git a/Rakka/Environment.hs b/Rakka/Environment.hs index 48105b4..e52f4ef 100644 --- a/Rakka/Environment.hs +++ b/Rakka/Environment.hs @@ -12,9 +12,10 @@ import qualified Network.HTTP.Lucu.Config as LC import Rakka.Storage import Rakka.SystemConfig import Rakka.Wiki.Interpreter -import qualified Rakka.Wiki.Interpreter.Base as Base -import qualified Rakka.Wiki.Interpreter.Image as Image -import qualified Rakka.Wiki.Interpreter.Outline as Outline +import qualified Rakka.Wiki.Interpreter.Base as Base +import qualified Rakka.Wiki.Interpreter.Image as Image +import qualified Rakka.Wiki.Interpreter.Trackback as Trackback +import qualified Rakka.Wiki.Interpreter.Outline as Outline import Subversion.Repository import System.Directory import System.FilePath @@ -69,6 +70,7 @@ mkInterpTable :: InterpTable mkInterpTable = listToTable $ foldl (++) [] [ Base.interpreters , Image.interpreters + , Trackback.interpreters , Outline.interpreters ] where diff --git a/Rakka/Page.hs b/Rakka/Page.hs index 93c7465..29f0964 100644 --- a/Rakka/Page.hs +++ b/Rakka/Page.hs @@ -6,6 +6,7 @@ module Rakka.Page , mkPageURI , mkPageFragmentURI , mkObjectURI + , mkAuxiliaryURI ) where @@ -78,6 +79,11 @@ mkPageFragmentURI baseURI name fragment mkObjectURI :: URI -> PageName -> URI mkObjectURI baseURI name + = mkAuxiliaryURI baseURI ["object"] name + + +mkAuxiliaryURI :: URI -> [String] -> PageName -> URI +mkAuxiliaryURI baseURI basePath name = baseURI { - uriPath = foldl combine "/" [uriPath baseURI, "object", encodePageName name] + uriPath = foldl combine "/" ([uriPath baseURI] ++ basePath ++ [encodePageName name]) } diff --git a/Rakka/Plugin.hs b/Rakka/Plugin.hs deleted file mode 100644 index 930c8e0..0000000 --- a/Rakka/Plugin.hs +++ /dev/null @@ -1,31 +0,0 @@ -module Rakka.Plugin - ( Plugin(..) - , RequestHandler - , RequestContext(..) - ) - where - -import Data.Typeable -import Network.HTTP.Lucu -import Rakka.Wiki.Interpreter -import Rakka.Storage -import Rakka.SystemConfig - - -data Plugin - = Plugin { - pinInterpreters :: ![Interpreter] - , pinRequestHandlers :: ![RequestHandler] - } - deriving (Typeable) - - -type RequestHandler - = RequestContext -> [String] -> IO (Maybe ResourceDef) - - -data RequestContext - = RequestContext { - rcStorage :: !Storage - , rcSysConf :: !SystemConfig - } diff --git a/Rakka/Wiki/Interpreter/Trackback.hs b/Rakka/Wiki/Interpreter/Trackback.hs new file mode 100644 index 0000000..984c4aa --- /dev/null +++ b/Rakka/Wiki/Interpreter/Trackback.hs @@ -0,0 +1,35 @@ +module Rakka.Wiki.Interpreter.Trackback + ( interpreters + ) + where + +import Rakka.Page +import Rakka.SystemConfig +import Rakka.Wiki +import Rakka.Wiki.Interpreter + + +interpreters :: [Interpreter] +interpreters = [ trackbackURLInterp + , trackbacksInterp + ] + + +trackbackURLInterp :: Interpreter +trackbackURLInterp + = InlineCommandInterpreter { + iciName = "trackbackURL" + , iciInterpret + = \ ctx _ -> do BaseURI baseURI <- getSysConf (ctxSysConf ctx) (BaseURI undefined) + let uri = mkAuxiliaryURI baseURI ["trackback"] (ctxPageName ctx) + return $ ExternalLink uri (Just "Trackback URL") + } + + +trackbacksInterp :: Interpreter +trackbacksInterp + = BlockCommandInterpreter { + bciName = "trackbacks" + , bciInterpret + = \ _ _ -> return $ Div [("class", "trackbacks")] [] + } diff --git a/Rakka/Wiki/Parser.hs b/Rakka/Wiki/Parser.hs index 6c5d207..eb236ce 100644 --- a/Rakka/Wiki/Parser.hs +++ b/Rakka/Wiki/Parser.hs @@ -272,8 +272,7 @@ blockCmd cmdTypeOf undefinedCmdErr name = Div [("class", "error")] [ Paragraph [Text ("The command `" ++ name ++ "' is not defined. " ++ - "Ensure that you haven't mistyped and the module " ++ - "providing the command is actually loaded.") + "Make sure you haven't mistyped.") ] ] diff --git a/defaultPages/SideBar/Left b/defaultPages/SideBar/Left index d03ad83..bce6b71 100644 --- a/defaultPages/SideBar/Left +++ b/defaultPages/SideBar/Left @@ -7,8 +7,12 @@ = Menu = +* [[MainPage|Main]] +* [[Help/Syntax|Syntax Help]] = Trackbacks = + + ]]> diff --git a/defaultPages/StyleSheet/Default b/defaultPages/StyleSheet/Default index 9500b19..15d58b2 100644 --- a/defaultPages/StyleSheet/Default +++ b/defaultPages/StyleSheet/Default @@ -112,6 +112,15 @@ padding: 20px; } +.sideBar p { + margin-left: 5px; +} + +.sideBar .outline li { + margin-left: 1em; + padding: 0; +} + .sideBar li { padding: 3px; } @@ -123,10 +132,10 @@ } .sideBar li + li { - margin-top: 0.2em; + margin-top: 0.1em; } -.sideBar ul + h1 { +.sideBar * + h1 { margin-top: 1.2em; } @@ -138,10 +147,16 @@ body { background-color: white; color: black; +} +.body { line-height: 1.3; } +p { + margin: 0 0 0.8em 0; +} + h1, h2, h3, h4, h5, h6 { font-weight: normal; } @@ -221,10 +236,7 @@ a { .sideBar .outline li { list-style-type: disc; - margin-left: 1em; - - padding: 0; - line-height: 1.0; + background-color: inherit; } .sideBar .outline li li { list-style-type: circle; @@ -239,8 +251,9 @@ a { list-style-type: circle; } -p { - margin: 0 0 0.8em 0; +.sideBar li { + padding: 2px 5px; + background-color: #f5f5f5; } /* float **********************************************************************/ -- 2.40.0