Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable export of org-babel src blocks #430

Closed
dorneanu opened this issue Mar 10, 2021 · 3 comments
Closed

Disable export of org-babel src blocks #430

dorneanu opened this issue Mar 10, 2021 · 3 comments
Labels
awaiting user response cannot reproduce issue The issue reported by the OP cannot be reproduce in tests

Comments

@dorneanu
Copy link

Actual Behavior

When I export that ORG buffer I get:

    +++
    title = "Testing"
    author = ["Victor Dorneanu"]
    lastmod = 2021-03-10T21:01:32+01:00
    draft = false
    +++
    
    ```bash
    echo "testing"
    ```
    
    ```text
    testing
    ```

Expected Behavior

I would expect only the #+RESULTS section to be exported.

    +++
    title = "Testing"
    author = ["Victor Dorneanu"]
    lastmod = 2021-03-10T21:01:32+01:00
    draft = false
    +++
    
    ```text
    testing
    ```

How to Reproduce the Issue

Create a new ORG buffer with the following content and export using ox-hugo.

Example Org File

#+TITLE: ORG Content
#+AUTHOR: Victor Dorneanu
#+STARTUP: indent
#+HUGO_BASE_DIR: ../
#+HUGO_SECTION: posts
#+HUGO_AUTO_SET_LASTMOD: t

* Posts
** DONE Testing
:PROPERTIES:
:EXPORT_FILE_NAME: 2021-testing
:END:

#+begin_src bash :exports results :eval never-export
echo "testing"
#+end_src

#+RESULTS:
: testing

Generated Markdown File or Error

  +++
  title = "Testing"
  author = ["Victor Dorneanu"]
  lastmod = 2021-03-10T21:01:32+01:00
  draft = false
  +++
  
  ```bash
  echo "testing"
  ```
  
  ```text
  testing
  ```

Ox-Hugo Debug Information

Debug Info

|org-hugo-section |"posts"|
|org-hugo-use-code-for-kbd |nil|
|org-hugo-preserve-filling |t|
|org-hugo-delete-trailing-ws |t|
|org-hugo-prefer-hyphen-in-tags |t|
|org-hugo-allow-spaces-in-tags |t|
|org-hugo-tag-processing-functions |(org-hugo--tag-processing-fn-replace-with-spaces-maybe org-hugo--tag-processing-fn-replace-with-hyphens-maybe)|
|org-hugo-auto-set-lastmod |nil|
|org-hugo-export-with-toc |nil|
|org-hugo-export-with-section-numbers |nil|
|org-hugo-front-matter-format |"toml"|
|org-hugo-default-static-subdirectory-for-externals |"ox-hugo"|
|org-hugo-external-file-extensions-allowed-for-copying |("jpg" "jpeg" "tiff" "png" "svg" "gif" "mp4" "pdf" "odt" "doc" "ppt" "xls" "docx" "pptx" "xlsx")|
|org-hugo-date-format |"%Y-%m-%dT%T%z"|
|org-hugo-paired-shortcodes |""|
|org-hugo-langs-no-descr-in-code-fences |nil|
|org-hugo-suppress-lastmod-period |0.0|
|org-hugo-front-matter-format |"toml"|

@dorneanu
Copy link
Author

I've actually figured out how to make this work:

  • In my config.el (I'm using doom-emacs) I have
(after! org
    (setq org-confirm-babel-evaluate nil)
    (setq org-export-use-babel t))
  • in my org file at the top I have:
#+property: header-args :eval never-export

Make sure to C-c C-c while pointing at that line. Then I can use:

  #+begin_src bash :exports results
  ls -l

  #+end_src

In the exported markdown file I only have the result. Maybe you can also confirm this then I can close this one.

kaushalmodi added a commit that referenced this issue Mar 30, 2021
@kaushalmodi kaushalmodi added awaiting user response cannot reproduce issue The issue reported by the OP cannot be reproduce in tests labels Mar 30, 2021
@kaushalmodi
Copy link
Owner

Hello,

I am unable to reproduce this issue as you can see in this test that I just added based on this issue: 80a49c0

So I believe that it's something else in your config that's messing this up.

In my config.el (I'm using doom-emacs) I have

 (after! org
     (setq org-confirm-babel-evaluate nil)
     (setq org-export-use-babel t))

This doesn't change anything, but you don't need (setq org-export-use-babel t) .. that's the default value.

in my org file at the top I have:

#+property: header-args :eval never-export

I didn't need that.. your Org recipe to reproduce the issue worked just fine.. did not show that issue.

Make sure to C-c C-c while pointing at that line.

You shouldn't need to do that in any case.. just refreshing the Org buffer always re-evaluates the properties.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting user response cannot reproduce issue The issue reported by the OP cannot be reproduce in tests
Projects
None yet
Development

No branches or pull requests

2 participants