2 # -*- tab-width: 4; indent-tabs-mode: nil; py-indent-offset: 4 -*-
4 # This file is part of the LibreOffice project.
6 # This Source Code Form is subject to the terms of the Mozilla Public
7 # License, v. 2.0. If a copy of the MPL was not distributed with this
8 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
12 # This throwaway program can be used to convert idl_chapter_refs.txt to a
13 # "fake" IDL file that can be fed to doxygen to get the DevGuide Wiki links.
17 # In core, generate a file letting us know what kinds of entities to declare:
18 # cat <(make -s cmd cmd='$(INSTDIR)/sdk/bin/unoidl-read --summary $(INSTDIR)/program/types.rdb') <(make -s cmd cmd='$(INSTDIR)/sdk/bin/unoidl-read --summary $(INSTDIR)/program/types.rdb $(INSTDIR)/program/types/offapi.rdb') | LC_ALL=C sort | LC_ALL=C uniq > /tmp/kinds
20 # Run the script while feeding it the chapter references and output the fake IDL:
21 # python wikilinks.py < idl_chapter_refs.txt > generated_idl_chapter_refs.idl
25 devguidewww
= "https://wiki.documentfoundation.org/"
32 for line
in open("/tmp/kinds") :
33 (kind
,_
,name
) = line
.strip().partition(" ")
36 for line
in sys
.stdin
:
38 if sline
.startswith("LINK:") :
39 link
= sline
.partition('LINK:')[2]
40 elif sline
.startswith("DESCR:") :
41 description
= sline
.partition('DESCR:')[2]
42 elif sline
== "TOPIC:" :
47 elif sline
in allthings
:
48 allthings
[sline
].append((link
, description
))
50 allthings
[sline
] = [(link
, description
)]
52 print("""/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
53 /* this file was generated from idl_chapter_refs.txt by wikilinks.py */""")
57 parts
= key
.split(".")
59 for p
in parts
[0:-1] :
60 print("module", p
, "{")
61 # for enums the "{}" trick results in broken/duplicate output
63 print("/// @" + kind
, parts
[-1])
64 print("/// @par Developers Guide")
65 for item
in allthings
[key
] :
66 print("/// <a href=\"" + devguidewww
+ item
[0] + "\">"
67 + item
[1] + "</a><br>")
68 # doxygen does not have tags for e.g. @service but empty definition works
70 print(kind
, parts
[-1], "{}")
71 for p
in parts
[0:-1] :
74 # vim:set shiftwidth=4 softtabstop=4 expandtab: