* Drupal syntax on html-export for image links
@ 2012-05-24 4:55 William Crandall
2012-05-24 9:01 ` Bastien
0 siblings, 1 reply; 7+ messages in thread
From: William Crandall @ 2012-05-24 4:55 UTC (permalink / raw)
To: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 1318 bytes --]
Hello,
I'm drafting pages for publication on a Drupal website.
I've set up a draft-review cycle using Org-mode and some
simplified CSS, for a light-weight type-and-read process.
When I'm happy with the text, I'd like to cut-and-paste
from the generated html output directly into Drupal.
Links to external http files work fine, but image links
(and internal links) are confounding me.
--------------------------------------------------
Drupal inline image syntax is:
<img src="/sites/default/files/images/BC.png" alt="BC">
Default Org-mode html-export, for [[/sites/a.png]] seems to be:
<img src="file://g:/sites/a.png" alt="file://g:/sites/a.png" />
Which really won't do. Before hauling out my wheel-creation
tools, has anyone created a "Drupal-link type" for Org-mode?
Or some other solution?
--------------------------------------------------
I found one Drupal thread in the archives:
http://lists.gnu.org/archive/html/emacs-orgmode/2009-11/msg00473.html
But I don't need or want to "push the button" and publish.
I'd just like to modify the html-export output for images.
(And then adapt that to internal links.)
--------------------------------------------------
Thanks for any suggestions or references.
And for Org-mode, which is great!
-BC
Org-mode: 7.8.09
Emacs: 24.1.50.1
Windows 7
[-- Attachment #2: Type: text/html, Size: 5210 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-24 4:55 Drupal syntax on html-export for image links William Crandall
@ 2012-05-24 9:01 ` Bastien
2012-05-27 4:43 ` William Crandall
0 siblings, 1 reply; 7+ messages in thread
From: Bastien @ 2012-05-24 9:01 UTC (permalink / raw)
To: William Crandall; +Cc: emacs-orgmode
Hi William,
William Crandall <bc3141592@gmail.com> writes:
> Drupal inline image syntax is:
>
> <img src="/sites/default/files/images/BC.png" alt="BC">
>
> Default Org-mode html-export, for [[/sites/a.png]] seems to be:
>
> <img src="file://g:/sites/a.png" alt="file://g:/sites/a.png" />
Nicolas export engine does it right :
<img src="/sites/a.png" alt="a.png"/>
To use it, please pull from the git master repository then
- add the "contrib/" directory to your load-path
- (require 'org-export)
- M-x org-export-dispatch h
HTH,
--
Bastien
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-24 9:01 ` Bastien
@ 2012-05-27 4:43 ` William Crandall
2012-05-27 7:35 ` Nicolas Goaziou
2012-05-27 12:37 ` Jambunathan K
0 siblings, 2 replies; 7+ messages in thread
From: William Crandall @ 2012-05-27 4:43 UTC (permalink / raw)
To: Bastien; +Cc: emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 4880 bytes --]
Hello Bastien,
Thanks for your pointer to org-export!
I got it running and see it is an improvement.
Reading the archives, I've gathered some notions.
(Please correct me if I'm wrong!)
Is it true that:
1. The org-export Package is a "Generic Export Engine"
and is intended to support a new generation of
org export tools (to HTML, LaTeX, ODT, etc).
2. It is now an "experimental" Contributed Package:
http://orgmode.org/worg/org-contrib
3. The current (old) export command (C-c C-e) executes
a function called "org-export" in org-exp.el (line 943)
but it is not related to the new org-export package.
4. API documentation for the new org-export, and it's family
(org-e-ascii.el, org-e-html.el, org-e-latex.el, org-e-odt.el
org-e-publish.el org-element.el), is here:
http://orgmode.org/worg/org-api/
5. Documentation for back-end developers working on new
export tools is here:
http://orgmode.org/worg/dev/org-export-reference.html
6. Current org tutorials describe the old tool set, e.g.,
"Publishing Org-mode files to HTML", not the new:
http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
7. No end-user documentation for the org-export package
has been created, describing for example, how to link
to an external CSS file (as #+STYLE used to work).
8. "The Manual" does not (yet) document the org-export package:
http://orgmode.org/manual/index.html
9. This mailing list is the best place to ask questions.
------------------------------------------------------------
Even if it's not a full BNF, and "only" 98% as Nicolas says,
a quasi-complete grammar is a really good place to start, or
re-start, building a "spaghetti-free" export system, IMO.
------------------------------------------------------------
------------------------------------------------------------
Turning to my immediate challenge, exporting to html,
I have some questions ( M-x org-export-dispatch h ):
1. UTF-8
How can I change the encoding, which defaults to:
<?xml version="1.0" encoding="iso-8859-1"?>
I set org-export-coding-system:
(setq org-export-coding-system 'utf-8)
And now:
org-export-coding-system is a variable defined in `org-export.el'.
Its value is utf-8
Original value was nil
But the exported html file still shows iso-8859-1
--------------------------------------------------
2. CSS
I used to link to an external style file thus:
#+STYLE: <link rel="stylesheet" type="text/css" href="css/about.css" />
What syntax works now?
--------------------------------------------------
3. Configuring paths to images
#+ATTR_HTML: alt="BC Crandall"
[[/sites/a.png]]
Exports to:
<img src="g:/sites/a.png" alt="BC Crandall"/></p>
One win; one fail.
#+ATTR_HTML: works fine!
But I'd like the path to be <img src="/sites/a.png" ..
without "g:"
--------------------------------------------------
4. Paths to files
[[/sites/my-file][My link]]
Exports to:
<a href="file://g:/sites/my-file">My link</a>
How can I keep the path "as it was", and get this:
<a href="/sites/my-file">My link</a>
without "file://g:"
--------------------------------------------------
5. Removing Pre- and Postamble
What now works like:
(setq org-export-html-preamble nil)
(setq org-export-html-postamble nil)
Now, there is no preamble.
The postamble is:
<div id="postamble">
<p class="date"> Date: 2012-05-26 20:59:51 Pacific Daylight Time </p>
<p class="author"> Author : William BC Crandall</p>
<p class="creator"> Generated by Org mode 7.8.11 in Emacs 24.1.50.1. </p>
<a href="http://validator.w3.org/check?uri=referer">Validate XHTML
1.0</a>
</div>
I'd like to remove both.
--------------------------------------------------
6. Special strings
I was able to get a TM (&trade) in the old system with:
(eval-after-load "org"
'(setq org-export-html-special-string-regexps
(append org-export-html-special-string-regexps
'(("-TM-" . "™")))))
How now?
--------------------------------------------------
Thanks for any pointers or suggestions!
And thanks to everyone working on this.
-BC
Org-mode: 7.8.11
Emacs: 24.1.50.1
Windows 7
On Thu, May 24, 2012 at 2:01 AM, Bastien <bzg@gnu.org> wrote:
> Hi William,
>
> William Crandall <bc3141592@gmail.com> writes:
>
> > Drupal inline image syntax is:
> >
> > <img src="/sites/default/files/images/BC.png" alt="BC">
> >
> > Default Org-mode html-export, for [[/sites/a.png]] seems to be:
> >
> > <img src="file://g:/sites/a.png" alt="file://g:/sites/a.png" />
>
> Nicolas export engine does it right :
>
> <img src="/sites/a.png" alt="a.png"/>
>
> To use it, please pull from the git master repository then
>
> - add the "contrib/" directory to your load-path
> - (require 'org-export)
> - M-x org-export-dispatch h
>
> HTH,
>
> --
> Bastien
>
[-- Attachment #2: Type: text/html, Size: 19779 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-27 4:43 ` William Crandall
@ 2012-05-27 7:35 ` Nicolas Goaziou
2012-05-27 12:41 ` Jambunathan K
2012-05-27 12:37 ` Jambunathan K
1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2012-05-27 7:35 UTC (permalink / raw)
To: William Crandall; +Cc: Bastien, emacs-orgmode
Hello,
William Crandall <bc3141592@gmail.com> writes:
> Is it true that:
>
> 1. The org-export Package is a "Generic Export Engine"
> and is intended to support a new generation of
> org export tools (to HTML, LaTeX, ODT, etc).
Correct.
> 2. It is now an "experimental" Contributed Package:
> http://orgmode.org/worg/org-contrib
Correct.
> 3. The current (old) export command (C-c C-e) executes
> a function called "org-export" in org-exp.el (line 943)
> but it is not related to the new org-export package.
Correct.
> 4. API documentation for the new org-export, and it's family
> (org-e-ascii.el, org-e-html.el, org-e-latex.el, org-e-odt.el
> org-e-publish.el org-element.el), is here:
> http://orgmode.org/worg/org-api/
Correct, but be warned that some functions in org-exp.el use org-export-*
prefix and might be found under "org-export" section.
> 5. Documentation for back-end developers working on new
> export tools is here:
> http://orgmode.org/worg/dev/org-export-reference.html
Correct.
> 6. Current org tutorials describe the old tool set, e.g.,
> "Publishing Org-mode files to HTML", not the new:
> http://orgmode.org/worg/org-tutorials/org-publish-html-tutorial.html
Correct.
> 7. No end-user documentation for the org-export package
> has been created, describing for example, how to link
> to an external CSS file (as #+STYLE used to work).
Correct.
> 8. "The Manual" does not (yet) document the org-export package:
> http://orgmode.org/manual/index.html
Correct.
> 9. This mailing list is the best place to ask questions.
Correct.
> Turning to my immediate challenge, exporting to html,
> I have some questions ( M-x org-export-dispatch h ):
Since I don't maintain `e-html' back-end, I'll only answer partially.
> 5. Removing Pre- and Postamble
>
> What now works like:
>
> (setq org-export-html-preamble nil)
> (setq org-export-html-postamble nil)
>
> Now, there is no preamble.
>
> The postamble is:
>
> <div id="postamble">
> <p class="date"> Date: 2012-05-26 20:59:51 Pacific Daylight Time </p>
> <p class="author"> Author : William BC Crandall</p>
> <p class="creator"> Generated by Org mode 7.8.11 in Emacs 24.1.50.1. </p>
> <a href="http://validator.w3.org/check?uri=referer">Validate XHTML
> 1.0</a>
> </div>
>
> I'd like to remove both.
You may have a look at `org-e-html-preamble' and `org-e-html-postamble'
variables.
> --------------------------------------------------
>
>
> 6. Special strings
>
> I was able to get a TM (&trade) in the old system with:
>
> (eval-after-load "org"
> '(setq org-export-html-special-string-regexps
> (append org-export-html-special-string-regexps
> '(("-TM-" . "™")))))
>
> How now?
You can add a filter to plain text objects, which will only be applied
to `e-html' back-end:
#+begin_src emacs-lisp
(defun my-html-trademark-markup (text backend info)
(if (not (eq back-end 'e-html)) text
(replace-regexp-in-string "-TM-" "™" text)))
(add-to-list 'org-export-filter-plain-text-functions
'my-html-trademark-markup)
#+end_src
Though, I would suggest to use entity \trade instead.
Regards,
--
Nicolas Goaziou
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-27 4:43 ` William Crandall
2012-05-27 7:35 ` Nicolas Goaziou
@ 2012-05-27 12:37 ` Jambunathan K
2012-05-27 16:00 ` William Crandall
1 sibling, 1 reply; 7+ messages in thread
From: Jambunathan K @ 2012-05-27 12:37 UTC (permalink / raw)
To: William Crandall; +Cc: Bastien, emacs-orgmode
The exporter is new. Needless to say there are bugs, known and
unknown. (Think, "Rome wasn't built in a day")
I have fixed few things. I will respond later for unresolved other
things in your list.
> 7. No end-user documentation for the org-export package
> has been created, describing for example, how to link
> to an external CSS file (as #+STYLE used to work).
This is fixed now.
> 8. "The Manual" does not (yet) document the org-export package:
> http://orgmode.org/manual/index.html
The new exporter should behave exactly the same way as the old one.
Otherwise, it is a bug.
For all practical purposes,
M-x customize-group RET org-export-e-html RET
should suffice.
Note that the defcustoms have `org-e-html-' as prefix. (Note the "e" in
"e-html")
> 1. UTF-8
>
> How can I change the encoding, which defaults to:
Use `org-e-html-coding-system'.
> --------------------------------------------------
>
> 2. CSS
>
> I used to link to an external style file thus:
>
> #+STYLE: <link rel="stylesheet" type="text/css" href="css/
> about.css" />
>
> What syntax works now?
This is fixed.
> 5. Removing Pre- and Postamble
>
> What now works like:
>
> (setq org-export-html-preamble nil)
> (setq org-export-html-postamble nil)
>
> Now, there is no preamble.
>
> The postamble is:
>
> <div id="postamble">
> <p class="date"> Date: 2012-05-26 20:59:51 Pacific Daylight Time
> </p>
> <p class="author"> Author : William BC Crandall</p>
> <p class="creator"> Generated by Org mode 7.8.11 in Emacs
> 24.1.50.1. </p>
> <a href="http://validator.w3.org/check?uri=referer">Validate
> XHTML 1.0</a>
> </div>
>
> I'd like to remove both.
Use `org-e-html-preamble' and `org-e-html-postamble'.
> --------------------------------------------------
>
>
> 6. Special strings
>
> I was able to get a TM (&trade) in the old system with:
>
> (eval-after-load "org"
> '(setq org-export-html-special-string-regexps
> (append org-export-html-special-string-regexps
> '(("-TM-" . "™")))))
>
> How now?
Nicolas has responded to this question.
FYI, `org-export-html-special-string-regexps' becomes
`org-e-html-special-string-regexps'.
> 3. Configuring paths to images
>
> #+ATTR_HTML: alt="BC Crandall"
> [[/sites/a.png]]
>
> Exports to:
>
> <img src="g:/sites/a.png" alt="BC Crandall"/></p>
>
> One win; one fail.
>
> #+ATTR_HTML: works fine!
>
> But I'd like the path to be <img src="/sites/a.png" ..
> without "g:"
>
>
> --------------------------------------------------
>
> 4. Paths to files
>
> [[/sites/my-file][My link]]
>
> Exports to:
>
> <a href="file://g:/sites/my-file">My link</a>
>
> How can I keep the path "as it was", and get this:
>
> <a href="/sites/my-file">My link</a>
>
> without "file://g:"
>
>
> --------------------------------------------------
>
I will respond to 3 and 4 separately. I need to look at this area
closely. (I know nothing about HTML or HTML exporter.)
What is "g:/" here. Is it the publishing directory or the current
directory. Given that, does removing the leading "g:/" a specific
requirement of yours or is it generally useful to anyone.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-27 7:35 ` Nicolas Goaziou
@ 2012-05-27 12:41 ` Jambunathan K
0 siblings, 0 replies; 7+ messages in thread
From: Jambunathan K @ 2012-05-27 12:41 UTC (permalink / raw)
To: Nicolas Goaziou; +Cc: Bastien, emacs-orgmode, William Crandall
> Since I don't maintain `e-html' back-end, I'll only answer partially.
I don't want to take over the maintainership of org-e-html.
What I am saying is that, anyone with commit access to Orgmode - this
includes me - can fix or patch up org-e-html without it being routed via
me.
+1 to Bastien for recommending the use of org-e-html.
--
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Drupal syntax on html-export for image links
2012-05-27 12:37 ` Jambunathan K
@ 2012-05-27 16:00 ` William Crandall
0 siblings, 0 replies; 7+ messages in thread
From: William Crandall @ 2012-05-27 16:00 UTC (permalink / raw)
To: Jambunathan K; +Cc: Bastien, emacs-orgmode
[-- Attachment #1: Type: text/plain, Size: 2475 bytes --]
Hello Nicolas and Jambunathan,
Many thanks, to you both, for such quick and detailed responses!
I look forward to checking things out later today.
And yes, +1 to Bastien for recommending!
Regarding your notes on image and file paths:
JK> I will respond to 3 and 4 separately. I need to look at
JK> this area closely. (I know nothing about HTML or HTML exporter.)
JK> What is "g:/" here. Is it the publishing directory or
JK> the current directory. Given that, does removing the leading
JK> "g:/" a specific requirement of yours or is it generally useful
JK> to anyone.
The "g:/" is a Windows artifact, indicating the drive. On Unix
systems, root "/" is unique; on Windows there can be many drives
indicated by letters at the root (c:/, d:/, .. z:/). The most common
default for first hard disk is "c:/", but other letters are often used.
http://en.wikipedia.org/wiki/Drive_letter_assignment
I think that it would be generally useful to be able to remove
the drive letter, so that c:/ or g:/ is transposed into just /
so that when the link-string is passed to a publishing system,
such as Drupal, it can easily digest it for further processing.
Thanks again for all your work on this!
-BC
On Sun, May 27, 2012 at 5:37 AM, Jambunathan K <kjambunathan@gmail.com>wrote:
>
> The exporter is new. Needless to say there are bugs, known and
> unknown. (Think, "Rome wasn't built in a day")
>
[. . .]
> > 3. Configuring paths to images
> >
> > #+ATTR_HTML: alt="BC Crandall"
> > [[/sites/a.png]]
> >
> > Exports to:
> >
> > <img src="g:/sites/a.png" alt="BC Crandall"/></p>
> >
> > One win; one fail.
> >
> > #+ATTR_HTML: works fine!
> >
> > But I'd like the path to be <img src="/sites/a.png" ..
> > without "g:"
> >
> >
> > --------------------------------------------------
> >
> > 4. Paths to files
> >
> > [[/sites/my-file][My link]]
> >
> > Exports to:
> >
> > <a href="file://g:/sites/my-file">My link</a>
> >
> > How can I keep the path "as it was", and get this:
> >
> > <a href="/sites/my-file">My link</a>
> >
> > without "file://g:"
> >
> >
> > --------------------------------------------------
> >
>
> I will respond to 3 and 4 separately. I need to look at this area
> closely. (I know nothing about HTML or HTML exporter.)
>
> What is "g:/" here. Is it the publishing directory or the current
> directory. Given that, does removing the leading "g:/" a specific
> requirement of yours or is it generally useful to anyone.
>
[-- Attachment #2: Type: text/html, Size: 6491 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-05-27 16:00 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-05-24 4:55 Drupal syntax on html-export for image links William Crandall
2012-05-24 9:01 ` Bastien
2012-05-27 4:43 ` William Crandall
2012-05-27 7:35 ` Nicolas Goaziou
2012-05-27 12:41 ` Jambunathan K
2012-05-27 12:37 ` Jambunathan K
2012-05-27 16:00 ` William Crandall
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).