summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-26 14:42:19 +0100
committerDaniel Kolesa <d.kolesa@osg.samsung.com>2016-08-26 14:42:19 +0100
commitd69d54ff17a73eead97cfe3eabe34298d2b7e9ad (patch)
treec06026d1b466b6a41f13ebeaf2a972eef7cceaec
parentcdaa4ab68c8cca562a25e4330f34193ac6efa1f1 (diff)
docs: let the writer handle title headings
-rw-r--r--src/scripts/elua/apps/docgen/writer.lua2
-rw-r--r--src/scripts/elua/apps/gendoc.lua66
2 files changed, 29 insertions, 39 deletions
diff --git a/src/scripts/elua/apps/docgen/writer.lua b/src/scripts/elua/apps/docgen/writer.lua
index 9f7930716e..aa29426096 100644
--- a/src/scripts/elua/apps/docgen/writer.lua
+++ b/src/scripts/elua/apps/docgen/writer.lua
@@ -58,7 +58,7 @@ M.Writer = util.Object:clone {
58 dutil.mkdir_p(subs) 58 dutil.mkdir_p(subs)
59 self.file = assert(io.open(dutil.make_page(subs), "w")) 59 self.file = assert(io.open(dutil.make_page(subs), "w"))
60 if title then 60 if title then
61 self:write_raw("~~Title: ", title, " ~~") 61 self:write_raw("<title>", title, "</title>")
62 self:write_nl() 62 self:write_nl()
63 end 63 end
64 end, 64 end,
diff --git a/src/scripts/elua/apps/gendoc.lua b/src/scripts/elua/apps/gendoc.lua
index edd50a91d3..a50d3bb077 100644
--- a/src/scripts/elua/apps/gendoc.lua
+++ b/src/scripts/elua/apps/gendoc.lua
@@ -327,7 +327,7 @@ local build_functable = function(f, title, ctitle, cl, tp)
327 if #t == 0 then 327 if #t == 0 then
328 return 328 return
329 end 329 end
330 f:write_h(title, 3) 330 f:write_h(title, 2)
331 local nt = {} 331 local nt = {}
332 for i, v in ipairs(t) do 332 for i, v in ipairs(t) do
333 local lbuf = writer.Buffer() 333 local lbuf = writer.Buffer()
@@ -354,7 +354,6 @@ end
354 354
355local build_ref = function() 355local build_ref = function()
356 local f = writer.Writer("reference", "EFL Reference") 356 local f = writer.Writer("reference", "EFL Reference")
357 f:write_h("EFL Reference", 2)
358 357
359 local classes = {} 358 local classes = {}
360 local ifaces = {} 359 local ifaces = {}
@@ -692,7 +691,6 @@ local build_class = function(cl)
692 local f = writer.Writer(cln, cl:full_name_get()) 691 local f = writer.Writer(cln, cl:full_name_get())
693 stats.check_class(cl) 692 stats.check_class(cl)
694 693
695 f:write_h(cl:full_name_get(), 2)
696 keyref.add(cl:full_name_get():gsub("%.", "_"), cln, "c") 694 keyref.add(cl:full_name_get():gsub("%.", "_"), cln, "c")
697 695
698 f:write_folded("Inheritance graph", function() 696 f:write_folded("Inheritance graph", function()
@@ -702,11 +700,11 @@ local build_class = function(cl)
702 f:write_nl(2) 700 f:write_nl(2)
703 end 701 end
704 702
705 f:write_h("Inheritance hierarchy", 3) 703 f:write_h("Inheritance hierarchy", 2)
706 f:write_list(build_inherits(cl)) 704 f:write_list(build_inherits(cl))
707 f:write_nl() 705 f:write_nl()
708 706
709 f:write_h("Description", 3) 707 f:write_h("Description", 2)
710 f:write_raw(cl:doc_get():full_get(nil, true)) 708 f:write_raw(cl:doc_get():full_get(nil, true))
711 f:write_nl(2) 709 f:write_nl(2)
712 710
@@ -714,7 +712,7 @@ local build_class = function(cl)
714 build_functable(f, "Properties", "Property name", 712 build_functable(f, "Properties", "Property name",
715 cl, dtree.Function.PROPERTY) 713 cl, dtree.Function.PROPERTY)
716 714
717 f:write_h("Events", 3) 715 f:write_h("Events", 2)
718 local evs = cl:events_get() 716 local evs = cl:events_get()
719 if #evs == 0 then 717 if #evs == 0 then
720 f:write_raw("This class does not define any events.\n") 718 f:write_raw("This class does not define any events.\n")
@@ -745,13 +743,11 @@ local build_classes = function()
745end 743end
746 744
747local write_tsigs = function(f, tp, ns) 745local write_tsigs = function(f, tp, ns)
748 f:write_h(tp:full_name_get(), 2) 746 f:write_h("Signature", 2)
749
750 f:write_h("Signature", 3)
751 f:write_code(tp:serialize()) 747 f:write_code(tp:serialize())
752 f:write_nl() 748 f:write_nl()
753 749
754 f:write_h("C signature", 3) 750 f:write_h("C signature", 2)
755 f:write_code(tp:serialize_c(ns), "c") 751 f:write_code(tp:serialize_c(ns), "c")
756 f:write_nl() 752 f:write_nl()
757end 753end
@@ -763,7 +759,7 @@ local build_alias = function(tp)
763 759
764 write_tsigs(f, tp, ns) 760 write_tsigs(f, tp, ns)
765 761
766 f:write_h("Description", 3) 762 f:write_h("Description", 2)
767 f:write_raw(tp:doc_get():full_get(nil, true)) 763 f:write_raw(tp:doc_get():full_get(nil, true))
768 f:write_nl(2) 764 f:write_nl(2)
769 765
@@ -777,11 +773,11 @@ local build_struct = function(tp)
777 773
778 write_tsigs(f, tp, ns) 774 write_tsigs(f, tp, ns)
779 775
780 f:write_h("Description", 3) 776 f:write_h("Description", 2)
781 f:write_raw(tp:doc_get():full_get(nil, true)) 777 f:write_raw(tp:doc_get():full_get(nil, true))
782 f:write_nl(2) 778 f:write_nl(2)
783 779
784 f:write_h("Fields", 3) 780 f:write_h("Fields", 2)
785 781
786 local arr = {} 782 local arr = {}
787 for i, fl in ipairs(tp:struct_fields_get()) do 783 for i, fl in ipairs(tp:struct_fields_get()) do
@@ -803,11 +799,11 @@ local build_enum = function(tp)
803 799
804 write_tsigs(f, tp, ns) 800 write_tsigs(f, tp, ns)
805 801
806 f:write_h("Description", 3) 802 f:write_h("Description", 2)
807 f:write_raw(tp:doc_get():full_get(nil, true)) 803 f:write_raw(tp:doc_get():full_get(nil, true))
808 f:write_nl(2) 804 f:write_nl(2)
809 805
810 f:write_h("Fields", 3) 806 f:write_h("Fields", 2)
811 807
812 local arr = {} 808 local arr = {}
813 for i, fl in ipairs(tp:enum_fields_get()) do 809 for i, fl in ipairs(tp:enum_fields_get()) do
@@ -884,16 +880,16 @@ local build_vallist = function(f, pg, ps, title)
884 if same then ps = {} end 880 if same then ps = {} end
885 end 881 end
886 if #pg > 0 or #ps > 0 then 882 if #pg > 0 or #ps > 0 then
887 f:write_h(title, 3) 883 f:write_h(title, 2)
888 if #pg > 0 then 884 if #pg > 0 then
889 if #ps > 0 then 885 if #ps > 0 then
890 f:write_h("Getter", 4) 886 f:write_h("Getter", 3)
891 end 887 end
892 build_parlist(f, pg, true) 888 build_parlist(f, pg, true)
893 end 889 end
894 if #ps > 0 then 890 if #ps > 0 then
895 if #pg > 0 then 891 if #pg > 0 then
896 f:write_h("Setter", 4) 892 f:write_h("Setter", 3)
897 end 893 end
898 build_parlist(f, ps, true) 894 build_parlist(f, ps, true)
899 end 895 end
@@ -905,24 +901,22 @@ build_method = function(fn, cl)
905 local f = writer.Writer(mns, cl:full_name_get() .. "." .. fn:name_get()) 901 local f = writer.Writer(mns, cl:full_name_get() .. "." .. fn:name_get())
906 stats.check_method(fn, cl) 902 stats.check_method(fn, cl)
907 903
908 f:write_h(cl:full_name_get() .. "." .. fn:name_get(), 2) 904 f:write_h("Signature", 2)
909
910 f:write_h("Signature", 3)
911 f:write_code(gen_method_sig(fn, cl)) 905 f:write_code(gen_method_sig(fn, cl))
912 f:write_nl() 906 f:write_nl()
913 907
914 f:write_h("C signature", 3) 908 f:write_h("C signature", 2)
915 f:write_code(gen_func_csig(fn, mns), "c") 909 f:write_code(gen_func_csig(fn, mns), "c")
916 f:write_nl() 910 f:write_nl()
917 911
918 local pars = fn:parameters_get() 912 local pars = fn:parameters_get()
919 if #pars > 0 then 913 if #pars > 0 then
920 f:write_h("Parameters", 3) 914 f:write_h("Parameters", 2)
921 build_parlist(f, pars) 915 build_parlist(f, pars)
922 f:write_nl() 916 f:write_nl()
923 end 917 end
924 918
925 f:write_h("Description", 3) 919 f:write_h("Description", 2)
926 f:write_raw(fn:doc_get(fn.METHOD):full_get(nil, true)) 920 f:write_raw(fn:doc_get(fn.METHOD):full_get(nil, true))
927 f:write_nl() 921 f:write_nl()
928 922
@@ -944,13 +938,11 @@ build_property = function(fn, cl)
944 local gdoc = fn:doc_get(fn.PROP_GET) 938 local gdoc = fn:doc_get(fn.PROP_GET)
945 local sdoc = fn:doc_get(fn.PROP_SET) 939 local sdoc = fn:doc_get(fn.PROP_SET)
946 940
947 f:write_h(cl:full_name_get() .. "." .. fn:name_get(), 2) 941 f:write_h("Signature", 2)
948
949 f:write_h("Signature", 3)
950 f:write_code(gen_prop_sig(fn, cl)) 942 f:write_code(gen_prop_sig(fn, cl))
951 f:write_nl() 943 f:write_nl()
952 944
953 f:write_h("C signature", 3) 945 f:write_h("C signature", 2)
954 local codes = {} 946 local codes = {}
955 if isget then 947 if isget then
956 codes[#codes + 1] = gen_func_csig(fn, pns, fn.PROP_GET) 948 codes[#codes + 1] = gen_func_csig(fn, pns, fn.PROP_GET)
@@ -970,7 +962,7 @@ build_property = function(fn, cl)
970 build_vallist(f, pgvals, psvals, "Values") 962 build_vallist(f, pgvals, psvals, "Values")
971 963
972 if isget and isset then 964 if isget and isset then
973 f:write_h("Description", 3) 965 f:write_h("Description", 2)
974 if doc:exists() or (not gdoc:exists() and not sdoc:exists()) then 966 if doc:exists() or (not gdoc:exists() and not sdoc:exists()) then
975 f:write_raw(doc:full_get(nil, true)) 967 f:write_raw(doc:full_get(nil, true))
976 end 968 end
@@ -981,9 +973,9 @@ build_property = function(fn, cl)
981 973
982 if isget and gdoc:exists() then 974 if isget and gdoc:exists() then
983 if isset then 975 if isset then
984 f:write_h("Getter", 4) 976 f:write_h("Getter", 3)
985 else 977 else
986 f:write_h("Description", 3) 978 f:write_h("Description", 2)
987 end 979 end
988 f:write_raw(gdoc:full_get(nil, true)) 980 f:write_raw(gdoc:full_get(nil, true))
989 if isset and sdoc:exists() then 981 if isset and sdoc:exists() then
@@ -993,9 +985,9 @@ build_property = function(fn, cl)
993 985
994 if isset and sdoc:exists() then 986 if isset and sdoc:exists() then
995 if isget then 987 if isget then
996 f:write_h("Setter", 4) 988 f:write_h("Setter", 3)
997 else 989 else
998 f:write_h("Description", 3) 990 f:write_h("Description", 2)
999 end 991 end
1000 f:write_raw(sdoc:full_get(nil, true)) 992 f:write_raw(sdoc:full_get(nil, true))
1001 end 993 end
@@ -1008,9 +1000,7 @@ build_event = function(ev, cl)
1008 local evn = ev:nspaces_get(cl) 1000 local evn = ev:nspaces_get(cl)
1009 local f = writer.Writer(evn, cl:full_name_get() .. ": " .. ev:name_get()) 1001 local f = writer.Writer(evn, cl:full_name_get() .. ": " .. ev:name_get())
1010 1002
1011 f:write_h(cl:full_name_get() .. ": " .. ev:name_get(), 2) 1003 f:write_h("Signature", 2)
1012
1013 f:write_h("Signature", 3)
1014 local buf = { ev:name_get() } 1004 local buf = { ev:name_get() }
1015 1005
1016 if ev:scope_get() == ev.scope.PRIVATE then 1006 if ev:scope_get() == ev.scope.PRIVATE then
@@ -1039,13 +1029,13 @@ build_event = function(ev, cl)
1039 f:write_code(table.concat(buf)) 1029 f:write_code(table.concat(buf))
1040 f:write_nl() 1030 f:write_nl()
1041 1031
1042 f:write_h("C signature", 3) 1032 f:write_h("C signature", 2)
1043 local cn = ev:c_name_get() 1033 local cn = ev:c_name_get()
1044 keyref.add(cn, evn, "c") 1034 keyref.add(cn, evn, "c")
1045 f:write_code(dtree.type_cstr_get(etp, cn) .. ";", "c") 1035 f:write_code(dtree.type_cstr_get(etp, cn) .. ";", "c")
1046 f:write_nl() 1036 f:write_nl()
1047 1037
1048 f:write_h("Description", 3) 1038 f:write_h("Description", 2)
1049 f:write_raw(ev:doc_get():full_get(nil, true)) 1039 f:write_raw(ev:doc_get():full_get(nil, true))
1050 f:write_nl() 1040 f:write_nl()
1051 1041