giellalt / giella-core

Build tools and build support files as well as developer support tools for the GiellaLT repositories.
https://giellalt.uit.no
GNU General Public License v3.0
7 stars 2 forks source link

doccomments2ghpages.awk - improve CG doccomment extraction #15

Closed snomos closed 2 years ago

snomos commented 2 years ago

The main culprit is that CG uses # as the comment character, whereas the other source files we extract from are using !. This leads to # being part of the extracted text after !!= and !!≈. That is not desirable.

Example:

LIST Err/Orth =                  #!! - `Err/Orth`:
                Err/Orth         #!!≈     - `@CODE@`
                Err/Orth-a/á     #!!≈     - `@CODE@`
                Err/Orth-nom/gen #!!≈     - `@CODE@`
                Err/Orth-nom/acc #!!≈     - `@CODE@`
                Err/DerSub       #!!≈     - `@CODE@`
                Err/CmpSub       #!!≈     - `@CODE@`
                Err/UnspaceCmp   #!!≈     - `@CODE@`
                Err/HyphSub      #!!≈     - `@CODE@`
                Err/SpaceCmp     #!!≈     - `@CODE@`
                Err/Spellrelax   #!!≈     - `@CODE@`
                err_orth_mt      #!!≈     - `@CODE@`
                ;

comes out as:

- `Err/Orth`:
    - `Err/Orth #`
    - `Err/Orth-a/á #`
    - `Err/Orth-nom/gen #`
    - `Err/Orth-nom/acc #`
    - `Err/DerSub #`
    - `Err/CmpSub #`
    - `Err/UnspaceCmp #`
    - `Err/HyphSub #`
    - `Err/SpaceCmp #`
    - `Err/Spellrelax #`
    - `err_orth_mt #`

which looks like this in the final output:

We don't want the # there 😄

snomos commented 2 years ago

Probably it would be best to parameterise the single line comment character based on file type, so that whatever the comment character is, it should be doubled to start a doc comment.

If done this way it would be easy to support new file types.

flammie commented 2 years ago

Mm, the scripts worked somewhat for VISL CG3 files by accident, I've split code into separate handlings since there's not much actually shared between the formats