Giter Site home page Giter Site logo

Plugin system about pandoc HOT 11 CLOSED

jgm avatar jgm commented on May 17, 2024
Plugin system

from pandoc.

Comments (11)

jgm avatar jgm commented on May 17, 2024

Google Code Info:
Author: [email protected]
Created On: 2008-11-06T22:23:20.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Unfortunately, dons says that the plugins library is no longer maintained.

Google Code Info:
Author: [email protected]
Created On: 2008-11-11T03:04:33.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

The hint library might be an alternative to plugins. Check to see if it is actively
maintained.

Google Code Info:
Author: [email protected]
Created On: 2008-11-12T00:57:22.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Or mueval, for more safety.

Google Code Info:
Author: [email protected]
Created On: 2008-11-12T01:06:34.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Example of use of hint, in ghci:

:m + Language.Haskell.Interpreter.GHC
:m + Text.Pandoc
inp <- readFile "README"
let y = withSession ses (setImports ["Text.Pandoc","Prelude"] >> (interpret
("writeLaTeX defaultWriterOptions $ readMarkdown defaultParserState $ " ++ show inp)
(as :: Pandoc)))
y

Google Code Info:
Author: [email protected]
Created On: 2008-11-13T07:04:02.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Note: the example above is missing
ses <- newSession
also try this:

:m + Control.Monad.Errors
e <- withSession ses (setImports ["Prelude"] >> (catchError (interpret "(+)" (as ::
Int -> Int)) (\e -> return id)))
e 2
4
e <- withSession sess (setImports ["Prelude","Text.Pandoc"] >> (interpret
"processPandoc (const Space)" (as :: Pandoc -> Pandoc)))
e $ Pandoc (Meta [] [] []) [Para [Str "Hi",Space,Emph [Str "there"]]]
Pandoc (Meta [] [] "") [Para [Space,Space,Space]]

Google Code Info:
Author: [email protected]
Created On: 2008-11-14T07:30:47.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

This is fun:
-- MyMod.hs
module MyMod (doit) where
import Text.Pandoc

doit :: Inline -> Inline
doit (Str x) = Str (x ++ "!")
doit x = x

-- GHCI:
GHCI> e <- withSession sess (loadModules ["MyMod"] >> setImports
["Prelude","Text.Pandoc","MyMod"] >> (catchError (interpret "processPandoc doit" (as
:: Pandoc -> Pandoc)) (\e -> throwError e >> return id)))
GHCI> e $ Pandoc (Meta [] [] []) [Para [Str "Hi",Space,Emph [Str "there"]]]
Pandoc (Meta [] [] "") [Para [Str "Hi!",Space,Emph [Str "there!"]]]

Google Code Info:
Author: [email protected]
Created On: 2008-11-14T07:44:03.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

The newest release of hint supports GHC 6.10.
Time to get going on this!

Google Code Info:
Author: [email protected]
Created On: 2009-01-01T05:02:50.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Or mueval, for more safety.

Mueval might work as a library, with some modification to the internal API. But given
that the code is either A) supplied by the developers and presumably vetted and
checked; or B) written by the user who has incentive to not write evil code, mueval
may be the wrong solution.

It is also relatively inefficient compared to running Hint directly, due to the
resource-limiting, process-level and thread-level watchdogs, checks to sanitize the
code, etc. That's fine for running potentially-evil code since the alternative to
running slowly & safely is not running at all.

I would suggest Hint instead of Mueval. It is pleasant to use & Daniel Gorin has
always responded quickly to my needs (for mueval development), and I don't foresee it
being abandoned anytime soon. (It certainly is currently a better solution than
hs-plugins inasmuch as the latter does not even work on 6.10.)

Google Code Info:
Author: [email protected]
Created On: 2009-01-23T21:47:21.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Actually, I've already got all the plugin stuff written, using hint.
I've just been waiting for Daniel to upload the latest version (which
he did today), since the old version didn't cabal install under ghc 6.8.

So you should see the plugin stuff, including some worked-out examples,
in the repository before too long!

Google Code Info:
Author: [email protected]
Created On: 2009-01-24T02:29:59.000Z

from pandoc.

jgm avatar jgm commented on May 17, 2024

Added as of r1526.

Google Code Info:
Author: [email protected]
Created On: 2009-01-24T20:01:26.000Z

from pandoc.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.