public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
* Side Effects from HTML to HTML conversion
@ 2021-04-13  6:57 S. Manning
       [not found] ` <40bf250d3cff42be22088054dc3fa618-aFO/2INALiozYggVrLCuDg@public.gmane.org>
  0 siblings, 1 reply; 4+ messages in thread
From: S. Manning @ 2021-04-13  6:57 UTC (permalink / raw)
  To: Pandoc discuss

I seem to still be getting side effects when I take HTML as input and 
output to HTML (so all I use pandoc for is to take some variables and 
wrap the contents in header and footer code with the variables inserted 
in the appropriate places).  Passages like the following in the input:

<figure>
	<a href="/images/2021/04/acme-widgets.jpg">
	<img src="/images/2021/04/acme-widgets.jpg" alt="a mysterious machine 
sticking out of a cardboard shipping box" />
	<figcaption aria-hidden="true">One of this proud company's most famous 
products, the type 37 widget ...</figcaption>
	</a>
</figure>

become like so in the output:

<figure>
<img src="/images/2021/04/acme-widgets.jpg" alt="One of this proud 
company's most famous products, the type 37 widget ..." /><figcaption 
aria-hidden="true">One of this proud company's most famous products, the 
type 37 widget ...</figcaption>
</figure>

I lose the <a> tag and I lose the contents of the alt attribute (good 
alt text is not the same as a good caption!  The caption tells you how 
to interpret the picture, the alt text tells you what the picture would 
be if you could see it).  Are there any ways of avoiding these side 
effects?

If any of you can suggest a more appropriate tool than pandoc for my use 
case (take a HTML fragment and some metadata, wrap the fragment in 
header and footer text with some values inserted from the metadata to 
create a valid HTML file) I will consider it.


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

* Re: Side Effects from HTML to HTML conversion
       [not found] ` <40bf250d3cff42be22088054dc3fa618-aFO/2INALiozYggVrLCuDg@public.gmane.org>
@ 2021-04-13 13:25   ` Daniel Staal
       [not found]     ` <950926c0-2980-d7c1-c8a0-c624a540d300-Jdbf3xiKgS8@public.gmane.org>
  2021-04-13 21:53   ` John MacFarlane
  1 sibling, 1 reply; 4+ messages in thread
From: Daniel Staal @ 2021-04-13 13:25 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 4/13/21 2:57 AM, S. Manning wrote:
> If any of you can suggest a more appropriate tool than pandoc for my use 
> case (take a HTML fragment and some metadata, wrap the fragment in 
> header and footer text with some values inserted from the metadata to 
> create a valid HTML file) I will consider it.

Honestly, the number of template engines of various complexities for 
HTML may as well be infinite at this point.  My first thought for this 
would be to write it as a PHP file - the metadata locations would be 
variables, process to HTML output - but pick a language and platform and 
you'll be able to find a dozen.

Actually, my *first* thought for myself would be to use BBEdit's built 
in template system.  So, yeah - expand that to include most high-end 
HTML editing software.

Daniel T. Staal

-- 
---------------------------------------------------------------
This email copyright the author.  Unless otherwise noted, you
are expressly allowed to retransmit, quote, or otherwise use
the contents for non-commercial purposes.  This copyright will
expire 5 years after the author's death, or in 30 years,
whichever is longer, unless such a period is in excess of
local copyright law.
---------------------------------------------------------------


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

* Re: Side Effects from HTML to HTML conversion
       [not found]     ` <950926c0-2980-d7c1-c8a0-c624a540d300-Jdbf3xiKgS8@public.gmane.org>
