[Tex/LaTex] new command for nested enumerate with variable arguments

#enumeratelistsmacrosnestingparameters

I have some text that I want to turn into a template which looks like this:

Extensions: 
\begin{enumerate}
    \item[2.a] xyz
        \begin{enumerate}[i.]
            \item a
            \item b
            \item c
        \end{enumerate}
    \item[5.b] abc
        \begin{enumerate}[i.]
            \item x
            \item y
        \end{enumerate}
\end{enumerate}\\

I want to make a new command that mimics the text above but that takes as arguments something like:

\ucextensions{[2.a] xyz, [5.b] abc}{{a, b, c}, {x, y}}

Please note that I will have variable numbers of arguments. I already have:

\newcommand{\ucextensions}[2]{
Extensions: 
\begin{enumerate}
    \forcsvlist{\item}{#1 \extensionsteps{#2}}
\end{enumerate}\\
}

\newcommand{\extensionsteps}[1]{
\begin{enumerate}[i.]
    \forcsvlist{\item}{#1}
\end{enumerate}
}

which gives output like:

  1. [2.a] xyz
  2. [5.b] abc
    • a, b, c
    • x, y

(except with i. and ii. instead of bullets). I would like instead to have output like:

  1. [2.a] xyz
    • a
    • b
    • c
  2. [5.b] abc
    • x
    • y

(again with i's instead of bullets). I am using the etoolbox package to do this. Is there a way to do something similar that would take either a nested csv, or a series of csv's to create the desired output?

Best Answer

I'd re-order the input a bit:

enter image description here

\documentclass{article}

\usepackage{enumerate}

\makeatletter
\def\ucextensions#1{%
\begin{enumerate}%
\@for\tmp:=#1\do{\expandafter\ucext\tmp}%
\end{enumerate}}

\newcommand\ucext[2]{%
\item\relax#1\begin{enumerate}[i]%
\@for\tmpb:=#2\do{\item\tmpb}%
\end{enumerate}}

\makeatletter

\begin{document}

\ucextensions{{[2.a] xyz}{a, b, c},
              {[5.b] abc}{x, y}
             }

\end{document}