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

Support title for liquid code blocks #14

Open
justin808 opened this issue Mar 6, 2014 · 5 comments
Open

Support title for liquid code blocks #14

justin808 opened this issue Mar 6, 2014 · 5 comments

Comments

@justin808
Copy link
Contributor

Per: justin808@27357ca

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

Thanks!

@justin808
Copy link
Contributor Author

Here's the details of what to support:
http://octopress.org/docs/blogging/code/

I wonder if there is something we can do more generic for both images, code blocks, and any other cases in which one wants to use the jekyll plugin rather than just the org html generation?

@yoshinari-nomura
Copy link
Owner

Justin,

Thanks for the good suggestion.

I've read your thread in org-mode ML. Maybe you can write like this:

 (let (title (org-export-read-attribute :attr_jekyll src-block :title)))

and you can use title variable afterward.

* example org
  #+ATTR_JEKYLL :title "my code"
  #+BEGIN_SRC css
    ....
  #+END_SRC

would work.

As for the title, Org has some common attributes such
as #+CAPTION, #+NAME. In this case, you could use these
common attributes. These can be extracted by calling

(org-element-property :name src-block)

And you can write the source block like this:

  * example org
  #+CAPTION: blah blah
  #+BEGIN_SRC css
    ....
  #+END_SRC

It would be good to use these common attributes, and add :attr_jekyll way on the top of that.

@justin808
Copy link
Contributor Author

@yoshinari-nomura, would you make org caption and octopress title equivalent?

@yoshinari-nomura
Copy link
Owner

Sorry, actually I don't know if these two work as equivalents.
It would require some cut and try.

Or, how about using CAPTION as a default case?
If :attr_jekyll :title exists then use it, otherwise try to use CAPTION.

Maybe you are entitled to make the decision in this case :)

@kongluoxing
Copy link

(org-element-property :name src-block) shows eval: Symbol's value as variable is void: src-block

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants