emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Exporter and src blocks
@ 2014-03-06  9:09 Justin Gordon
  0 siblings, 0 replies; only message in thread
From: Justin Gordon @ 2014-03-06  9:09 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Yoshinari Nomura

[-- Attachment #1: Type: text/plain, Size: 2486 bytes --]

I'm trying to fix this issue:
https://github.com/yoshinari-nomura/org-octopress/issues/14

Here's a copy of that message

Per: justin808@27357ca<https://github.com/justin808/org-octopress/commit/27357caf41bb82d78059015c3d6048d11444f62b>

I would like this to work:

#+BEGIN_SRC css sass/custom/_fonts.scss
b { font-weight: bold; }
i { font-style: italic; }
#+END_SRC

And have that generate

{% codeblock lang:css sass/custom/_fonts.scss %}
b { font-weight: bold; }
i { font-style: italic; }
{% endcodeblock %}

The lang goes in fine. I'd like the ability to have the other parameters
picked up.

Any chance you can give me a tip on the right change to the ox-jekyll.el?

Here's an example of "header arguments":
http://orgmode.org/manual/Code-block-specific-header-arguments.html#Code-block-specific-header-arguments

I'm guessing that it's not necessary to use this syntax (prepend :title
before the title)

#+BEGIN_SRC css :title sass/custom/_fonts.scss
b { font-weight: bold; }
i { font-style: italic; }
#+END_SRC



In the method of ox-jekyll, if I print out the value of src-block, i get
this:

src-block is (src-block (:language css :switches nil :parameters nil :begin
1 :end 78 :number-lines nil :preserve-indent nil :retain-labels t
:use-labels t :label-fmt nil :value b { font-weight: bold; }
i { font-style: italic; }
 :post-blank 0 :post-affiliated 1 :parent (section (:begin 1 :end 78
:contents-begin 1 :contents-end 78 :post-blank 0 :parent (org-data nil #2))
#0)))

I never can see the title.

Here's the method to fix:

(defun org-jekyll-src-block (src-block contents info)
  "Transcode SRC-BLOCK element into jekyll code template format
if `org-jekyll-use-src-plugin` is t. Otherwise, perform as
`org-html-src-block`. CONTENTS holds the contents of the item.
INFO is a plist used as a communication channel."
  (if org-jekyll-use-src-plugin
      (let ((language (org-element-property :language src-block))
            (value (org-remove-indentation
                    (org-element-property :value src-block))))
        (message "src-block is %s" src-block)
        (format "{%% codeblock lang:%s %%}\n%s{%% endcodeblock %%}"
                language value))
    (org-export-with-backend 'html src-block contents info)))







-- 
Justin Gordon | 808-877-6461 | m: 808-281-7272
www.railsonmaui.com | twitter: @railsonmaui<https://twitter.com/railsonmaui>
 | sugarranchmaui.com <http://www.sugarranchmaui.com/> | Sugar Ranch
Blog<https://www.facebook.com/SugarRanch>

[-- Attachment #2: Type: text/html, Size: 8664 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2014-03-06  9:09 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-03-06  9:09 Exporter and src blocks Justin Gordon

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).