Commit bac75757 authored by Andrew Gibiansky's avatar Andrew Gibiansky

adding json demo, minor changes, soon new template

parent e49b1987
......@@ -12,7 +12,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"![IHaskell Notebook Logo](https://raw2.github.com/gibiansky/IHaskell/master/images/ihaskell-logo-small.png)\n",
"![](https://raw2.github.com/gibiansky/IHaskell/master/images/ihaskell-logo-small.png)\n",
"\n",
"IHaskell Notebook\n",
"===\n",
......@@ -311,7 +311,7 @@
"source": [
"If you're looking at this notebook after it's been exported to HTML, you won't be able to see this interactive pane. However, it looks approximately like this:\n",
"\n",
"![IPython pager info](https://raw2.github.com/gibiansky/IHaskell/master/images/info-demo.png)"
"![](https://raw2.github.com/gibiansky/IHaskell/master/images/info-demo.png)"
]
},
{
......@@ -348,7 +348,7 @@
]
}
],
"prompt_number": 14
"prompt_number": 1
},
{
"cell_type": "markdown",
......@@ -573,7 +573,16 @@
]
}
],
"prompt_number": 19
"prompt_number": 2
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This syntax highlighting may not show up in the exported HTML, as it is done on the fly with Javascript. The result looks like this in the notebook:\n",
"\n",
"![](https://raw2.github.com/gibiansky/IHaskell/master/images/json-demo.png)"
]
},
{
"cell_type": "markdown",
......@@ -587,6 +596,7 @@
"collapsed": false,
"input": [
"-- Small bits of HTML generated via Blaze are displayed.\n",
"\n",
"import Prelude hiding (div, id)\n",
"import Text.Blaze.Html4.Strict hiding (map, style)\n",
"import Text.Blaze.Html4.Strict.Attributes\n",
......@@ -596,8 +606,8 @@
" b \"Hello\"\n",
" \n",
"forM [1..5] $ \\size -> do\n",
" let s = toValue $ size * 80\n",
" img ! src \"/static/base/images/ipynblogo.png\" ! width s"
" let s = toValue $ size * 70\n",
" img ! src \"https://www.google.com/images/srpr/logo11w.png\" ! width s"
],
"language": "python",
"metadata": {},
......@@ -628,24 +638,24 @@
},
{
"html": [
"<img src=\"/static/base/images/ipynblogo.png\" width=\"80\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"160\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"240\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"320\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"400\">\n"
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"70\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"140\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"210\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"280\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"350\">\n"
],
"metadata": {},
"output_type": "display_data",
"text": [
"<img src=\"/static/base/images/ipynblogo.png\" width=\"80\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"160\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"240\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"320\">\n",
"<img src=\"/static/base/images/ipynblogo.png\" width=\"400\">"
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"70\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"140\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"210\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"280\">\n",
"<img src=\"https://www.google.com/images/srpr/logo11w.png\" width=\"350\">"
]
}
],
"prompt_number": 20
"prompt_number": 6
},
{
"cell_type": "markdown",
......@@ -1182,7 +1192,7 @@
"source": [
"Like with `:info`, the Hoogle directives use the IPython documentation pager to show you their output. You can press Escape to dismiss the pager. If you're reading this in it's HTML form, the output looks like this:\n",
"\n",
"![Documentation for filterM](https://raw2.github.com/gibiansky/IHaskell/master/images/doc-demo.png)"
"![](https://raw2.github.com/gibiansky/IHaskell/master/images/doc-demo.png)"
]
},
{
......@@ -1214,9 +1224,52 @@
"source": [
"The pager will show you documentation for things that could have that type signature or a similar one. It automatically formats inline Haskell code and hyperlinks the identifiers to their respective Haddock documentations:\n",
"\n",
"![Hoogle demo](https://raw2.github.com/gibiansky/IHaskell/master/images/hoogle-demo.png)"
"![](https://raw2.github.com/gibiansky/IHaskell/master/images/hoogle-demo.png)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If you need a refresher on all of the options, you can just use `:help`:"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [
":help"
],
"language": "python",
"metadata": {},
"outputs": [
{
"metadata": {},
"output_type": "display_data",
"text": [
"The following commands are available:\n",
" :extension <Extension> - Enable a GHC extension.\n",
" :extension No<Extension> - Disable a GHC extension.\n",
" :type <expression> - Print expression type.\n",
" :info <name> - Print all info for a name.\n",
" :hoogle <query> - Search for a query on Hoogle.\n",
" :doc <ident> - Get documentation for an identifier via Hogole.\n",
" :set <opt> - Set an option.\n",
" :set no-<opt> - Unset an option.\n",
" :?, :help - Show this help text.\n",
"\n",
"Any prefix of the commands will also suffice, e.g. use :ty for :type.\n",
"\n",
"Options:\n",
" lint - enable or disable linting.\n",
" svg - use svg output (cannot be resized).\n",
" show-types - show types of all bound names\n",
" show-errors - display Show instance missing errors normally."
]
}
],
"prompt_number": 37
},
{
"cell_type": "markdown",
"metadata": {},
......@@ -1351,14 +1404,22 @@
"Thanks!\n",
"---\n",
"\n",
"I hope you've enjoyed this little demo of **IHaskell**!\n",
"That's it for now! I hope you've enjoyed this little demo of **IHaskell**! There are still a few features that I haven't covered, such as the `show-types` and `show-errors` options, as well as the relatively intelligent autocompletion mechanism and inline type info popups.\n",
"\n",
"All of this is running using [IPython notebook][http://ipython.org], communicating asynchronously with a language evaluator kernel written in pure Haskell. \n",
"I hope you find IHaskell useful, and please report any bugs or features requests [on Github](https://github.com/gibiansky/IHaskell/issues). If you have any comments, want to contribute, or just want to get in touch, don't hesitate to contact me at Andrew dot Gibiansky at Gmail. Contributions are also more than welcome, and I'm happy to help you get started with IHaskell development if you'd like to contribute!\n",
"\n",
"In addition to code cells, you can also type Markdown, and have it be displayed as HTML - just like I'm doing with this cell.\n",
"I am also often available at `#ihaskell` on IRC at `chat.freenode.net`, so if I'm around, don't hesitate to ask questions.\n",
"\n",
"I hope you find IHaskell useful, and please report any bugs or features requests [on Github](https://github.com/gibiansky/IHaskell/issues). If you have any comments, want to contribute, or just want to get in touch, don't hesitate to contact me at Andrew dot Gibiansky at Gmail."
"Thank you to Adam Vogt, Stian H\u00e5klev, and @edechter for their testing, bug reporting, pull requests, and general patience!"
]
},
{
"cell_type": "code",
"collapsed": false,
"input": [],
"language": "python",
"metadata": {},
"outputs": []
}
],
"metadata": {}
......
......@@ -122,8 +122,9 @@ nbconvert fmt name = void . shellyNoDir $ do
Just notebook ->
let viewArgs = case fmt of
Pdf -> ["--to=latex", "--post=pdf"]
fmt -> ["--to=" ++ show fmt] in
Pdf -> ["--to=latex", "--post=pdf"]
Html -> ["--to=html", "--template=ihaskell"]
fmt -> ["--to=" ++ show fmt] in
void $ runIHaskell ipythonProfile "nbconvert" $ viewArgs ++ [fpToString notebook]
-- | Set up IPython properly.
......@@ -401,7 +402,7 @@ getSandboxPackageConf = shellyNoDir $ do
then return Nothing
else do
let pieces = split "/" myPath
sandboxDir = intercalate "/" $ (takeWhile (/= sandboxName) pieces) ++ [sandboxName]
sandboxDir = intercalate "/" $ takeWhile (/= sandboxName) pieces ++ [sandboxName]
subdirs <- ls $ fpFromString sandboxDir
let confdirs = filter (endswith "packages.conf.d") $ map fpToString subdirs
case confdirs of
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment