packages feed

fmark (empty) → 0.1.0

raw patch · 8 files changed

+161/−0 lines, 8 filesdep +Unixutilsdep +basedep +directorysetup-changedbinary-added

Dependencies added: Unixutils, base, directory, filepath, mtl, process

Files

+ LICENSE view
@@ -0,0 +1,30 @@+Copyright (c) 2012, José Lopes++All rights reserved.++Redistribution and use in source and binary forms, with or without+modification, are permitted provided that the following conditions are met:++    * Redistributions of source code must retain the above copyright+      notice, this list of conditions and the following disclaimer.++    * Redistributions in binary form must reproduce the above+      copyright notice, this list of conditions and the following+      disclaimer in the documentation and/or other materials provided+      with the distribution.++    * Neither the name of José Lopes nor the names of other+      contributors may be used to endorse or promote products derived+      from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS+"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT+LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR+A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT+OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE+OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ Setup.hs view
@@ -0,0 +1,2 @@+import Distribution.Simple+main = defaultMain
+ doc/examples/example view
@@ -0,0 +1,23 @@+My first Fmark document [with style]+José Lopes+Sunday, Sep 4 2012++  Fmark (Friendly Markup) is a very simple markup language without+  syntax, capable of producing PDF and XML files, and very simple+  document but sophisticated styling.++The first section++Hello, welcome to Fmark.+This is the first section of your document.++  The first subsection++  It is very simple to create subsections. No special characters are+  needed. Simply use indentation to indicate the beginning and end of+  your sections.++  The second subsection++  Another subsection with a different title and a [footnote in square+  bracket]. Again very simple.
+ doc/examples/example.pdf view

binary file changed (absent → 96342 bytes)

+ doc/examples/example.style view
@@ -0,0 +1,5 @@+Title [Subtitle]+Author+Date++  Abstract.
+ doc/examples/exampleNoStyle.pdf view

binary file changed (absent → 32556 bytes)

+ fmark.cabal view
@@ -0,0 +1,40 @@+name:                fmark+version:             0.1.0+homepage:            http://github.com/jabolopes/fmark+bug-reports:         http://github.com/jabolopes/fmark/issues+synopsis:            A Friendly Markup language without syntax.+description:         Fmark (Friendly Markup) is a very simple markup language without+                     syntax and simple but sophisticated document styling, capable of+                     producing PDF and XML files.+license:             BSD3+license-file:        LICENSE+author:              José Lopes+maintainer:          José Lopes <jabolopes@gmail.com>+stability:           Experimental+category:            Typography++build-type:          Simple+cabal-version:       >=1.8++data-files:+  doc/examples/example+  doc/examples/example.pdf+  doc/examples/example.style+  doc/examples/exampleNoStyle.pdf++executable fmark+  main-is:             Main.hs+  extensions:	       DoAndIfThenElse+  hs-source-dirs:      src+  -- other-modules:       +  build-depends:+        base == 4.5.*,+        mtl == 2.1.*,+        directory == 1.1.*,+        filepath == 1.3.*,+        process == 1.1.*,+        Unixutils == 1.50.*++source-repository head+  type:     git+  location: http://github.com/jabolopes/fmark.git
+ src/Main.hs view
@@ -0,0 +1,61 @@+module Main where++import Data.List (intercalate, dropWhileEnd)++import System.Console.GetOpt+import System.Environment (getArgs, getProgName)+import System.IO+++import Fmark+++-- | 'options' represents the command line options.+options = [Option "d" ["doc"] (NoArg OutputDoc) "Output doc",+           Option "l" ["latex"] (NoArg OutputLatex) "Output latex",+           Option "p" ["pdf"] (NoArg OutputPdf) "Output PDF",+           Option "s" ["style"] (ReqArg StyleName "style-name") "Style",+           Option "x" ["xml"] (NoArg OutputXml) "Output xml",+           Option [] ["help"] (NoArg Help) "Display help"]+++-- | 'main'.+main =+    do args <- getArgs+       case getOpt Permute options args of+         (opts, nonOpts, []) -> processOpts opts nonOpts+         (_, _, errs) -> do putErrors errs+                            putUsage+    where header progName = "Usage: " ++ progName ++ " [OPTION...] files..."++          putUsage =+              do progName <- getProgName+                 hPutStr stderr $ usageInfo (header progName) options++          putErrors errs =+              hPutStrLn stderr $ intercalate ", " $ map (dropWhileEnd (== '\n')) errs+          +          processOpts opts _ | Help `elem` opts = putUsage+          processOpts opts nonOpts =+              styleFn $ \mstyle -> (inFn $ \hIn -> fmarkH fmt hIn eOut mstyle)+              where revOpts = reverse opts+                    +                    fmt = fmt' revOpts+                        where fmt' [] = OutputDoc+                              fmt' (Help:opts) = fmt' opts+                              fmt' (StyleName _:opts) = fmt' opts+                              fmt' (flag:opts) = flag++                    styleFn = style' revOpts+                        where style' [] = \fn -> fn Nothing+                              style' (StyleName fp:opts) = \fn -> withFile fp ReadMode $ \h -> fn $ Just h+                              style' (_:opts) = style' opts++                    inFn = case nonOpts of+                             [] -> \fn -> fn stdin+                             _ -> withFile (last nonOpts) ReadMode++                    eOut = case nonOpts of+                             [] | fmt == OutputPdf -> error "cannot use stdin with PDF output format"+                             _ | fmt == OutputPdf -> Right $ last nonOpts+                             _ -> Left stdout