@@ -14,7 +14,6 @@ Usage: classname attributes
1414 balanced columns .columns column-count
1515 columns(container) .columns
1616 column(each column) .column width(percent) valign(t|c|b)
17- other divs .<somename> data-latex
1817
1918 See README.md for details
2019
@@ -23,9 +22,6 @@ Note: You need to include multicol latex package to get balanced columns
2322 I tried to use well known html or latex parameter.
2423 Even if lua doen't like hyphens like in column-count.
2524
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
2925--]]
3026local List = require ' pandoc.List'
3127
@@ -39,9 +35,6 @@ function Div(div)
3935
4036 -- if the div has no class, the object is left unchanged
4137 -- 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.
4538 if not div .classes or # div .classes == 0 then return nil end
4639
4740 -- if the format is latex then do minipage and others (like multicol)
@@ -101,16 +94,6 @@ function Div(div)
10194 -- process supported options
10295 opt = div .attributes [' column-count' ]
10396 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- --]]
11497 end
11598
11699 begin_env = List :new {pandoc .RawBlock (' tex' ,
@@ -146,9 +129,15 @@ function Div(div)
146129 end
147130 -- if we have style then build returned list
148131 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
149139 div .attributes .style = style .. (div .attributes .style or ' ' )
150140 returned_list = List :new {pandoc .Div (div .content , div .attr )}
151- -- returned_list = List:new{pandoc.Div(div.content)}
152141 end
153142 end
154143 return returned_list
0 commit comments