Re: [Doxygen-develop] Adding of new (all) HTML entities? A one line solution?
Brought to you by:
dimitri
From: John O. <jo...@ly...> - 2001-07-23 15:16:48
|
> doc.l would be modify and this line added: > <DocScan,Text>"&"[a-zA-Z0-9]{1}";" { outDoc->writeEntity(yytext[1]); } > <DocScan,Text>"&"[a-zA-Z0-9]{2}";" { outDoc->writeEntity(yytext[2]); } > <DocScan,Text>"&"[a-zA-Z0-9]{3}";" { outDoc->writeEntity(yytext[3]); } > <DocScan,Text>"&"[a-zA-Z0-9]{4}";" { outDoc->writeEntity(yytext[4]); } > > I have several questions...: > > -Q1: Are the following single line could replace the 4 lines? > <DocScan,Text>"&"[a-zA-Z0-9]{1,4}";" { outDoc->writeEntity(yytext[4]); } > (I'm very lazy! :-) > Why do you have yytext[1] etc. in the above example and only yytext[4] in your suggested replacement? > -Q2: There is a theorical problem: what is the order of scanning? to be > backward compatible, the added regex should be check if nothing > else has already matched. > If you read the flex manual page everything will be explained. ;) The parser generated by flex picks the longest matching rule it can find of all active rules. One way for a rule to become active is to call for it explicitly, i.e. BEGIN(DocScan) will activate all rules with DocScan in them. BTW. I have now successfully implemented my tags so that I can write @run foo @filename bar gazonk @endrun *and* @file @run foo @filename bar gazonk @endrun I had to modify (among other things) the function findFileDef found in util.cpp so that it recognizes ClearCase version numbers. The command @run cleartool ls @filename @endrun would result in something like this /view/r10_epkjols_garp/vobs/bscrp/r10_new_trh/foo.c@@/main/r10_predev/CHECKEDOUT from /main/r10_predev/1 Rule: CHECKEDOUT beeing returned from cleartool (in the case when a file is checked out). My changes makes the findFileDef function aware of the @-signes in the string and when comparing against already found files it ignores everything after the first @-sign (including the sign itself). I have also added a new method to the FileDef class called setVersion() which stores a QCString containing version number infomration about the file, i.e. in my case everything after the @-signes including them as well. Then in the writeDocumentation() method in FileDef I modified the title etc. to use my getVersionName() method which returns the filename combined with version infomration. I have also modified the layout of the generated HTML-pages so the result looks more like what Java2 JavaDoc outputs. The reason for doing so was simply that when you have code containing several pages of #define statements and (in the same file) several pages of functions it is very difficult to see where the different sections start and end. IMHO the Java2 way of solving this by using lightblue background for the headings solves this problem nicely. When doing these changes to the layout I found out that the pages containing the lists of todo:s, bug:s and test:s uses a different to generate the headings. They use startSection() instead of startTitle(). Is this a bug, and if not, what is the design reason for doing it that way? As a result of changing the layout, I came quickly to the conclusion that the layout of the generated files should not be hardcoded. Instead I think that a user should be able to configure this via external file(s). One possibility would be to have the document layout of the different kinds of pages defined using XML. That is (for example), instead of having configuration options for which of the different dot-diagrams I want to have, I modify an XML file. Just to give you an idea of what I'am after I'll give you an example of what such a file could look like <sourcecode> <tagDefinitions> <define heading> <before data="<table border=1 cellpadding=3 cellspacing=0 width=100%> <tr bgcolor=#CCCCFF> <td colspan=1><font size=+2><b>"/> <after data=" </b></font></td> </tr> </table><br>" </define> <define include> <before data="<code>"/> <after data="</code><br>"/> </define> etc. </tagDefinitions> <layout> <tag name="heading"> <tag name="include"> etc. </layout> </sourcecode> If a user wants the include section repeated in the detailed section, you do not have to modify the source code, just modify the layout section in the XML file. The same goes if you want your headings in some other way than the default provided etc. etc. Ofcourse you have to have different layouts for the different targets (HTML, LaTeX, man, RTF, ...), but you can never avoid that. The question is if that information should be hardcoded or not... /John |