Index: compile_rules.py ================================================================== --- compile_rules.py +++ compile_rules.py @@ -405,10 +405,23 @@ lTemp = [] lTemp.append(aRule[1:]) lFinal.append([sOption, lTemp]) return lFinal + +def createRulesAsString (lRules): + "create rules as a string of arrays (to be bundled in a JSON string)" + sArray = "[\n" + for sOption, aRuleGroup in lRules: + sOption = "False" if not sOption else f'"{sOption}"' + sArray += f' [{sOption}, [\n' + for aRule in aRuleGroup: + sArray += f' {aRule},\n' + sArray += " ]],\n" + sArray += "]" + return sArray + def prepareOptions (lOptionLines): "returns a dictionary with data about options" sLang = "" sDefaultUILang = "" @@ -647,12 +660,12 @@ "sFileHash": sFileHash, "callables": sPyCallables, "callablesJS": sJSCallables, "gctests": sGCTests, "gctestsJS": sGCTestsJS, - "paragraph_rules": mergeRulesByOption(lParagraphRules), - "sentence_rules": mergeRulesByOption(lSentenceRules), + "paragraph_rules": createRulesAsString(mergeRulesByOption(lParagraphRules)), + "sentence_rules": createRulesAsString(mergeRulesByOption(lSentenceRules)), "paragraph_rules_JS": jsconv.writeRulesToJSArray(mergeRulesByOption(lParagraphRulesJS)), "sentence_rules_JS": jsconv.writeRulesToJSArray(mergeRulesByOption(lSentenceRulesJS)) } dVars.update(dOptions)