From mboxrd@z Thu Jan 1 00:00:00 1970 From: Omid Subject: Re: Is there a variable/way to change
to something else, e.g.
for use with Bootstrap CSS? Date: Mon, 26 May 2014 02:28:14 -0400 Message-ID: <5382DEFE.40508@gmail.com> References: <525DE996.2000408@gmail.com> <52F2A1D2.4030802@gmail.com> <53825499.9030306@gmail.com> <87zji5thlf.fsf@ericabrahamsen.net> <5382BE59.3030209@gmail.com> <5382C281.1070901@gmail.com> <877g59qg2o.fsf@ericabrahamsen.net> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:36422) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WooOa-0003uu-0U for emacs-orgmode@gnu.org; Mon, 26 May 2014 02:28:37 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WooOP-0000GM-OB for emacs-orgmode@gnu.org; Mon, 26 May 2014 02:28:27 -0400 Received: from mail-yh0-x22e.google.com ([2607:f8b0:4002:c01::22e]:63797) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WooOP-0000G2-IZ for emacs-orgmode@gnu.org; Mon, 26 May 2014 02:28:17 -0400 Received: by mail-yh0-f46.google.com with SMTP id 29so6108946yhl.19 for ; Sun, 25 May 2014 23:28:17 -0700 (PDT) Received: from [10.0.0.2] (host-207-254.fltavth.clients.pavlovmedia.com. [68.234.207.254]) by mx.google.com with ESMTPSA id e65sm16723950yhl.2.2014.05.25.23.28.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Sun, 25 May 2014 23:28:15 -0700 (PDT) In-Reply-To: <877g59qg2o.fsf@ericabrahamsen.net> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Eric, Thanks a lot for the pointer to the "Filter System." I was not aware of it and, as you pointed out, the org-export-filter-final-output-functions variable will help me achieve what I was looking for. Cheers, Omid Sent from my Emacs On 05/26/2014 01:11 AM, Eric Abrahamsen wrote: > Omid writes: > >> I think I found the answer to my second question: in >> org-publish-project-alist, there is the property completion-function >> that can be set to a (list of) functions to do some post processing. >> My first question still stands, though. > > Yup, that's a bit of a pain. > > When you need to really mess with the results of an Org export, the way > to do it is through the "filter" system, not regular hooks. See the > comments under "The Filter System" in lisp/ox.el for details on that. > > Filters give you access to the exported strings produced from various > elements in the org buffer. Unfortunately there isn't a filter that > reaches the contents template, which is where ox-html is setting the div > id, so you'll probably need to use the nuclear option: > org-export-filter-final-output-functions. Functions placed in that > variable get access to the whole export string, and you can just do a > search-and-replace for your id/class string there. > > Yours, > Eric > >> On 05/26/2014 12:08 AM, Omid wrote: >>> Thank you, Eric for your quick response. >>> - I am using Org mode 8.2.6 (from ELPA) and Emacs 24.3.1. >>> - org-html-divs does almost what I have been looking for, except for >>> one, unfortunately crucial, shortcoming: I don't see any way of >>> changing the "id" tag to "class". Bootstrap's container is a "class" >>> and will not work as an "id". As far as see, I can only do >>> >>> (setq org-html-divs (quote ((preamble "div" "preamble") >>> (content "div" "container") >>> (postamble "div" "postamble")))) >>> >>> Looking at ox-html.el I see that the "id" tag is hard coded: >>> >>> (list :tag "Content" >>> (const :format "" content) >>> (string :tag "element") (string :tag " id")) >>> >>> Am I missing something here? >>> >>> - I still could not find a "post publish" hook/variable. Neither >>> apropos-variable with org publish, apropos with org publish gives me >>> anything useful. C-h v reveals org-export-before-parsing-hook and >>> org-export-before-processing-hook but I don't see anything with >>> "after" or "post". The only way I see around my problem is to define >>> an external publishing-function in org-publish-project-alist (maybe >>> a makefile) and do the necessary post processing there. Any better >>> suggestion is greatly appreciated. >>> >>> Thanks, >>> >>> Omid >>> >>> Sent from my Emacs >>> >>> On 05/25/2014 10:10 PM, Eric Abrahamsen wrote: >>>> Omid writes: >>>> >>>>> Hello, >>>>> >>>>> - I am trying to build a statically-generated website purely with Org >>>>> mode. I would like to use Bootstrap CSS to make the site mobile >>>>> friendly. Bootstrap uses
for the "main" part >>>>> of the of HTML; Org mode export produces
>>>>> for that part. >>>>> >>>>> Is there a variable to set/way to make Org wrap this part in the >>>>> "container" class? >>>>> >>>>> Looking at several "apropos" results (with all the search keywords I >>>>> could think of), I only see a setting for pre/postamble-class: >>>>> >>>>> org-html--pre/postamble-class >>>>> Variable: CSS class used for pre/postamble >>>> >>>> It would help to know your Org mode version, but I'm pretty sure >>>> org-html-divs has been around for a bit. Check out its docstring, and >>>> modify its second element, which is '(content "div" "content") by >>>> default. >>>> >>>>> - Assuming there is no Org-internal way to do this, is there a >>>>> function that is run after a project is published to that I can, >>>>> e.g., run a sed script on the HTML files generated? Again, the only >>>>> remotely relevant result I see in M-x apropos RET org post is >>>>> >>>>> org-babel-post-tangle-hook >>>>> Variable: Hook run in code files tangled by `org-babel-tangle'. >>>>> Properties: standard-value custom-version custom-type >>>>> custom-requests variable-documentation >>>>> >>>>> - As a "meta question", how would one find the answer to these and >>>>> similar questions without leaving Emacs, since we know Emacs is >>>>> self-documenting and Org mode has a very comprehensive set of >>>>> functions and documentation. Looking in the usual places (C-u M-x >>>>> apropos, C-h v) did not lead me to an answer. >>>> >>>> One good thing to know is that Org export variables related to a certain >>>> backend all start with org-BACKEND-*. So you could do C-h v org-html-TAB >>>> and see... a lot of variables. Still, that would (eventually) get you >>>> there. I did apropos-variable for "org html container" and that got me a >>>> similar list as C-h v, albeit slimmed down somewhat, and with >>>> docstrings. >>>> >>>> Hope that helps, >>>> Eric >>>> >>>> > >