1

When I export an org file to an ascii file, using org-export-to-ascii, I get some annoying lines on the left margin and an indent

,----
|  .class{
|  background:red;
|  }

This is what I'm after:


.class{
background:red;
}

I'm using some code to remove headings before export (same issue with or without that code), and more code to export the ascii file with a .css extension rather than .txt.

The idea is to use org-mode rather than origami for folding css files, and it works beautifully...when I export without SRC blocks and prepend lines of text with // or enclose text with /* */

Of course, I'd prefer to export with SRC blocks so I can toggle src fontification.

Any quick and easy ideas?

Here is a sample org-file.org

#+OPTIONS: toc:nil H:0  num:nil todo:nil <:nil author:nil ^:{}
#+OPTIONS: \n:t LaTeX:nil stat:nil tasks:nil @:nil

* scss styling I'm exporting to a .scss

$font-family: Arial;

.sample-class{
background: $red;
}

This exports fine after setting these variables and executing following function:


(setq org-ascii-global-margin 0)
(setq org-ascii-inner-margin 0)
(setq org-ascii-text-width most-positive-fixnum)


(defun my-headline-removal (backend)
  "Remove all headlines in the current buffer.
BACKEND is the export back-end being used, as a symbol."
  (org-map-entries
   (lambda () (delete-region (point) (line-beginning-position 2)))))

It gives this:

$font-family: Arial;

.sample-class{
background: $red;
}

Which is exactly what I want in _org-file.scss (the file I'm exporting it to)

Now I would prefer to have an SRC block, to get sass fontification (or any fontication actually). So I export like this:


#+OPTIONS: toc:nil H:0  num:nil todo:nil <:nil author:nil ^:{}
#+OPTIONS: \n:t LaTeX:nil stat:nil tasks:nil @:nil

* scss styling I'm exporting to a .scss

#+BEGIN_SRC sass :tangle no

$font-family: Arial;

.sample-class{
background: $red;
}

#+END_SRC 

This produces the following:

,----
|  $font-family: Arial;
| 
|   .sample-class{
|  background:red;
|  }


Those lines don't allow the .scss file to process (also I have proper spaces between the class identifier and the bracket)

  • 2
    Can you please provide a short but complete Org mode document that shows what you are doing? That would help us help you. – NickD Feb 08 '21 at 14:15

2 Answers2

1

Install this snippet.

You will no longer get the boxes when you do C-c C-e t u.

(require 'ox-ascii)
(advice-add 'org-ascii--box-string :override
        (defun my-org-ascii--box-string  (s info)
          s))

0

It turns out, Rainbow Identifiers does a great job highlighting code outside src blocks in emacs org-mode. If no one gets around to this.