Whoops! Well, anyway, I think my point still- energy content is not the only factor- as diesel can get much more than 12% improved fuel economy. Diesel runs at much higher compression ratios, which is a good part of the increased economy. There's other things too, like the lack of a throttle plate which reduces pumping losses.
That's not correct, it has more.
By weight it's identical, and by volume (i.e. gallon) it has about 12% more energy than gasoline.