forked from gtkd-developers/GtkD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeddox.sh
executable file
·54 lines (43 loc) · 2.54 KB
/
makeddox.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/sh
mkdir -p ddox/temp
echo "Generating JSON file for modules"
echo "MODULES =" > modules.ddoc ;grep -h -e "^module" src/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" srcgl/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" srcsv/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" srcvte/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
dmd -o- -D -X -Xfddox/docs.json -Ddddox/temp modules.ddoc docs/candy.ddoc \
src/gtk/* src/gtkc/* src/glib/* src/gio/* src/gdk/* \
src/gobject/* src/gthread/* src/atk/* \
src/pango/* src/cairo/* src/gdkpixbuf/* \
srcgl/glgdk/* srcgl/glgtk/* srcgl/gtkglc/* \
srcsv/gsv/* srcsv/gsvc/* \
srcvte/vtec/* srcvte/vte/* -op
# Delete all html files generated by D ddocs
rm -rf ddox/temp/*
#insert a fake comment for all modules so that ddox doesn't filter out the modules
echo "Adding comment to modules"
sed -i 's/"kind" : "module",/"kind" : "module", "comment" : " ",/g' ddox/docs.json
#Fix problem with unicode quotes by replacing them with ASCII quotes
echo Replacing unicode double and single quotes with ASCII equivalent
sed -i 's/“/\"/g' ddox/docs.json
sed -i 's/”/\"/g' ddox/docs.json
sed -i 's/’/\'/g' ddox/docs.json
#Escape tags that are causing problems.
echo Escaping gtk.Builder tags.
sed -i 's/<template\([^>]*\)>/\<template\1\>/g' ddox/docs.json
sed -i 's/<\/template>/\<\/template\>/g' ddox/docs.json
sed -i 's/<interface\([^>]*\)>/\<interface\1\>/g' ddox/docs.json
sed -i 's/<\/interface>/\<\/interface\>/g' ddox/docs.json
sed -i 's/<object\([^>]*\)>/\<object\1\>/g' ddox/docs.json
sed -i 's/<\/object>/\<\/object\>/g' ddox/docs.json
sed -i 's/<child\([^>]*\)>/\<child\1\>/g' ddox/docs.json
sed -i 's/<\/child>/\<\/child\>/g' ddox/docs.json
sed -i 's/<property\([^>]*\)>/\<property\1\>/g' ddox/docs.json
sed -i 's/<\/property>/\<\/property\>/g' ddox/docs.json
echo "Convert UTF-8 to ASCII for everything else"
mv ddox/docs.json ddox/docs_utf8.json
iconv -f utf8 -t ascii -c ddox/docs_utf8.json > ddox/docs.json
# Filter out everything except public members
dub run ddox -- filter ddox/docs.json --only-documented --min-protection Public
# Use dub to run ddox and generate offline ddox documentation
dub run ddox -- generate-html --navigation-type=moduleTree ddox/docs.json ddox