2 Ring programming language - Simple Website Generator
5 2016, Mahmoud Fayed <msfclipper@yahoo.com>
9 # Load the pages list from the pages.data file!
10 eval(read("pages.data"))
12 # Message after finishing an operation
13 C_DONE = "
\8f\88\97\9d\8a®
\97¹..." + nl
15 # The main function generate the HTML files using the aPages list
18 checkfile(C_HEADER) checkfile(C_FOOTER)
19 See "
\83w
\83b
\83_
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý : " + C_HEADER + nl
20 cHeader = read(C_HEADER) + nl
21 See "
\83t
\83b
\83^
\82Ì
\93Ç
\82Ý
\8d\9e\82Ý : " + C_FOOTER + nl
22 cFooter = read(C_FOOTER)
25 createPage(cHeader,x,cFooter,
26 substr(x,".template",".html"))
30 # the createPage function generate html file
31 # The function add the header and the footer to the content
32 Func createPage cHeader,cContent,cFooter,cOutput
33 See "
\8bL
\8e\96\83t
\83@
\83C
\83\8b : " + cContent + nl
34 See "
\83w
\83b
\83_
\82ð
\92Ç
\89Á..." + nl
36 See "
\93à
\97e
\82ð
\92Ç
\89Á..." + nl
37 # Using template() then template2() to support using template() in the template file
38 # As we have in the download16.template
39 cContent = template(cContent,NULL)
40 cStr += template2(cContent,NULL) + nl
41 See "
\83t
\83b
\83^
\82ð
\92Ç
\89Á..." + nl
43 See "
\83t
\83@
\83C
\83\8b\82ð
\8fo
\97Í : " + cOutput + nl
46 # The function check if the file exist or not before using it
47 Func checkfile cFileName
48 if not fexists(cFileName) raise("Error, File " + cFileName + " doesn't exist!") ok
50 # The function print the application information
53 ========================================================
54 Simple Website Generator - Version 1.0
55 2016, Mahmoud Fayed <msfclipper@yahoo.com>
56 2018, isVowel (Japanization)
57 ========================================================
60 # The function execute Ring code inside template files
61 # Then put the result/output from Ring code in the template content
62 Func Template cFile,oObject
63 ? "
\83e
\83\93\83v
\83\8c\81[
\83g
\82ð
\93W
\8aJ
\82µ
\82Ä
\82¢
\82Ü
\82·..."
65 return Template2(cStr,oObject)
67 Func Template2 cStr,oObject
71 nPos = substr(cStr,"<%")
74 cCode += "cResult += aList[" + len(aList) + "]" + nl
77 cText = left(cStr,nPos-1)
80 cCode += "cResult += aList[" + len(aList) + "]" + nl
82 cStr = substr(cStr,nPos+2)
83 nPos = substr(cStr,"%>")
86 cCode += "cResult += (" + substr(cStr,2,nPos-2) + ")" + nl
88 cCode += left(cStr,nPos-1) + nl
90 cStr = substr(cStr,nPos+2)
92 nPos = substr(cStr,"<%")
95 cCode += "cResult += aList[" + len(aList) + "]" + nl
98 if not isnull(oObject)