Bug 419935

Summary: Template HTML file is lacking doctype, has not very useful meta tag
Product: [Frameworks and Libraries] frameworks-kio Reporter: ariasuni <aria>
Component: generalAssignee: Grzegorz Szymaszek <gszymaszek>
Status: RESOLVED FIXED    
Severity: normal CC: elvis.angelaccio, gszymaszek, kdelibs-bugs, kfm-devel, nate
Priority: NOR    
Version: 5.69.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 5.70

Description ariasuni 2020-04-11 00:44:42 UTC
SUMMARY


STEPS TO REPRODUCE
1. Context Menu → Create New → HTML File…

OBSERVED RESULT

File content is:
<html>
  <head>
    <title></title>
    <meta content="">
    <style></style>
  </head>
  <body></body>
</html>


EXPECTED RESULT

File content should be:
<!DOCTYPE html>
<html>
  <head lang="">
    <meta charset="utf-8">
    <title></title>
    <style></style>
  </head>
  <body></body>
</html>

Note that I also added a lang attribute to head, as recommended here:
https://www.w3.org/International/questions/qa-html-language-declarations


SOFTWARE/OS VERSIONS
Operating System: Arch Linux 
KDE Plasma Version: 5.18.4
KDE Frameworks Version: 5.68.0
Qt Version: 5.14.2
Comment 1 Grzegorz Szymaszek 2020-04-21 12:40:59 UTC
The lang attribute should be set on the html (not head) element.
Comment 2 ariasuni 2020-04-22 02:52:33 UTC
Oops you’re right, that’s what is being said in the link to the w3 website in my comment.

Now that it has been triaged into the frameworks-kio, I can see the file is located here in the repository:
https://phabricator.kde.org/source/kio/browse/master/src/new_file_templates/HTMLFile.html;38b9f4189508476ee292609d75254f4395d9babd?as=source
Comment 3 Grzegorz Szymaszek 2020-04-22 06:59:05 UTC
I’ve proposed a patch: <https://phabricator.kde.org/D29084>.
Comment 4 Grzegorz Szymaszek 2020-04-27 16:04:32 UTC
Git commit 5adaa7cba102c8d29146bdba82bdf88250968ba3 by Grzegorz Szymaszek.
Committed on 27/04/2020 at 16:04.
Pushed by gszymaszek into branch 'master'.

Make the HTML file template more useful

Summary:
This commit removes the empty meta tag and adds the following:
* a DOCTYPE declaration,
* an html[lang] attribute,
* a document charset declaration,
* a newline at the end of the document.

Adding the DOCTYPE and charset make the template HTML5‐complant.

Reviewers: #frameworks, dfaure, ognarb

Reviewed By: ognarb

Subscribers: kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D29084

M  +9    -5    src/new_file_templates/HTMLFile.html

https://commits.kde.org/kio/5adaa7cba102c8d29146bdba82bdf88250968ba3