cimug-org / CIMTool

CIMug's CIMTool for the Common Information Model (CIM).
http://cimtool.ucaiug.io/
GNU Lesser General Public License v2.1
44 stars 5 forks source link

Add the generation of a TOC in the RTF Word document generated by the profile-doc-rtf.xsl builder #90

Open tviegut opened 9 months ago

tviegut commented 9 months ago

A desired enhancement to the existing profile-doc-rtf.xsl builder is the generation of a TOC for all tables/classes in the generated RTF Word document.

https://stackoverflow.com/questions/1097358/add-table-of-contents-to-rtf-document

https://www.biblioscape.com/rtf15_spec.htm#Heading62

Example from the above stack overflow article:

{\rtf1\ansi\deff0\adeflang1045
{\fonttbl {\f0\fsserif\fcharset238 Verdana;}}
\titlepage\line\line\line\line\line
{\pard
{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt\f0\fs80\b\scaps\qc\ul0 Title Page\line go to Table of Contents}}
\par}
\page{\*\bkmkstart page2}{\*\bkmkend page2}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par}
\page{\*\bkmkstart page3}{\*\bkmkend page3}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par}
\page{\*\bkmkstart page4}{\*\bkmkend page4}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par}
\page{\*\bkmkstart page5}{\*\bkmkend page5}\line\line\line\line\line{\pard\f0\fs80\b\scaps\qc\sa10000{\field{\*\fldinst HYPERLINK \\l "toc"} {\fldrslt Page}} \chpgn\par}
\page{\*\bkmkstart toc}{\*\bkmkend toc}{\pard\sa1000\f0\fs50\b\qc{\field{\*\fldinst TOC}{\fldrslt Table of Contents}}\par}
{\pard\f0\fs28\fi0\trowd\cellx8000\cellx8600
\pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page2"} {\fldrslt\ul0 Link to anchor #page2}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page2}}\cell\row
\pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page3"} {\fldrslt\ul0 Link to anchor #page3}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page3}}\cell\row
\pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page4"} {\fldrslt\ul0 Link to anchor #page4}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page4}}\cell\row
\pard\intbl\ql {\field{\*\fldinst HYPERLINK \\l "page5"} {\fldrslt\ul0 Link to anchor #page5}}\cell\pard\intbl\qr {\field{\*\fldinst PAGEREF page5}}\cell\row
\par}
}
Sveino commented 1 month ago

I think it would be good if we can reuse Pandoc, #185 then we can pick any format that is supported by Pandoc. Yes, we can all download it ourselves, but it would be good to have it abend in CIMTool so that we can standardise settings.