parent
90610eb78c
commit
08f1f4551c
2 changed files with 83 additions and 0 deletions
|
@ -105,6 +105,14 @@ blockToOrg :: PandocMonad m
|
|||
=> Block -- ^ Block element
|
||||
-> Org m (Doc Text)
|
||||
blockToOrg Null = return empty
|
||||
blockToOrg (Div (_, ["cell", "code"], _) (CodeBlock attr t : bs)) = do
|
||||
-- ipynb code cell
|
||||
let (ident, classes, kvs) = attr
|
||||
blockListToOrg (CodeBlock (ident, classes ++ ["code"], kvs) t : bs)
|
||||
blockToOrg (Div (_, ["output", "execute_result"], _) [CodeBlock _attr t]) = do
|
||||
-- ipynb code result
|
||||
return $ "#+RESULTS:" $$
|
||||
(prefixed ": " . vcat . map literal $ T.split (== '\n') t)
|
||||
blockToOrg (Div attr@(ident,_,_) bs) = do
|
||||
opts <- gets stOptions
|
||||
-- Strip off bibliography if citations enabled
|
||||
|
|
75
test/command/6367.md
Normal file
75
test/command/6367.md
Normal file
|
@ -0,0 +1,75 @@
|
|||
```
|
||||
% pandoc -f ipynb -t org
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"A Markdown cell"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "code",
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"outputs": [
|
||||
{
|
||||
"data": {
|
||||
"text/plain": [
|
||||
"2"
|
||||
]
|
||||
},
|
||||
"execution_count": 1,
|
||||
"metadata": {},
|
||||
"output_type": "execute_result"
|
||||
}
|
||||
],
|
||||
"source": [
|
||||
"# A code cell\n",
|
||||
"1 + 1"
|
||||
]
|
||||
},
|
||||
{
|
||||
"cell_type": "markdown",
|
||||
"metadata": {},
|
||||
"source": [
|
||||
"Another Markdown cell"
|
||||
]
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 3
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.8.2"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 4
|
||||
}
|
||||
^D
|
||||
A Markdown cell
|
||||
|
||||
#+begin_src jupyter-python
|
||||
# A code cell
|
||||
1 + 1
|
||||
#+end_src
|
||||
|
||||
#+RESULTS:
|
||||
: 2
|
||||
|
||||
Another Markdown cell
|
||||
```
|
Loading…
Add table
Reference in a new issue