openstax / oer.exports

Converter to various book formats (PDF, epub, mobi)
2 stars 0 forks source link

Introduction to Business: Set column widths not working #3747

Closed lwtchu closed 6 years ago

lwtchu commented 6 years ago

From Rajasekar: We have added colwidth attribute for the table 5.7 using the value with asterisk (*) as mentioned in the following URL (https://legacy-devb.cnx.org/eip-help/colspec), and the same table has been duplicated below in XML file and added colwidth using the value with point value (pt) for testing purpose. This is shown in attached screenshot. However, there is no changes in web view as well as in PDF.

Is there any minimum and maximum value for adding in colwidth attribute for both proportional measure and fixed measure. Your advise would be greatly helpful.

Web view URL and screenshot: https://content02.cnx.org/contents/OTMco3OH@5/Ready-Set-Start-Your-Own-Busin

image001.pngcolwidth.png

/EMAIL


It currently works in the PDF and not webview for Business Ethics. Screen Shot 2018-08-21 at 9.54.26 AM.png https://devb.cnx.org/contents/WUj6TfJ0@12.1:M-9YKJtm@15/11-Society-Enables-Corporation

`

` Once we fix the issue in Introduction to Business, we can address in webview for both.
helenemccarron commented 6 years ago

Currently, PrinceXML supports colgroup and col width. The following markup works:

<colspec colnum="1" colwidth="3" colname="c1"/>
<colspec colnum="2" colwidth="1" colname="c2"/>
<colspec colnum="3" colwidth="1" colname="c3"/>
<colspec colnum="4" colwidth="1" colname="c4"/>

where each colwidth is a fraction of cols="4". 2018-08-21_14-13-14

However, the tag <col width="x"> is deprecated in HTML5 and not supported by our transforms. The tag is converted to <col data-width="x"/>, which does not have any effect in HTML nor is supported in Webview.

Per Phil: not sure that there is a simple solution to the Issue. It probably requires:

  1. investigating the HTML table elements and attributes
  2. adding some number of extra attributes to the CNXML->XHTML conversion
  3. creating a CSS file that interprets those attributes.

As an example, something like the following (but more complicated) showcases how additional attributes could be used:

// HTML
<table data-column-count="3">
  <col data-width="2"/>
</table>

// CSS
table[data-column-count="3"] {
  col[data-width="1"] { width: 33% }
  col[data-width="2"] { width: 67% }
}
openstaxalina commented 6 years ago

Decision: We will not use colwidth in webview. We will continue to use it as-needed to affect the PDF. Moving this issue to the content-managers repo.

openstaxalina commented 6 years ago