tush via lyx-users said on Sat, 09 Jul 2022 15:54:06 +0000

>I want to override the default information LyX provides to my document
>when I export it to xml with Export->LyXHTML
>
>At the moment the info inserted to <head> tag is
>
><?xml version="1.0" encoding="UTF-8"?>
>
><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
>"http://www.w3.org/Math/DTD/mathml2/xhtml-math11-f.dtd";>
>
><html xmlns="http://www.w3.org/1999/xhtml";>
>
><head>
>
><meta name="GENERATOR" content="LyX 2.3.6.2" />
>
><meta http-equiv="Content-type" content="text/html;charset=UTF-8" />
>
>I am writing my own layout file in which all my customization will be
>inserted.
>
>I want for example to change the first line simply to
>
><!DOCTYPE html>
>
>to add
>
><html lang="en">
>
>and to include my style sheet:
>
><link href="css/myStyle.css" type="text/css" rel="stylesheet">
>
>What changes should I make to the my .layout file?
>
>I haven't found this information I am looking for in the Customization
>manual.

You're speaking my language tush!

It's been years since I looked at any kind of LyX HTML export, but if
it's what you're saying now, I might revisit the situation.

I think what you're asking for is best handled by a post-processor that
modifies the exported well-formed XML HTML5. Easy and fast with a
Python program that:

* Replaces existing doctype with <!doctype HTML>

* Gets rid of that silly <?xml version="1.0" encoding="UTF-8"?> line.
  HTML specs say that the UTF-8 line belongs in the <head></head tag
  pair as "<meta charset="UTF-8"/>". Like you said, the language line
  belongs in <html lang="en"> or whatever language you want.

* Replaces the exporter's CSS stylesheet with your own. I don't think
  you want to mess with your LyX styles in your layout file because you
  WANT your PDF styles to look very different from your HTML styles.

This is all accomplished with a very easy to write Python program that
will postprocess the exported file in a half a second. If the exported
file is *really* well formed XML, you can check it with my
xmlchecker.py shown at
http://troubleshooters.com/web/validating.htm#xmlchecker .

HTH,

SteveT

Steve Litt 
Summer 2022 featured book: Making Mental Models: Advanced Edition
http://www.troubleshooters.com/mmm
-- 
lyx-users mailing list
lyx-users@lists.lyx.org
http://lists.lyx.org/mailman/listinfo/lyx-users

Reply via email to