I've searched but cannot find an answer.
How do I print an HTML Table with page breaks based on the value of a particular cell.
Basically I want to print a list of addresses and have a new page when the road name changes.
You can’t do this in HTML or in CSS. You need to mark the page breaks when generating the table or with client-side JavaScript. In either case, you just need to store the road name (which you need to get from somewhere according to the structure of the date). When processing a new row, you then just check the road name in its data against the stored value, and if they differ, emit
<tr style="page-break-before: always">
instead of a simple <tr> or, when doing this client-side, modify the style property of the tr element node accordingly.
Related
I have a simple HTML file only containing a table with no further CSS or any other attributes. The structure of this file never changes, but its content is always different.
I try to match the content of a specific cell (td) which shall give me the name of the first occurence of a contact which has the type 'Misc'.
In my example I try to match the name 'Michael Jackson':
This is what I've got so far:
(<td>\s*Contact:\s*<\/td>((?!<br>).)*<td>\s*Misc\s*<\/td>)
But this only selects the two contact blocks containing the type 'Misc'. I don't know how to go on from this point ...
Here again is my regex and the HTML string I am using:
https://regex101.com/r/xIzr3a/1/
Thanks for any help or advises!
I am new to StringTemplate template engine and want to use it for generating an html document with a table. I want to alter the style of the table rows depending on whether it is odd or even. I found a discussion on the stringtemplate-interest mailing list that describes the general approach ([stringtemplate-interest] Odd even row formatting).
But I have an additional requirement which breaks this general approach (I think). I want to render rows depending on the existence of a value. So I am working with a conditional expression $if(expr)$. My template looks like this.
delimiters „$“,“$“
htmlTable(valueA, valueB, valueC, valueD) ::= <<
<table>
<tr styleClass='odd'><td>$valueA$</td></tr>
$if(valueB)$
<tr><td>$valueB$</td></tr>
$endif$
<tr styleClass='odd'><td>$valueC$</td></tr>
<tr><td>$valueD$</td></tr>
</table>
>>
In the given template I can not use the hard coded styleClass attribute, because it would render the table wrong if the valueB parameter does not exist.
Is my requirement realizable with a template engine like StringTemplate, which focus on separation of model and view? Or is there too much model in the requirement as to implement it in the view? I know how to do it in other template engines (i. e. FreeMarker or Apache Velocity) or I might use some fancy CSS or javascript stuff but I would rather keep the model-view separation and use StringTemplates internal instruments.
I have a MediaWiki site hosted on ShoutWiki. I want to create a template that will return a table, with rows filtered by the template's single argument. The table could be stored in whatever format works. It will have three columns, and I want to display rows only if the template's argument is a substring of the text in the first cell in the row. The search needs to be case sensitive.
There are JavaScript solutions for this, but I'd like to do it on the server if possible.
If you don't have a special extension handling that (e.g. Scribunto adding Lua support and therefore a real programming language to MediaWiki), you need to encapsulate each row into an own template call.
Example:
Template:FilteredRow
{{#ifeq:{{{1|}}}|{{{2|}}}|<tr><td>{{{2|empty row}}}</tr></td> }}
Template:A_Table
<table>
{{FilteredRow|1={{{filter|}}}|2=some content here}}
{{FilteredRow|1={{{filter|}}}|2=some content here in row 2}}
{{FilteredRow|1={{{filter|}}}|2=some content here in row 3}}
{{FilteredRow|1={{{filter|}}}|2=baz}}
</table>
Using:
{{A_Table|filter=baz}}
Result:
<table>
<tr><td>baz</td></tr>
</table>
With Scribunto, you could simply save your table as HTML table, or JSON, or whatever parser you find. Note that JSON support (recognition, formatting, validation) in MediaWiki and user namespace is being worked on.
http://www.w3.org/TR/WCAG-TECHS/F17.html
I have some issues understanding the criteria of this and what makes a website fail BASED on the series of tests involved.
Check for id and accesskey values which are not unique within the document.
Check that attribute values that have an idref value have a corresponding id value.
For tables that use the axis attribute, check that all values listed in the axis attribute have a corresponding id value in a table header cell in the same table.
For client-side image maps, check that the value of the usemap attribute has a corresponding id value if the usemap attribute is not a URI.
If step #1, step #3 or step #4 is true or step #2 is false, then this failure condition applies and the content fails the success criterion.
These are a series of requirements that make the HTML you have written valid.
1 is straightforward. There can't be more than one element on your page with the same ID. If you have multiple elements with the same ID on your page then when you call the Javascript function
document.getElementById("idnamehere")
then you will have trouble selecting all of them. If you want multiple items to have the same style, then you should be using the class attribute rather than ID. The ID must be unique!
2 If you have given an element the idref attribute, then it must correspond to an existing element with the id you have specified in the idref attribute. For example, if you wanted to use the following idref:
<p idref="data"></p>
Then there must be an existing id somewhere in your document, that looks something like:
<span id="data"></span>
You can't reference an id that doesn't exist!
3 I have never used the axis attribute before, but what I understand from reading that document and a small amount of Googling; if you want use the axis attribute then every cell must have a corresponding axis attribute supplied in the table header of the column it is in. Someone else may be able to expand on this.
4 Again, I have never used an ImageMap, but the W3C document has categorized this set of rules under the general theme of non-unique identities and mismatched references, so I can only assume that it is similar to 2 whereby, the imagemap has a corresponding usemap, which is referenced by its ID (unless, it has been specified as a URI).
I think the gist of this document is to enforce the concept that there should always be a corresponding attribute for the elements that require them, and your element ID's should always be kept unique.
If you are trying to fix something on your website, then http://validator.w3.org/ can be a very handy resource for pinpointing errors on your page and describing them. Hope this helps!
anyone have an idea how to do this.
i need to get rid of forum views either by hide, delete, disable or any other way.
I assume you mean THREAD views in the text below:
Do a template search for $thread[views], and there should be a template called threadbit. If you want to quickly and easily obscure the views just delete $thread[views] and replace with or asterisks, or whatever you'd like.
If you want to remove the whole <td> it becomes more complicated. First you remove that <td>, and then in FORUMDISPLAY template you have to remove the <td> that contains $vbphrase[views] (do a search for it if you can't find it).
But I believe there may be some issue with removing that entire column, and any of the hardcoded colspan attributes among the templates. If so then you would have to reduce the colspan number by one. I'm not sure about the colspan part, it's been a long time since I edited the FORUMDISPLAY and threadbit templates.
Also, you will need to remove the Views from another location in the threadbit template:
title="<phrase 1="$thread[replycount]" 2="$thread[views]"
This shows up when you hover on top of the Last Post column. Just delete $thread[views] and it will show up blank.
i need 50 points to reply, sorry for keep using answer.
i was thinking of going 1 step futher and swapping the word hidden for a picture?
I used the word hidden just as a test to see if it would work which it does