Skip to content

Commit

Permalink
Fix style errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Witiko committed Jul 25, 2022
1 parent 60c47df commit d8ec95b
Show file tree
Hide file tree
Showing 10 changed files with 53 additions and 51 deletions.
26 changes: 13 additions & 13 deletions lunamark/reader/markdown.lua
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ parsers.bullet = ( parsers.bulletchar * #parsers.spacing

parsers.openticks = Cg(parsers.backtick^1, "ticks")

local function captures_equal_length(s,i,a,b)
local function captures_equal_length(_,i,a,b)
return #a == #b and i
end

Expand All @@ -223,7 +223,7 @@ parsers.inticks = parsers.openticks * parsers.space^-1
-- Parsers used for fenced code blocks
-----------------------------------------------------------------------------

local function captures_geq_length(s,i,a,b)
local function captures_geq_length(_,i,a,b)
return #a >= #b and i
end

Expand Down Expand Up @@ -854,7 +854,7 @@ function M.new(writer, options)
end)

local parse_markdown

------------------------------------------------------------------------------
-- Basic parsers (local)
------------------------------------------------------------------------------
Expand Down Expand Up @@ -1028,12 +1028,12 @@ function M.new(writer, options)
larsers.Str = larsers.normalchar^1 / writer.string

larsers.Ellipsis = P("...") / writer.ellipsis

larsers.Dash = P("---") * -parsers.dash / writer.mdash
+ P("--") * -parsers.dash / writer.ndash
+ P("-") * #parsers.digit * B(parsers.digit*1, 2)
/ writer.ndash

larsers.DoubleQuoted = parsers.dquote * Ct((parsers.Inline - parsers.dquote)^1)
* parsers.dquote / writer.doublequoted

Expand All @@ -1046,12 +1046,12 @@ function M.new(writer, options)

larsers.Symbol = (larsers.specialchar - parsers.tightblocksep)
/ writer.string

larsers.RawInLine = parsers.inticks * parsers.rawattributes
/ writer.rawinline

larsers.Code = parsers.inticks / writer.code

if options.require_blank_before_blockquote then
larsers.bqstart = parsers.fail
else
Expand Down Expand Up @@ -1108,7 +1108,7 @@ function M.new(writer, options)
+ parsers.between(parsers.Inline, parsers.doubleunderscores,
parsers.doubleunderscores)
) / writer.strong