@ 2021-04-13 15:23       ` S. Manning
  0 siblings, 0 replies; 4+ messages in thread
From: S. Manning @ 2021-04-13 15:23 UTC (permalink / raw)
  To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw

On 2021-04-13 06:25, Daniel Staal wrote:
> On 4/13/21 2:57 AM, S. Manning wrote:
>> If any of you can suggest a more appropriate tool than pandoc for my 
>> use case (take a HTML fragment and some metadata, wrap the fragment in 
>> header and footer text with some values inserted from the metadata to 
>> create a valid HTML file) I will consider it.
> 
> Honestly, the number of template engines of various complexities for
> HTML may as well be infinite at this point.  My first thought for this
> would be to write it as a PHP file - the metadata locations would be
> variables, process to HTML output - but pick a language and platform
> and you'll be able to find a dozen.
> 
> Actually, my *first* thought for myself would be to use BBEdit's built
> in template system.  So, yeah - expand that to include most high-end
> HTML editing software.
> 
> Daniel T. Staal
> 

I have a colleague who likes BBEdit, but I think it is Mac only and my 
only box is a Linux box right now.  My last experience building a 
website was 15 or 20 years ago, what does "high-end HTML editing 
software" mean to you?

Sean


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

* Re: Side Effects from HTML to HTML conversion
       [not found] ` <40bf250d3cff42be22088054dc3fa618-aFO/2INALiozYggVrLCuDg@public.gmane.org>
  2021-04-13 13:25   ` Daniel Staal
@ 2021-04-13 21:53   ` John MacFarlane
  1 sibling, 0 replies; 4+ messages in thread
From: John MacFarlane @ 2021-04-13 21:53 UTC (permalink / raw)
  To: S. Manning, Pandoc discuss

"S. Manning" <scriptor-aFO/2INALiozYggVrLCuDg@public.gmane.org> writes:

> I seem to still be getting side effects when I take HTML as input and 
> output to HTML (so all I use pandoc for is to take some variables and 
> wrap the contents in header and footer code with the variables inserted 
> in the appropriate places).  Passages like the following in the input:
>
> <figure>
> 	<a href="/images/2021/04/acme-widgets.jpg">
> 	<img src="/images/2021/04/acme-widgets.jpg" alt="a mysterious machine 
> sticking out of a cardboard shipping box" />
> 	<figcaption aria-hidden="true">One of this proud company's most famous 
> products, the type 37 widget ...</figcaption>
> 	</a>
> </figure>
>
> become like so in the output:
>
> <figure>
> <img src="/images/2021/04/acme-widgets.jpg" alt="One of this proud 
> company's most famous products, the type 37 widget ..." /><figcaption 
> aria-hidden="true">One of this proud company's most famous products, the 
> type 37 widget ...</figcaption>
> </figure>
>
> I lose the <a> tag and I lose the contents of the alt attribute (good 
> alt text is not the same as a good caption!  The caption tells you how 
> to interpret the picture, the alt text tells you what the picture would 
> be if you could see it).  Are there any ways of avoiding these side 
> effects?

On this see
https://github.com/jgm/pandoc/pull/6495

If the alt text and caption are both there, screen readers read
both which is bad for accessibility.  

See also https://github.com/jgm/pandoc/issues/6782
which is an open issue in this vicinity.

> If any of you can suggest a more appropriate tool than pandoc for my use 
> case (take a HTML fragment and some metadata, wrap the fragment in 
> header and footer text with some values inserted from the metadata to 
> create a valid HTML file) I will consider it.

Any templating engine should be able to do this.
mustache for example.
https://mustache.github.io/


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

end of thread, other threads:[~2021-04-13 21:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-04-13  6:57 Side Effects from HTML to HTML conversion S. Manning
     [not found] ` <40bf250d3cff42be22088054dc3fa618-aFO/2INALiozYggVrLCuDg@public.gmane.org>
2021-04-13 13:25   ` Daniel Staal
     [not found]     ` <950926c0-2980-d7c1-c8a0-c624a540d300-Jdbf3xiKgS8@public.gmane.org>
2021-04-13 15:23       ` S. Manning
2021-04-13 21:53   ` John MacFarlane

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).