         :csv  (components->csv   component-list)
         :edn  (data->edn         component-list)))
 
+(defn components-to-chapter-mapping-output-data
+    "Export component to chapter mapping into selected output format."
+    [output-format component-list]
+    (case output-format
+        :json (data->json        component-list)
+        :txt  (components-to-chapter->text  component-list)
+        :xml  (components-to-chapter->xml   component-list)
+        :csv  (components-to-chapter->csv   component-list)
+        :edn  (data->edn         component-list)))
+

    [components]
    (->> (for [component components]
            (str (:id component) "\t" (:name component)))
            (clojure.string/join "\n")))

(defn products->xml

                     (for [component components]
                          [(:id component) (:name component)]))))

(defn components-to-chapter->csv
    "Convert list of components into CSV file."
    [components]
    (data->csv (cons ["Component name" "Chapter name"]
                     (for [component components]
                          [(:component component) (:chapter component)]))))

(defn product-output-data
    "Export product list into selected output format."
    [output-format product-list]