larsers.Emph = ( parsers.between(parsers.Inline, parsers.asterisk,
parsers.asterisk)
+ parsers.between(parsers.Inline, parsers.underscore,
Expand Down Expand Up @@ -1138,7 +1138,7 @@ function M.new(writer, options)
/ function(url)
return writer.link(writer.string(url),url)
end

larsers.AutoLinkEmail = parsers.less
* C((parsers.alphanumeric + S("-._+"))^1
* P("@") * parsers.urlchar^1) * parsers.more
Expand Down Expand Up @@ -1210,11 +1210,11 @@ function M.new(writer, options)
-- avoid parsing long strings of * or _ as emph/strong
larsers.UlOrStarLine = parsers.asterisk^4 + parsers.underscore^4
/ writer.string

larsers.EscapedChar = S("\\") * C(parsers.escapable) / writer.string

larsers.InlineHtml = C(parsers.inlinehtml) / writer.inline_html

larsers.HtmlEntity = parsers.hexentity / entities.hex_entity / writer.string
+ parsers.decentity / entities.dec_entity / writer.string
+ parsers.tagentity / entities.char_entity / writer.string
Expand Down Expand Up @@ -1379,7 +1379,7 @@ function M.new(writer, options)
* parsers.skipblanklines
) / writer.tasklist

local function definition_list_item(term, defs, tight)
local function definition_list_item(term, defs)
return { term = parse_inlines(term), definitions = defs }
end

Expand Down
4 changes: 2 additions & 2 deletions lunamark/writer/context.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ function M.new(options)
return {"\\type{",ConTeXt.string(s),"}"}
end

function ConTeXt.link(lab,src,tit)
function ConTeXt.link(lab,src)
return {"\\goto{",lab,"}[url(",ConTeXt.string(src),"]"}
end

function ConTeXt.image(lab,src,tit)
function ConTeXt.image(_,src)
return {"\\externalfigure[",ConTeXt.string(src),"]"}
end

Expand Down
12 changes: 7 additions & 5 deletions lunamark/writer/docbook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,24 @@ function M.new(options)
return {"<literal>",Docbook.string(s),"</literal>"}
end

function Docbook.link(lab,src,tit)
local titattr
function Docbook.link(lab,src)
-- local titattr
-- if tit and string.len(tit) > 0
-- then titattr = format(" xlink:title=\"%s\"", Docbook.string(tit))
-- else titattr = ""
-- end
return {"<ulink url=\"",Docbook.string(src),"\">",lab,"</ulink>"}
end

function Docbook.image(lab,src,tit)
function Docbook.image(_,src,tit)
local titattr
if tit and string.len(tit) > 0
then titattr = string.format("<objectinfo><title>%s%</title></objectinfo>",
Docbook.string(tit))
else titattr = ""
end
return {"<inlinemediaobject><imageobject>",titattr,"<imagedata fileref=\"",Docbook.string(src),"\" /></imageobject></inlinemediaobject>"}
return {"<inlinemediaobject><imageobject>",titattr,"<imagedata fileref=\"",Docbook.string(src),
"\" /></imageobject></inlinemediaobject>"}
end

function Docbook.paragraph(s)
Expand Down Expand Up @@ -129,7 +130,8 @@ function M.new(options)
defs[#defs + 1] = {"<listitem>",Docbook.containersep,def,Docbook.containersep,"</listitem>"}
defs[#defs + 1] = Docbook.containersep
end
buffer[#buffer + 1] = {"<varlistentry>",Docbook.containersep,"<term>",item.term,"</term>",Docbook.containersep,defs,"</varlistentry>"}
buffer[#buffer + 1] = {"<varlistentry>",Docbook.containersep,"<term>",item.term,"</term>",
Docbook.containersep,defs,"</varlistentry>"}
end
local contents = util.intersperse(buffer, Docbook.containersep)
return {"<variablelist>",Docbook.containersep,contents,Docbook.containersep,"</variablelist>"}
Expand Down
3 changes: 2 additions & 1 deletion lunamark/writer/dzslides.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ $body
<!-- *********************************************************************** -->
<!-- *********************************************************************** -->
<!-- This block of code is not supposed to be edited, but if you want to change the behavior of the slides, feel free to hack it ;) -->
<!-- This block of code is not supposed to be edited, but if you want to change the behavior of the slides,
feel free to hack it ;) -->
<!-- Default Style -->
<style>
Expand Down
26 changes: 13 additions & 13 deletions lunamark/writer/generic.lua
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ function M.new(options)

--- A link with link text `label`, uri `uri`,
-- and title `title`.
function W.link(label, uri, title)
function W.link(label)
return label
end

--- An image link with alt text `label`,
-- source `src`, and title `title`,
-- additional attributes `attr`
function W.image(label, src, title, attr)
function W.image(label)
return label
end

Expand All @@ -172,7 +172,7 @@ function M.new(options)
--- A bullet list with contents `items` (an array). If
-- `tight` is true, returns a "tight" list (with
-- minimal space between items).
function W.bulletlist(items,tight)
function W.bulletlist(items)
return util.intersperse(items,W.interblocksep)
end

Expand All @@ -186,7 +186,7 @@ function M.new(options)
-- `numdelim`, depending on options, may be one of "Default", "OneParen",
-- "Period".
-- (Those symbolic names are loosely taken from Pandoc.)
function W.orderedlist(items,tight,startnum,numstyle,numdelim)
function W.orderedlist(items)
return util.intersperse(items,W.interblocksep)
end

Expand All @@ -203,12 +203,12 @@ function M.new(options)
end

--- Inline HTML.
function W.inline_html(s)
function W.inline_html()
return ""
end

--- Display HTML (HTML block).
function W.display_html(s)
function W.display_html()
return ""
end

Expand Down Expand Up @@ -240,34 +240,34 @@ function M.new(options)
--- Fenced code block, with infostring `i`.
-- and optional attributes `attr` (may be nil,
-- when valued, `attr.class` is the same as the infostring)
function W.fenced_code(s, i, attr)
function W.fenced_code(s)
return s
end

--- Header level `level`, with text `s`.
function W.header(s, level)
function W.header(s)
return s
end

-- (Inline) Span with attributes `attr`
function W.span(s, attr)
function W.span(s)
return s
end

-- (Block) Div with attributes `attr`
function W.div(s, attr)
function W.div(s)
return s
end

--- Inline raw code, with format and
-- optional attributes
function W.rawinline(s, format, attr)
function W.rawinline()
return {} -- ignore by default
end

--- Raw block code, with format and
-- optional attributes
function W.rawblock(s, format, attr)
function W.rawblock()
return {} -- ignore by default
end

Expand Down Expand Up @@ -332,7 +332,7 @@ function M.new(options)
-- each of the form `{ term = t, definitions = defs, tight = tight }`,
-- where `t` is a string and `defs` is an array of strings.
-- `tight` is a boolean, true if it is a tight list.
function W.definitionlist(items, tight)
function W.definitionlist(items)
local buffer = {}
for _,item in ipairs(items) do
buffer[#buffer + 1] = item.t
Expand Down
4 changes: 2 additions & 2 deletions lunamark/writer/groff.lua
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,10 @@ function M.new(options)

Groff.citation = escape

function Groff.inline_html(s)
function Groff.inline_html()
end

function Groff.display_html(s)
function Groff.display_html()
end

function Groff.code(s)
Expand Down
10 changes: 5 additions & 5 deletions lunamark/writer/html.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ function M.new(options)
return {"<li>", s, "</li>"}
end

function Html.bulletlist(items,tight)
function Html.bulletlist(items)
return {"<ul>", containersep, intersperse(map(items, listitem), containersep), containersep, "</ul>"}
end

Expand All @@ -81,7 +81,7 @@ function M.new(options)
UpperAlpha = "A",
LowerAlpha = "a",
}
function Html.orderedlist(items,tight,startnum,numstyle,numdelim)
function Html.orderedlist(items,_,startnum,numstyle,numdelim)
local start = ""
if startnum and startnum ~= 1 then
start = " start=\"" .. startnum .. "\""
Expand All @@ -102,7 +102,7 @@ function M.new(options)
return {'<li class="tasklist-item '..status..'"><span>'..icon..' </span>', s[2], "</li>"}
end

function Html.tasklist(items,tight)
function Html.tasklist(items)
return {"<ul>", containersep, intersperse(map(items, tasklistitem), containersep), containersep, "</ul>"}
end

Expand Down Expand Up @@ -170,11 +170,11 @@ function M.new(options)
end
end

function Html.rawinline(s,format,attr)
function Html.rawinline(s,format)
return format == "html" and s or {}
end

function Html.rawblock(s,format,attr)
function Html.rawblock(s,format)
return format == "html" and s or {}
end

Expand Down
7 changes: 3 additions & 4 deletions lunamark/writer/latex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function M.new(options)
return {"\\texttt{",LaTeX.string(s),"}"}
end

function LaTeX.link(lab,src,tit)
function LaTeX.link(lab,src)
return {"\\href{",LaTeX.string(src),"}{",lab,"}"}
end

function LaTeX.image(lab,src,tit)
function LaTeX.image(_,src)
return {"\\includegraphics{",LaTeX.string(src),"}"}
end

Expand Down Expand Up @@ -126,8 +126,7 @@ function M.new(options)
buffer[#buffer + 1] = {opened_braces and "}" or "",
cite.prenote and {i == 1 and "" or " ", cite.prenote, "~"} or
"", {(i == 1 or cite.prenote) and "" or " ", "\\cite"},
cite.postnote and {"[", cite.postnote, "]"} or "", "{", cite.name,
cite_postnote and {"~", cite_postnote} or "", "}"}
cite.postnote and {"[", cite.postnote, "]"} or "", "{", cite.name, "}"}
opened_braces = false
else -- A string of simple citations
buffer[#buffer + 1] = {opened_braces and ", " or {i == 1 and "" or
Expand Down
8 changes: 4 additions & 4 deletions lunamark/writer/man.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ function M.new(options)

local endnotes = {}

function Man.link(lab,src,tit)
function Man.link(lab,src)
return {lab," (",src,")"}
end

function Man.image(lab,src,tit)
function Man.image(lab)
return {"[IMAGE (",lab,")]"}
end

Expand All @@ -42,7 +42,7 @@ function M.new(options)
return {".PP\n",contents}
end

function Man.bulletlist(items,tight)
function Man.bulletlist(items)
local buffer = {}
for _,item in ipairs(items) do
local revitem = item
Expand All @@ -53,7 +53,7 @@ function M.new(options)
return util.intersperse(buffer, Man.containersep)
end

function Man.orderedlist(items,tight,startnum)
function Man.orderedlist(items,_,startnum)
local buffer = {}
local num = startnum or 1
for _,item in ipairs(items) do
Expand Down
4 changes: 2 additions & 2 deletions lunamark/writer/tex.lua
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ function M.new(options)
TeX.string = escaper
TeX.citation = escaper_citation

function TeX.inline_html(s)
function TeX.inline_html()
return ""
end

function TeX.display_html(s)
function TeX.display_html()
return ""
end

Expand Down

0 comments on commit d8ec95b

Please sign in to comment.