openstax / oer.exports

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

American Government - Options re: table width/formatting #1733

Closed jdoehnert closed 8 years ago

jdoehnert commented 8 years ago

legacy-staging5 dev server col10023 module: Advantages and Disadvantages of Federalism

In the table below (and tables in general) do we have any way to control the width of the cells or how the column headers break? This table has a large amount of white space, likely because the column headers are wide. If we are able to break the column head text to two lines it would resolve part of the issue.

If it is easy to overwrite the default alignment (left aligned text in cells) that would be a nice option for us to have more control in general. However it is a low priority need.

amgovtable

openstaxalina commented 8 years ago

@brittweinstein could you see if there is a semantic way (not ) to control column width? i know there are cnxml tags for this, but if memory serves, they do not work as intended.

brittweinstein commented 8 years ago

From what I can tell, this seems to be something that gets defined in the XSLT or the CSS-- maybe a developer would know more about this?

openstaxalina commented 8 years ago

Assigning to @zroehr, who I believe worked on the template.

kerwinso commented 8 years ago

Hopefully #1705 could fix this as well?

kerwinso commented 8 years ago

@zroehr The test content with the above table is available on dev here: http://legacy-textbook-dev.cnx.org/content/m15944/latest/

Looks like WW tried to center-align the cells with content in columns 2 and 3, but the template is not supporting that. However if each cell could be center-aligned (like in Microbiology), that may be an acceptable workaround.

Here's the markup WW used for the module linked above:

<colspec colnum="1" colname="c1"/>
<colspec colnum="2" colname="c2"/>
<colspec colnum="3" colname="c3"/>
<thead>
<row>
<entry namest="c1" nameend="c3" align="center">Elected Officials at the Federal, State, and Local Levels</entry>
</row>
<row valign="top">
<entry valign="top" align="left"/>
<entry align="left">Number of Elective Bodies</entry>
<entry align="left">Number of Elected Officials</entry>
</row>
</thead>
<tbody>
<row valign="top">
<entry valign="top" align="left"><emphasis effect="bold">Federal Government</emphasis></entry>
<entry valign="top" align="center">1</entry>
<entry valign="top" align="center"/>
</row>
<row valign="top">
<entry valign="top" align="left">Executive branch</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">2</entry>
</row>
<row valign="top">
<entry valign="top" align="left">U.S. Senate</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">100</entry>
</row>
<row valign="top">
<entry valign="top" align="left">U.S. House of Representatives</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">435</entry>
</row>
<row valign="top">
<entry valign="top" align="left"><emphasis effect="bold">State Government</emphasis></entry>
<entry valign="top" align="center">50</entry>
<entry valign="top" align="center"/>
</row>
<row valign="top">
<entry valign="top" align="left">State legislatures</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">7,382</entry>
</row>
<row valign="top">
<entry valign="top" align="left">Statewide offices</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">1,036</entry>
</row>
<row valign="top">
<entry valign="top" align="left">State boards</entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center">1,331</entry>
</row>
<row valign="top">
<entry valign="top" align="left"><emphasis effect="bold">Local Government</emphasis></entry>
<entry valign="top" align="center"/>
<entry valign="top" align="center"/>
</row>
<row valign="top">
<entry valign="top" align="left">County governments</entry>
<entry valign="top" align="center">3,034</entry>
<entry valign="top" align="center">58,818</entry>
</row>
<row valign="top">
<entry valign="top" align="left">Municipal governments</entry>
<entry valign="top" align="center">19,429</entry>
<entry valign="top" align="center">135,531</entry>
</row>
<row valign="top">
<entry valign="top" align="left">Town governments</entry>
<entry valign="top" align="center">16,504</entry>
<entry valign="top" align="center">126,958</entry>
</row>
<row valign="top">
<entry valign="top" align="left">School districts</entry>
<entry valign="top" align="center">13,506</entry>
<entry valign="top" align="center">95,000</entry>
</row>
<row valign="top">
<entry valign="top" align="left">Special districts</entry>
<entry valign="top" align="center">35,052</entry>
<entry valign="top" align="center">84,089</entry>
</row>
<row valign="top">
<entry valign="top" align="left"><emphasis effect="bold">Total</emphasis></entry>
<entry valign="top" align="center"><emphasis effect="bold">87,576</emphasis></entry>
<entry valign="top" align="center"><emphasis effect="bold">510,682</emphasis></entry>
</row>
</tbody>
InconceivableVizzini commented 8 years ago

If they want a particular width of cells we'll have to use the colwidth attribute on the colspec.

See https://legacy.cnx.org/eip-help/colspec for reference.

kerwinso commented 8 years ago

Let me mess around with this attribute and see if it does something, but Alina's and Britt's comments above seem to suggest they probably don't.

InconceivableVizzini commented 8 years ago

with regards to table styling of alignment, etc, we have specifically introduced rules for text alignment within tables which overrides the inline alignment setting. We can remove this styling and allow the inline setting to be used, but we'll have to test the result of this... most likely it would cause problems because of inconsistent markup.

kerwinso commented 8 years ago

OK so I tried adding <colwidth> attributes to the table above, as well as sticking <newline>'s into the column header cells, in order to try to manually force them into 2 lines to shorten the column width. Neither tactic worked.

The only remaining option is allow inline table alignment setting like we did with Microbiology. @nyxer95, we will need to decide whether or not to allow this.

InconceivableVizzini commented 8 years ago

Leaving this as it is for now. We can update this to allow the inline styles to work properly, but doing so will require investigation/review and likely a lot of content updates to normalize and test inline table styles.

jdoehnert commented 8 years ago

No action necessary. Confirmed with project content team. This table is an outlier and is not worth changing the template or CNXML to resolve.