grotsztaksel / Songbook_XMLtoEPUB

Set of Python tools Creating an ePub songbook from data defined as XML files
Apache License 2.0
1 stars 0 forks source link

Add verse numbering #14

Open grotsztaksel opened 3 years ago

grotsztaksel commented 3 years ago

This seems to work pretty well:

<ol>
  <li>
    <div class="verse">
      <table class="chords_beside">
        <tr>...</tr>
        <tr>...</tr>
        <tr>...</tr>
      </table>
      <p>...</p>
    </div>
    <div class="chorus">
      <table class="chords_beside">
        <tr>...</tr>
        <tr>...</tr>
      </table>
    </div>
  </li>
  <li>
    <p class="verse">...</p>
    <p class="chorus">...</p>
  </li>
</ol>

Consider more-less following changes in the CSS (note some border colors added for distinction):

@charset "utf-8";
/* Styles for Śpiewnik */
body, section, div, table, thead, tbody, tfoot, th, td, p, pre, ul, ol, dl, dt, dd, span, nav, header, footer {
  margin: 0px;
  padding: 0;
}
body {
  width: 768px;
  margin: 20px;
  padding: 0;
}
h1, h2, h3, h4 {
  page-break-after: avoid;
}
h1 {
  margin-bottom: 6px;
}
h3.links {
  border-top: 1px solid gray;
}
h3, h4 {
  padding-bottom: 0;
  margin-bottom: 0;
}
div, section {
  -moz-box-sizing: border-box;
  -o-box-sizing: border-box;
  -webkit-box-sizing: border-box;
  box-sizing: border-box;
}
p {
  page-break-inside: avoid;
padding-bottom: 20px;
}
table + p {
  padding-top: 20px;
}
table.chords_beside {
  width: 100%;
}
table, tr, td {
  border-collapse: collapse;
 /* border: 1px solid blue;*/
  font-style: inherit;
}
table {
border: 1px solid blue;
margin-top: 20px;
vertical-align: top;
padding-bottom: 20px;
}

.chords_above {
  font-size: 0.75em;
}
.chords_beside {
  padding-top: 0;
  padding-bottom: 0;
}
.verse {
  margin-left: 0px;
}
.chorus {
  font-style: italic;
  margin-left: 30px;
}
.authors {
  font-size: 12px;
  padding-bottom: 2px;
  margin-bottom: 18px;
  margin-right: 20%;
  margin-top: 6px;
  border-bottom: 2px solid black;
}
tr.chords_above {
  padding-top: 10px;
}
tr:first-child {
margin-top:20px;
  border-top: 2px solid red;
padding-top: 10px;
}
td.chords {
  width: 20%;
}
ul > li {
  list-style-type: none;
  margin-left: 20px;
  padding-top: 10px;
}
ol > li {
  margin-left: 20px;
  padding-top: 10px;
}
div > table {
margin-top:20px;
padding-top: 10px;
}
.verse > table {
display:table;
}
#bottom {
  border-top: 2px solid black;
  position: absolute;
  bottom: 12;
  left: 32;
}
grotsztaksel commented 2 years ago

First of all, the current HTMLS are not standard compliant:

 <p>
    <table/>
 </p>

which needs to be fixed

grotsztaksel commented 2 years ago

Once the XHTML structure is fixed, there's yet another problem:

Most of the songs have their first verse written as a table to present chords. This causes rendering problems which seem to be encountered by other developers:

https://stackoverflow.com/questions/20979596/table-inside-list-item-vertically-shifted-in-chrome https://stackoverflow.com/questions/20073776/displaytable-in-ulli-to-get-vertical-alignmiddle-of-a-item-produces-chro

Modifying the CSS using display didn't help until now