Org reader: treat *emacs-jupyter* src blocks as code cells.
This improves support for notebook-like org files that are intended to be used with emacs-jupyter package. Closes: #8236
This commit is contained in:
parent
e483bc9ff7
commit
5d66166088
2 changed files with 20 additions and 1 deletions
|
@ -311,7 +311,11 @@ codeBlock blockAttrs blockType = do
|
||||||
content <- rawBlockContent blockType
|
content <- rawBlockContent blockType
|
||||||
resultsContent <- option mempty babelResultsBlock
|
resultsContent <- option mempty babelResultsBlock
|
||||||
let identifier = fromMaybe mempty $ blockAttrName blockAttrs
|
let identifier = fromMaybe mempty $ blockAttrName blockAttrs
|
||||||
let codeBlk = B.codeBlockWith (identifier, classes, kv) content
|
let classes' = case classes of
|
||||||
|
c:cs | Just c' <- T.stripPrefix "jupyter-" c ->
|
||||||
|
c' : "code" : cs
|
||||||
|
_ -> classes
|
||||||
|
let codeBlk = B.codeBlockWith (identifier, classes', kv) content
|
||||||
let wrap = maybe pure addCaption (blockAttrCaption blockAttrs)
|
let wrap = maybe pure addCaption (blockAttrCaption blockAttrs)
|
||||||
return $
|
return $
|
||||||
(if exportsCode kv then wrap codeBlk else mempty) <>
|
(if exportsCode kv then wrap codeBlk else mempty) <>
|
||||||
|
|
15
test/command/8236.md
Normal file
15
test/command/8236.md
Normal file
|
@ -0,0 +1,15 @@
|
||||||
|
```
|
||||||
|
% pandoc -f org -t native
|
||||||
|
#+begin_src jupyter-python :session py :display plain
|
||||||
|
import pandas as pd
|
||||||
|
df = pd.read_csv('weight.csv', parse_dates=['Date'], index_col=0)
|
||||||
|
#+end_src
|
||||||
|
^D
|
||||||
|
[ CodeBlock
|
||||||
|
( ""
|
||||||
|
, [ "python" , "code" ]
|
||||||
|
, [ ( "session" , "py" ) , ( "display" , "plain" ) ]
|
||||||
|
)
|
||||||
|
"import pandas as pd\ndf = pd.read_csv('weight.csv', parse_dates=['Date'], index_col=0)\n"
|
||||||
|
]
|
||||||
|
```
|
Loading…
Add table
Reference in a new issue