From 319f49796439e50640cadff1220681a217be98a3 Mon Sep 17 00:00:00 2001 From: Li Jin Date: Thu, 12 Feb 2026 10:45:06 +0800 Subject: Added the all-in-one doc. --- spec/outputs/compile_doc.lua | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) (limited to 'spec/outputs/compile_doc.lua') diff --git a/spec/outputs/compile_doc.lua b/spec/outputs/compile_doc.lua index 8d5c11a..f661bbd 100644 --- a/spec/outputs/compile_doc.lua +++ b/spec/outputs/compile_doc.lua @@ -1,4 +1,10 @@ -local outputFolder = ... +local outputFolder, docFolder +do + local _obj_0 = { + ... + } + outputFolder, docFolder = _obj_0[1], _obj_0[2] +end local getFiles getFiles = function(locale) if locale == "en" then @@ -57,6 +63,7 @@ do local locale = _list_0[_index_0] _accum_0[_len_0] = { "codes_from_doc_" .. tostring(locale) .. ".lua", + "yue-" .. tostring(locale) .. ".md", getFiles(locale) } _len_0 = _len_0 + 1 @@ -65,8 +72,9 @@ do end for _index_0 = 1, #docs do local _des_0 = docs[_index_0] - local compiledFile, docFiles = _des_0[1], _des_0[2] + local compiledFile, docFile, docFiles = _des_0[1], _des_0[2], _des_0[3] local codes = { } + local docTexts = { } for _index_1 = 1, #docFiles do local docFile = docFiles[_index_1] local input @@ -74,6 +82,7 @@ for _index_0 = 1, #docs do if _with_0 ~= nil then local to_lua = require("yue").to_lua local text = _with_0:read("*a") + docTexts[#docTexts + 1] = text for code in text:gmatch("```yuescript[\r\n]+(.-)```[^%w]") do local result, err = to_lua(code, { implicit_return_root = false, @@ -103,8 +112,15 @@ for _index_0 = 1, #docs do local _close_0 = input end local output - local _with_0 = io.open(tostring(outputFolder) .. "/" .. tostring(compiledFile), "w+") - _with_0:write(table.concat(codes)) - output = _with_0 + do + local _with_0 = io.open(tostring(outputFolder) .. "/" .. tostring(compiledFile), "w+") + _with_0:write(table.concat(codes)) + output = _with_0 + end local _close_0 = output + local output2 + local _with_0 = io.open(tostring(docFolder) .. "/" .. tostring(docFile), "w+") + _with_0:write(table.concat(docTexts, "\n")) + output2 = _with_0 + local _close_1 = output2 end -- cgit v1.2.3-55-g6feb