@@ -14,7 +14,6 @@ Usage: classname attributes
14
14
balanced columns .columns column-count
15
15
columns(container) .columns
16
16
column(each column) .column width(percent) valign(t|c|b)
17
- other divs .<somename> data-latex
18
17
19
18
See README.md for details
20
19
@@ -23,9 +22,6 @@ Note: You need to include multicol latex package to get balanced columns
23
22
I tried to use well known html or latex parameter.
24
23
Even if lua doen't like hyphens like in column-count.
25
24
26
- Bugs: * html rendering throws a warning [WARNING] Ignoring duplicate attribute style="width:60%;".
27
- when width AND color are set and totally ignore the width
28
- attribute. Don't know if this bug is mine
29
25
--]]
30
26
local List = require ' pandoc.List'
31
27
@@ -39,9 +35,6 @@ function Div(div)
39
35
40
36
-- if the div has no class, the object is left unchanged
41
37
-- if the div has no class but an id, div.classes ~= nil
42
- -- TODO: use a div with no class to build a 'scope' in Latex
43
- -- usefull for user who would throw inline Latex code and limit it's
44
- -- effect.
45
38
if not div .classes or # div .classes == 0 then return nil end
46
39
47
40
-- if the format is latex then do minipage and others (like multicol)
@@ -101,16 +94,6 @@ function Div(div)
101
94
-- process supported options
102
95
opt = div .attributes [' column-count' ]
103
96
if opt then options = ' {' .. opt .. ' }' end
104
- --[[ This functionality will be moved in another filter since it can't be consistent with the positionless classname requirement
105
- else
106
- -- Latex skilled users can use arbitrary environments passed as
107
- -- the first (and only signifiant) class name.
108
- env = div.classes[1]
109
- -- default if no known options
110
- if options == '' and div.attributes['data-latex'] then
111
- options = div.attributes['data-latex']
112
- end
113
- --]]
114
97
end
115
98
116
99
begin_env = List :new {pandoc .RawBlock (' tex' ,
@@ -146,9 +129,15 @@ function Div(div)
146
129
end
147
130
-- if we have style then build returned list
148
131
if style then
132
+ -- process width attribute since Pandoc complains about duplicate
133
+ -- style attribute and ignores it.
134
+ opt = div .attributes .width
135
+ if opt then
136
+ style = ' width: ' .. opt .. ' ;' .. (style or ' ' )
137
+ div .attributes .width = nil -- consume attribute
138
+ end
149
139
div .attributes .style = style .. (div .attributes .style or ' ' )
150
140
returned_list = List :new {pandoc .Div (div .content , div .attr )}
151
- -- returned_list = List:new{pandoc.Div(div.content)}
152
141
end
153
142
end
154
143
return returned_list
0 commit comments