-
Notifications
You must be signed in to change notification settings - Fork 71
/
makeddox.sh
executable file
·58 lines (47 loc) · 3.69 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
55
56
57
58
#!/bin/sh
mkdir -p ddox/temp
echo "Generating JSON file for modules"
echo "MODULES =" > modules.ddoc ;grep -h -e "^module" generated/gtkd/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" generated/sourceview/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" generated/vte/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" generated/gstreamer/* -r | sort -u | sed 's/;//' | sed 's/\r//' | sed 's/module \(.*\)$/\t$(MODULE \1)/' >> modules.ddoc
grep -h -e "^module" generated/peas/* -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 \
generated/gtkd/gtk/*.d generated/gtkd/gtk/c/*.d generated/gtkd/gtkc/*.d generated/gtkd/gtkd/*.d generated/gtkd/glib/*.d generated/gtkd/glib/c/*.d generated/gtkd/gio/*.d \
generated/gtkd/gio/c/*.d generated/gtkd/gdk/*.d generated/gtkd/gdk/c/*.d generated/gtkd/gobject/*.d generated/gtkd/gobject/c/*.d \
generated/gtkd/gthread/*.d generated/gtkd/gthread/c/*.d generated/gtkd/atk/*.d generated/gtkd/atk/c/*.d generated/gtkd/pango/*.d generated/gtkd/pango/c/*.d \
generated/gtkd/cairo/*.d generated/gtkd/cairo/c/*.d generated/gtkd/gdkpixbuf/*.d generated/gtkd/gdkpixbuf/c/*.d generated/gtkd/rsvg/*.d generated/gtkd/rsvg/c/*.d \
generated/sourceview/gsv/*.d generated/sourceview/gsv/c/*.d generated/sourceview/gsvc/*.d \
generated/vte/vtec/*.d generated/vte/vte/*.d generated/vte/vte/c/*.d \
generated/gstreamer/gstreamer/*.d generated/gstreamer/gstreamer/c/*.d generated/gstreamer/gstinterfaces/*.d generated/gstreamer/gstinterfaces/c/*.d generated/gstreamer/gstreamerc/*.d \
generated/gstreamer/gst/mpegts/*.d generated/gstreamer/gst/mpegts/c/*.d generated/gstreamer/gst/base/*.d generated/gstreamer/gst/base/c/*.d generated/gstreamer/gst/app/*.d generated/gstreamer/gst/app/c/*.d \
generated/peas/peas/*.d generated/peas/peas/c/*.d generated/peas/peasc/*.d -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