From: Oleksandr G. <gav...@gm...> - 2016-02-22 08:55:28
|
On 2016-02-22, Oleksandr Gavenko wrote: > Modern HTML5 text usually have: > > <meta name=viewport content="width=device-width, initial-scale=1"> > > in <head>. > > I can't understand how can I pass this line to resulted template. > > In ``rst2html --help`` there is: > > HTML-Specific Options > --------------------- > --template=<file> Specify the template file (UTF-8 encoded). Default is > "/usr/share/docutils/writers/html4css1/template.txt". > > ``template.txt`` is: > > %(head_prefix)s > %(head)s > %(stylesheet)s > %(body_prefix)s > %(body_pre_docinfo)s > %(docinfo)s > %(body)s > %(body_suffix)s > Makefile rule: RST_WARNING_FLAGS := --halt warning RST_RENDER_FLAGS := --strip-comments --embed-stylesheet --no-xml-declaration --math-output=MathJax RST_FLAGS := $(RST_WARNING_FLAGS) $(RST_RENDER_FLAGS) $(HTML_DIR)/%.html: %.rst HEADER.rst rst.css rst.tmpl $(MAKEFILE_LIST) | $(HTML_DIR) $(RST2HTML) $(RST_FLAGS) --stylesheet=rst.css --template=rst.tmpl $*.rst $@ rst.tmpl: <!DOCTYPE html> <html> <head> <meta name=viewport content="width=device-width, initial-scale=1"> %(head)s %(stylesheet)s %(body_prefix)s %(body_pre_docinfo)s %(docinfo)s %(body)s %(body_suffix)s I replace %(head_prefix)s with above tags. This makes generated files HTML 5 compliant. Firefox source browser warn (highlight by red) default substitution: <?xml version="1.0" encoding="utf-8" ?> ## Attempt to use XML ## processing instructions in HTML <!DOCTYPE html PUBLIC ## Almost standard mode doctype "-//W3C//DTD XHTML 1.0 Transitional//EN" ## Expected <!DOCTYPE html> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> Problem resolved. -- http://defun.work/ |