<commit_before>--
-- ion/share/ioncore_misc.lua
-- 
-- Copyright (c) <NAME> 2004-2008.
--
-- See the included file LICENSE for details.
--

local group_tmpl = { type="WGroupWS" }

local default_tmpl = { switchto=true }

local empty = { type="WGroupWS", managed={} }

local layouts={
    empty = empty,
    default = empty,
}

--DOC 
-- Define a new workspace layout with name \var{name}, and
-- attach/creation parameters given in \var{tab}. The layout
-- "empty" may not be defined.
function ioncore.deflayout(name, tab)
    assert(layout ~= "empty")
    
    if name=="default" and not tab then
        layouts[name] = empty
    else
        layouts[name] = table.join(tab, group_tmpl)
    end
end

--DOC
-- Get named layout (or all of the latter parameter is set,
-- but this is for internal use only).
function ioncore.getlayout(name, all)
    if all then
        return layouts
    else
        return layouts[name]
    end
end

ioncore.set{_get_layout=ioncore.getlayout}

--DOC
-- Create new workspace on screen \var{scr}. The table \var{tmpl}
-- may be used to override parts of the layout named with \code{layout}.
-- If no \var{layout} is given, "default" is used.
function ioncore.create_ws(scr, tmpl, layout)
    local lo=ioncore.getlayout(layout or "default")<commit_msg>Fix assert to check name rather than layout<commit_after>--
-- ion/share/ioncore_misc.lua
-- 
-- Copyright (c) <NAME> 2004-2008.
--
-- See the included file LICENSE for details.
--

local group_tmpl = { type="WGroupWS" }

local default_tmpl = { switchto=true }

local empty = { type="WGroupWS", managed={} }

local layouts={
    empty = empty,
    default = empty,
}

--DOC 
-- Define a new workspace layout with name \var{name}, and
-- attach/creation parameters given in \var{tab}. The layout
-- "empty" may not be defined.
function ioncore.deflayout(name, tab)
    assert(name ~= "empty")
    
    if name=="default" and not tab then
        layouts[name] = empty
    else
        layouts[name] = table.join(tab, group_tmpl)
    end
end

--DOC
-- Get named layout (or all of the latter parameter is set,
-- but this is for internal use only).
function ioncore.getlayout(name, all)
    if all then
        return layouts
    else
        return layouts[name]
    end
end

ioncore.set{_get_layout=ioncore.getlayout}

--DOC
-- Create new workspace on screen \var{scr}. The table \var{tmpl}
-- may be used to override parts of the layout named with \code{layout}.
-- If no \var{layout} is given, "default" is used.
function ioncore.create_ws(scr, tmpl, layout)
    local lo=ioncore.getlayout(layout or "default")
{'fraction_non_alphanumeric': 0.1202775636083269, 'fraction_numerical': 0.006168080185042405, 'mean_word_length': 3.029503105590062, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6056128', 'n_tokens_mistral': 854, 'n_tokens_neox': 825, 'n_words': 288}