public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Can we get auto figure numbering?
@ 2018-07-03 11:57 CR
       [not found] ` <4c99886b-ae46-45f7-9068-82a919278e29-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: CR @ 2018-07-03 11:57 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1490 bytes --]

Thank you for this very handy utility! I use Markdown to convert really old 
public domain books into EPUB. 

I'd like to make all my images figures with a caption of "Figure 1" that 
precedes any alt text. So if I use Markdown to make an EPUB and I code and 
image like this: 

![Fig @fignum@: This is a figure](images\fig01.jpg)
>

The caption would be auto numbered and rendered as 

Figure 1: This is a figure
>

Successive figures would be autonumbered using the @fignum@ placeholder, or 
whatever placeholder the author uses. 

Thus, no matter which order I type in figures, figures will be numered in 
the order they physically appear in one or more Markdown files that make up 
an EPUB book.

Would this be a possible feature to add to a later version of Pandoc? The 
name of the extension could be "autonumber_figures" or something like that. 
Currently I only need it to convert Markdown into EPUB files.




-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/4c99886b-ae46-45f7-9068-82a919278e29%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2450 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can we get auto figure numbering?
       [not found] ` <4c99886b-ae46-45f7-9068-82a919278e29-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-04 12:54   ` Christophe Demko
       [not found]     ` <be535e20-e633-41dc-ba43-fdd35e80e83a-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-07-29 13:43   ` Axel Rauschmayer
  1 sibling, 1 reply; 4+ messages in thread
From: Christophe Demko @ 2018-07-04 12:54 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 1754 bytes --]

You could develop a pandoc filter for that. 
See https://github.com/jgm/pandoc/wiki/Pandoc-Filters for some examples

Le mardi 3 juillet 2018 13:57:55 UTC+2, CR a écrit :
>
> Thank you for this very handy utility! I use Markdown to convert really 
> old public domain books into EPUB. 
>
> I'd like to make all my images figures with a caption of "Figure 1" that 
> precedes any alt text. So if I use Markdown to make an EPUB and I code and 
> image like this: 
>
> ![Fig @fignum@: This is a figure](images\fig01.jpg)
>>
>
> The caption would be auto numbered and rendered as 
>
> Figure 1: This is a figure
>>
>
> Successive figures would be autonumbered using the @fignum@ placeholder, 
> or whatever placeholder the author uses. 
>
> Thus, no matter which order I type in figures, figures will be numered in 
> the order they physically appear in one or more Markdown files that make up 
> an EPUB book.
>
> Would this be a possible feature to add to a later version of Pandoc? The 
> name of the extension could be "autonumber_figures" or something like that. 
> Currently I only need it to convert Markdown into EPUB files.
>
>
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/be535e20-e633-41dc-ba43-fdd35e80e83a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2762 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can we get auto figure numbering?
       [not found]     ` <be535e20-e633-41dc-ba43-fdd35e80e83a-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
@ 2018-07-04 13:14       ` Robert Zenz
  0 siblings, 0 replies; 4+ messages in thread
From: Robert Zenz @ 2018-07-04 13:14 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

As a matter of fact, this should be rather easy, something like this (without
any testing and pure guessing):

	local imageCounter = 1;

	return {
		{ Image = function(image)
			image.caption = "Figure " .. imageCounter ..": " .. image.caption
			imageCounter = imageCounter + 1
			
			return image
		end}
	}

One thing to be aware of is that figures are not present in the native tree that
Pandoc generates and uses. They are only generated when writing output, if I
remember correctly, when an image is the sole item inside a paragraph. So if you
tinker with the structure, you won't get figures anymore, at least not
automatically.


On 04.07.2018 14:54, Christophe Demko wrote:
> You could develop a pandoc filter for that. 
> See https://github.com/jgm/pandoc/wiki/Pandoc-Filters for some examples
> 
> Le mardi 3 juillet 2018 13:57:55 UTC+2, CR a écrit :
>>
>> Thank you for this very handy utility! I use Markdown to convert really 
>> old public domain books into EPUB. 
>>
>> I'd like to make all my images figures with a caption of "Figure 1" that 
>> precedes any alt text. So if I use Markdown to make an EPUB and I code and 
>> image like this: 
>>
>> ![Fig @fignum@: This is a figure](images\fig01.jpg)
>>>
>>
>> The caption would be auto numbered and rendered as 
>>
>> Figure 1: This is a figure
>>>
>>
>> Successive figures would be autonumbered using the @fignum@ placeholder, 
>> or whatever placeholder the author uses. 
>>
>> Thus, no matter which order I type in figures, figures will be numered in 
>> the order they physically appear in one or more Markdown files that make up 
>> an EPUB book.
>>
>> Would this be a possible feature to add to a later version of Pandoc? The 
>> name of the extension could be "autonumber_figures" or something like that. 
>> Currently I only need it to convert Markdown into EPUB files.
>>
>>
>>
>>
>>
> 

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5B3CC83C.7000704%40sibvisions.com.
For more options, visit https://groups.google.com/d/optout.


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Can we get auto figure numbering?
       [not found] ` <4c99886b-ae46-45f7-9068-82a919278e29-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
  2018-07-04 12:54   ` Christophe Demko
@ 2018-07-29 13:43   ` Axel Rauschmayer
  1 sibling, 0 replies; 4+ messages in thread
From: Axel Rauschmayer @ 2018-07-29 13:43 UTC (permalink / raw)
  To: pandoc-discuss


[-- Attachment #1.1: Type: text/plain, Size: 675 bytes --]

Have you tried this filter? It works really well for 
me: https://github.com/lierdakil/pandoc-crossref

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/5cf2e2a6-2376-4bb4-8c42-3c9f27c0d8df%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 1087 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2018-07-29 13:43 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-03 11:57 Can we get auto figure numbering? CR
     [not found] ` <4c99886b-ae46-45f7-9068-82a919278e29-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-04 12:54   ` Christophe Demko
     [not found]     ` <be535e20-e633-41dc-ba43-fdd35e80e83a-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2018-07-04 13:14       ` Robert Zenz
2018-07-29 13:43   ` Axel Rauschmayer

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 NNTP newsgroup(s).