Skip to content

Commit

Permalink
Update sconstruct
Browse files Browse the repository at this point in the history
  • Loading branch information
nvdaes committed Nov 17, 2019
1 parent 978d5bb commit 5cb9efa
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions sconstruct
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ def md2html(source, dest):
"[[!meta title=\"": "# ",
"\"]]": " #",
}
with open(source, 'r', encoding="utf_8") as f:
with open(source, 'r', encoding="utf-8") as f:
mdText = f.read()
for k, v in headerDic.items():
mdText = mdText.replace(k, v, 1)
htmlText = markdown.markdown(mdText)
with open(dest, 'w', encoding="utf_8") as f:
with open(dest, 'w', encoding="utf-8") as f:
f.write("<!DOCTYPE html>\n" +
"<html lang=\"%s\">\n" % lang +
"<head>\n" +
Expand Down Expand Up @@ -106,10 +106,10 @@ def createAddonBundleFromPath(path, dest):
return dest

def generateManifest(source, dest):
with open(source, 'r', encoding="utf_8") as f:
with open(source, 'r', encoding="utf-8") as f:
manifest_template = f.read()
manifest = manifest_template.format(**buildVars.addon_info)
with open(dest, 'w', encoding="utf_8") as f:
with open(dest, 'w', encoding="utf-8") as f:
f.write(manifest)

def generateTranslatedManifest(source, language, out):
Expand All @@ -123,10 +123,10 @@ def generateTranslatedManifest(source, language, out):
else:
raise TypeError("Error with %s key in buildVars" % var)

with open(source, 'r', encoding="utf_8") as f:
with open(source, 'r', encoding="utf-8") as f:
manifest_template = f.read()
result = manifest_template.format(**vars)
with open(out, 'w', encoding="utf_8") as f:
with open(out, 'w', encoding="utf-8") as f:
f.write(result)

def expandGlobs(files):
Expand Down Expand Up @@ -170,10 +170,10 @@ for dir in langDirs:
translatedManifest = env.NVDATranslatedManifest(dir.File("manifest.ini"), [moFile, os.path.join("manifest-translated.ini.tpl")])
env.Depends(translatedManifest, ["buildVars.py"])
env.Depends(addon, [translatedManifest, moFile])
#Convert markdown files to html
for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')):
htmlFile = env.markdown(mdFile)
env.Depends(htmlFile, [mdFile, moFile])
env.Depends(addon, htmlFile)
#Convert markdown files to html
for mdFile in env.Glob(os.path.join('addon', 'doc', '*', '*.md')):
htmlFile = env.markdown(mdFile)
env.Depends(htmlFile, mdFile)
env.Depends(addon, htmlFile)
env.Default(addon)
env.Clean (addon, ['.sconsign.dblite', 'addon/doc/en/'])

0 comments on commit 5cb9efa

Please sign in to comment.