Пример #1
0
	def concatFiles(self, baseName, headings):
		data = self.getTemplateFile(self.templateNames[0])
		data += self.getTemplateFile(self.templateNames[1])
		data += headings;
		data += elfFiles.getFileContent(baseName + '.html')
		data += self.getTemplateFile(self.templateNames[2])
		data += self.getTemplateFile(self.templateNames[3])
		return data;
Пример #2
0
	def createTempMarkdown(self, sourceFolder, fileName, headings):
		sourceFolder = elfFiles.ensureFinalSlash(sourceFolder)
		origName = '{0}{1}.md'.format(sourceFolder, fileName);
		tempName = 'temp'
		tempPath = '{0}{1}.md'.format(sourceFolder, tempName);
		# data = '## toc\n'
		data = elfFiles.getFileContent(origName)
		# print(tempPath)
		elfFiles.saveTextFile(tempPath, data)
		return tempName
Пример #3
0
def prog280(markdown, index):
	# Read in JSON as a String. Convert the string to a Python List.
	# The first item in our list is a Python dictionary.	
	content = elfFiles.getFileContent("MarkdownTransformConfig.json");	
	configList = json.loads(content);	
	configDictionary = configList[index];	
	
	# The dictionary contains copyTo and copyFrom
	markdown.copyFrom = configDictionary['copyFrom'];
	markdown.destination = configDictionary['copyTo'];
	files = configDictionary['filesToCopy'];
	makeItSo(markdown, "", files);
Пример #4
0
def prog280(markdown, index, markdownTransformConfig):
	# Read in JSON as a String. Convert the string to a Python List.
	# The first item in our list is a Python dictionary.	
	content = elfFiles.getFileContent(markdownTransformConfig);	
	configList = json.loads(content);	
	configDictionary = configList[index];	
	
	# The dictionary contains copyTo and copyFrom
	markdown.copyFrom = configDictionary['copyFrom'];
	markdown.destination = configDictionary['copyTo'];
	files = configDictionary['filesToCopy'];
	htmlPieces = configDictionary['htmlPieces'];
	makeItSo(markdown, "", files, htmlPieces);
Пример #5
0
 def createFullHtml(self, sourceFolder, fileName, targetFolder):
     self.runPandoc(sourceFolder, fileName)
     headings = self.makeHeadings(sourceFolder, fileName + ".htm")
     data = self.getTemplateFile("StartBasic.html")
     data += self.getTemplateFile("NavBasic.html")
     baseName = sourceFolder + os.sep + fileName
     tempName = sourceFolder + os.sep + "Temp.html"
     data += elffiles.getFileContent(baseName + ".htm")
     data += self.getTemplateFile("footer.html")
     data += self.getTemplateFile("end.html")
     finalName = baseName + ".html"
     elffiles.saveTextFile(tempName, data)
     ReplaceStringInFile.replaceIt(tempName, finalName, "TempTitleStringToReplace", fileName)
     crlf.convert(finalName)
Пример #6
0
	def getTemplateFile(self, fileName):
		#templateDir = os.environ['GIT_WRITING'] + 'Tech{0}Scripts{0}Templates'.format(os.sep)
		return elfFiles.getFileContent(self.templateDir + os.sep + fileName)