Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated ldoc_ltp.lua #317

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 12 additions & 7 deletions ldoc/html/ldoc_ltp.lua
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
return [==[
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/>
<html xmlns="http://www.w3.org/1999/xhtml">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than switching from HTML 4 to XHTML I'd rather just skip straight to HTML5 and drop the doctype shenanigans.

<head>
<meta http-equiv="Content-Type" content="text/html; charset=$(ldoc.doc_charset)"/>
<title>$(ldoc.title)</title>
<link rel="stylesheet" href="$(ldoc.css)" type="text/css" />
# if ldoc.custom_css then -- add custom CSS file if configured.
Expand Down Expand Up @@ -68,7 +68,7 @@ return [==[
# for kind, mods, type in ldoc.kinds() do
# if ldoc.allowed_in_contents(type,module) then
<h2>$(kind)</h2>
<ul class="$(kind=='Topics' and '' or 'nowrap')">
<ul class="$(kind=='Topics' and '' or nowrap)">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks incorrect. Are you sure you checked how the Lua string vs. variable parsing is being done here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this seems to be wrong.

# for mod in mods() do local name = display_name(mod)
# if mod.name == this_mod then
<li><strong>$(name)</strong></li>
Expand Down Expand Up @@ -128,7 +128,7 @@ return [==[
<table class="function_list">
# for item in items() do
<tr>
<td class="name" $(nowrap)><a href="#$(item.name)">$(display_name(item))</a></td>
<td class="name $(nowrap)"><a href="#$(item.name)">$(display_name(item))</a></td>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here. Should be removed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a css-file in the project, as "nowrap" as an attribute is deprecated. It is not even part of html 5. I should have clarified that.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a css-file in the project, as "nowrap" as an attribute is deprecated. It is not even part of html 5. I should have clarified that.

Thanks for the clarification.

<td class="summary">$(M(item.summary,item))</td>
</tr>
# end -- for items
Expand Down Expand Up @@ -182,8 +182,8 @@ return [==[
# for value in iter(tag) do
$(li)$(custom.format and custom.format(value) or M(value))$(il)
# end -- for
</ul "@todo">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where the @todo comes from. I should have read through the file once more.

# end -- if tag
</ul>
# end -- iter tags
# end

Expand Down Expand Up @@ -217,7 +217,8 @@ return [==[
</li>
# end
# if sublist then
</li></ul>
</ul>
</li>
# end
# end -- for
</ul>
Expand All @@ -226,7 +227,9 @@ return [==[
# if show_return and item.retgroups then local groups = item.retgroups
<h3>Returns:</h3>
# for i,group in ldoc.ipairs(groups) do local li,il = use_li(group)
# if #group > 1 then
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The nesting of these if loops should be reversed.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That is outside the scope. This was only to get the generated html pass a linter.

<ol>
# end
# for r in group:iter() do local type, ctypes = item:return_type(r); local rt = ldoc.typename(type)
$(li)
# if rt ~= '' then
Expand All @@ -243,7 +246,9 @@ return [==[
</ul>
# end -- if ctypes
# end -- for r
# if #group > 1 then
</ol>
# end
# if i < #groups then
<h3>Or</h3>
# end
Expand Down Expand Up @@ -295,7 +300,7 @@ return [==[
<table class="module_list">
# for m in mods() do
<tr>
<td class="name" $(nowrap)><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td>
<td class="name $(nowrap)"><a href="$(no_spaces(kind))/$(m.name).html">$(m.name)</a></td>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really a CSS class or an HTML property string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is what I was referring to in #360. But according to html.com, it is an attribute for td tag.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case, this bit of patch is wrong and should be dropped.

@jeblad are you still around?

Copy link
Author

@jeblad jeblad Aug 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nowrap is not part of html 5.

The class was pretty simple as I recall it

.nowrap {
  white-space: nowrap;
}

<td class="summary">$(M(ldoc.strip_header(m.summary),m))</td>
</tr>
# end -- for modules
Expand Down