%D \module
%D   [      file=s-fnt-26,
%D        version=2009.10.26,
%D          title=\CONTEXT\ Style File,
%D       subtitle=Goodies Tables,
%D         author=Hans Hagen,
%D           date=\currentdate,
%D      copyright=PRAGMA]
%C
%C This module is part of the \CONTEXT\ macro||package and is
%C therefore copyrighted by \PRAGMA. See mreadme.pdf for
%C details.

\startluacode

    function document.show_goodies_stylistics(name)
        local goodies = fonts.goodies.get(name)
        local stylistics = goodies and goodies.stylistics
        if stylistics then
            local col, row, type = context.NC, context.NR, context.type
            context.starttabulate { "|l|pl|" }
            col() context("feature") col() context("meaning") col() row()
            for feature, meaning in table.sortedpairs(stylistics) do
                col() type(feature) col() type(meaning) col() row()
            end
            context.stoptabulate()
        end
    end

    function document.show_goodies_featuresets(name)
        local goodies = fonts.goodies.get(name)
        local featuresets = goodies and goodies.featuresets
        if featuresets then
            local col, row, type = context.NC, context.NR, context.type
            context.starttabulate { "|l|pl|" }
            col() context("featureset") col() context("definitions") col() row()
            for featureset, definitions in table.sortedpairs(featuresets) do
            col() type(featureset) col()
            for k, v in table.sortedpairs(definitions) do
                type(string.format("%s=%s",k,tostring(v)))
                context.quad()
            end
            col() row()
            end
            context.stoptabulate()
        end
    end

    function document.show_goodies_colorschemes(name)
        local goodies = fonts.goodies.get(name)
        local colorschemes = goodies and goodies.colorschemes
        if colorschemes then
            local col, row, type = context.NC, context.NR, context.type
            context.starttabulate { "|l|pl|" }
            col() context("colorscheme") col() context("numbers") col() row()
            for colorscheme, numbers in table.sortedpairs(colorschemes) do
                col() type(colorscheme) col()
                for i=1,#numbers do
                    type(i)
                    context.quad()
                end
                col() row()
            end
            context.stoptabulate()
        end

\stopluacode

\def\showgoodiesstylistics  #1{\ctxlua{document.show_goodies_stylistics  ("#1")}}
\def\showgoodiesfeaturesets #1{\ctxlua{document.show_goodies_featuresets ("#1")}}
\def\showgoodiescolorschemes#1{\ctxlua{document.show_goodies_colorschemes("#1")}}

\endinput
