LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Is there a mechanism in HTML5/CSS to ensure same result from duplicated ordered list code? (https://www.linuxquestions.org/questions/programming-9/is-there-a-mechanism-in-html5-css-to-ensure-same-result-from-duplicated-ordered-list-code-4175705563/)

rblampain 12-30-2021 12:00 AM

Is there a mechanism in HTML5/CSS to ensure same result from duplicated ordered list code?
 
I have a large TOC of nested ordered lists at the beginning of a HTML5 document. Further down the same document, the same TOC is repeated into small segments which are each followed by their own text.

Is there a mechanism in HTML/CSS to ensure that in booth cases the result will be the same?
For example, if a list line in the TOC at the beginning of the document renders as A1c2, the same repeated line before the text should also render as A1c2

It seems to me that the only way is to have each segment in a separate file "included" (somehow) to form the entire HTML document or write a script constructing the first TOC without any text and the second inserting text in the correct place which is tedious and error-prone.

HTML may have a cleaner solution of which I am unaware.

Thank you for your help.

Michael Uplawski 12-30-2021 12:43 AM

code?

NevemTeve 12-30-2021 02:49 AM

How to generate html-content programmatically? With JavaScript on client side, or PHP (and many more) on server side.

shruggy 12-30-2021 03:41 AM

HTML templating engines are abound. So are HTML pre-processors (or macro processors) and static site generators. As for dynamically generated content, NevemTeve already answered this above.

dugan 12-30-2021 10:23 AM

If you're writing the HTML by hand, no.

If you're generating the HTML programmatically using a backend framework, a static site generator, a content management system, or whatever, then the answer should be yes.

sundialsvcs 12-30-2021 11:39 AM

In many cases, such content is developed using XML “semantic markup” technology, using such technologies as XXE. https://www.xmlmind.com/xmleditor/ You may have heard of “DocBook,” which is how all of those O’Reilly books with animals on the cover were actually produced, including shorter and longer “flavors” of them. https://docbook.org/

The document is created using XML tags which describe what the content, semantically speaking, “is.” Not what it looks like. Then, a technology called XSLT is used to produce various kinds of deliverables from it … including HTML and PDF. Or even Unix/Linux “man” pages.

I once used these techniques to generate several hundred pages of online documentation for a Windows application … simultaneously in 16-bit “Winhelp,” 32-bit Windows help, and HTML pages for the product website.


All times are GMT -5. The time now is 05:42 AM.