libxo
libxo copied to clipboard
adding keys test_05 changes padding output for HIPx
This patch adds keys to an instance, but changes the output under HIPx (html+info+pretty+xpath). I think the "-14.14" is getting lost.
Thanks, Phil
--- a/tests/core/test_05.c
+++ b/tests/core/test_05.c
@@ -123,8 +123,8 @@ main (int argc, char **argv)
"{T:/%-12s}{T:Time (%)}\n", "Department");
for ( ; ep->e_first; ep++) {
xo_open_instance("employee");
- xo_emit("{[:-25}{:first-name/%s} ({:nic-name/\"%s\"}){]:}"
- "{:last-name/%-14..14s/%s}"
+ xo_emit("{[:-25}{k:first-name/%s} ({k:nic-name/\"%s\"}){]:}"
+ "{k:last-name/%-14..14s/%s}"
"{:department/%8u}{:percent-time/%8u}\n",
ep->e_first, ep->e_nic, ep->e_last, ep->e_dept, ep->e_percent);
if (ep->e_percent > 50) {
... test_05.c ... T ...
... test_05.c ... XP ...
... test_05.c ... JP ...
... test_05.c ... JPu ...
... test_05.c ... HP ...
... test_05.c ... X ...
... test_05.c ... J ...
... test_05.c ... H ...
... test_05.c ... HIPx ...
<div class="text"> (</div>
<div class="data" data-tag="nic-name" data-xpath="/employees/employee/nic-name">"რეგტ"</div>
<div class="text">)</div>
- <div class="padding"> </div>
+ <div class="padding"> </div>
<div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">გთხოვთ ახ </div>
- <div class="data" data-tag="department" data-xpath="/employees/employee/department"> 431</div>
- <div class="data" data-tag="percent-time" data-xpath="/employees/employee/percent-time" data-type="number" data-help="Percentage of full & part time (%)"> 90</div>
+ <div class="data" data-tag="department" data-xpath="/employees/employee[first-name = 'Jim'][nic-name = '"რეგტ"'][last-name = 'გთხოვთ ახ']/department"> 431</div>
+ <div class="data" data-tag="percent-time" data-xpath="/employees/employee[first-name = 'Jim'][nic-name = '"რეგტ"'][last-name = 'გთხოვთ ახ']/percent-time" data-type="number" data-help="Percentage of full & part time (%)"> 90</div>
</div>
<div class="line">
<div class="data" data-tag="first-name" data-xpath="/employees/employee/first-name" data-type="string" data-help="First name of employee">Terry</div>
<div class="text"> (</div>
<div class="data" data-tag="nic-name" data-xpath="/employees/employee/nic-name">"<one"</div>
<div class="text">)</div>
- <div class="padding"> </div>
<div class="data" data-tag="last-name" data-xpath="/employees/employee/last-name" data-type="string" data-help="Last name of employee">Οὐχὶ ταὐτὰ παρ</div>
- <div class="data" data-tag="department" data-xpath="/employees/employee/department"> 660</div>
- <div class="data" data-tag="percent-time" data-xpath="/employees/employee/percent-time" data-type="number" data-help="Percentage of full & part time (%)"> 90</div>
+ <div class="data" data-tag="department" data-xpath="/employees/employee[first-name = 'Terry'][nic-name = '"<one"'][last-name = 'Οὐχὶ ταὐτὰ παρίσταταί μοι Jones']/department"> 660</div>
+ <div class="data" data-tag="percent-time" data-xpath="/employees/employee[first-name = 'Terry'][nic-name = '"<one"'][last-name = 'Οὐχὶ ταὐτὰ παρίσταταί μοι Jones']/percent-time" data-type="number" data-help="Percentage of full & part time (%)"> 90</div>
Running the command:
xohtml -c './test_05.test --libxo:HIPx' -f /tmp/foo.html
while just adding the 'k' to the first field makes it obvious that they length of the key is not being counted:
Note that "Terry" is five chars and "Leslie" is six and the second column of the table slides to the left by that amount.
The first two fields are inside a "{[:-25}...{]:}". On the first line ("Jim") the padding
is 3 characters shorter than it should be.
FWIW: tests/core/test_07.c can get the same behavior with the same "{:k}" change