Here's an emacs defun to insert a numbered figure using numfig:
(defun rst-bk-numfigs (Fig Caption)
"Inserts numbered firgure in sphinx, using numfig extension:
https://bitbucket.org/arjones6/sphinx-numfig"
(interactive
(list
(file-name-nondirectory (read-file-name "Image file: " (if
(file-exists-p "_static")
"_static"
default-directory) ))
(read-string "Caption: ") ))
(let (FigStripped FigStrippedLowerCase)
(setq FigStripped
(replace-regexp-in-string "[^a-zA-Z]" ""
(file-name-sans-extension Fig)))
(with-temp-buffer
(insert FigStripped)
(downcase-region (point-min) (point-max))
(setq FigStrippedLowerCase (buffer-substring-no-properties
(point-min) (point-max))))
(insert (format "\
:num:`Fig. #%s`
.. _%s:
.. figure:: _static/%s
:width: 50%s
:alt: %s
:align: center
%s
" FigStrippedLowerCase FigStrippedLowerCase Fig "%" Fig Caption)))
(search-backward-regexp "`")
(forward-char 1))
On Thursday, August 30, 2012 11:29:20 PM UTC+4, kt-fsi wrote:
>
> Is it somehow possible to have a figure caption different form the text of
> the link to that figure?
>
> This may also help. It is a sphinx extension. We use this to have 'Figure
> #' display in our HTML output: (numfig extension with the role, :num: )
>
> https://bitbucket.org/arjones6/sphinx-numfig/wiki/Home
>
> Kathy
> [email protected] <javascript:>
>
--
You received this message because you are subscribed to the Google Groups
"sphinx-dev" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/sphinx-dev/-/S7AiAZyz-kYJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sphinx-dev?hl=en.