public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { HtmlGenerator generator = new HtmlGenerator(); var builder = new StringBuilder(); if (!isFragment) { generator.AppendHtmlHeader(builder); } builder.AppendLine("<p><h2>Instructions</h2>"); builder.AppendLine(INSTRUCTIONS); //List words builder.AppendLine("<p><h2>List of clues</h2>"); builder.AppendLine("<table>"); DisplayListOfClues(includeSolution, builder); builder.AppendLine("</table>"); //Show puzzle. builder.AppendLine("<p><h2>List of words</h2>"); builder.AppendLine("<table>"); DisplayListOfWords(includeSolution, builder); builder.AppendLine("</table>"); if (!isFragment) { generator.AppendHtmlFooter(builder); } return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { StringBuilder builder = new StringBuilder(); HtmlGenerator generator = new HtmlGenerator(); if (!isFragment) { generator.AppendHtmlHeader(builder); } builder.AppendLine(INSTRUCTIONS); builder.AppendLine( $"<br />1. Cut out each tent. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-a.jpg", 266, 183)}"); builder.AppendLine( $"<br />2. Cut out squares marked with scissors. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-b.jpg", 291, 213)}"); builder.AppendLine( $"<br />3. Fold each tent at the center line. <br/>{CreateImageTagForJpg(@"C:\Users\Chip\Documents\WordPuzzle3\WordPuzzlesTest\html\WordTents\images\instructions-c.jpg", 244, 101)}"); AppendTentTable(builder); if (includeSolution) { AppendSolution(builder); } if (!isFragment) { generator.AppendHtmlFooter(builder); } return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { PreparePuzzle(); StringBuilder builder = new StringBuilder(); if (!isFragment) { HtmlGenerator.AppendHtmlHeader(builder); } builder.AppendLine("<!--StartFragment-->"); builder.AppendLine("Fill in the blanks below based on the clues. "); AppendCluesTable(builder, includeSolution); builder.AppendLine("<p/>Then copy the letters to the grid below, using the numbers as a guide. "); AppendEncodedMessageTable(builder, includeSolution); builder.AppendLine("<!--EndFragment-->"); if (!isFragment) { HtmlGenerator.AppendHtmlFooter(builder); } return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { StringBuilder builder = new StringBuilder(); if (!isFragment) { _htmlGenerator.AppendHtmlHeader(builder); } builder.AppendLine(GetInstructions()); if (SubPuzzles == null) { AppendPuzzleTable(includeSolution, builder); } else { foreach (var subPuzzle in SubPuzzles) { subPuzzle.AppendPuzzleTable(includeSolution, builder); } } if (!isFragment) { _htmlGenerator.AppendHtmlFooter(builder); } return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { StringBuilder builder = new StringBuilder(); if (!isFragment) { _htmlGenerator.AppendHtmlHeader(builder); } builder.AppendLine("<!--StartFragment-->"); builder.AppendLine( @"Use the clues below to fill in the grid. Each horizontal word also appears vertically (in the same order)."); builder.AppendLine( @"Then read the solution to the puzzle from the highlighted squares."); builder.AppendLine(@"<table border=""1"">"); for (var rowIndex = 0; rowIndex < Clues.Length; rowIndex++) { var clue = Clues[rowIndex]; if (rowIndex == 0) { clue = " "; } builder.AppendLine("\t<tr>"); builder.AppendLine($@" <td width=""250"">{clue}</td>"); for (int i = 0; i < Size; i++) { string letterInWord = @" "; string style = @"class=""normal"""; if (rowIndex == 0) { style = @"class=""bold"""; if (i == 0) { letterInWord = Lines[rowIndex][i].ToString().ToUpperInvariant(); } } builder.AppendLine(@" <td width=""20"" "+ style + ">" + letterInWord + @"</td>"); } builder.AppendLine("\t</tr>"); } builder.AppendLine("</table>"); builder.AppendLine("<!--EndFragment-->"); if (!isFragment) { builder.AppendLine("</body>"); builder.AppendLine("</html>"); } //reset return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { StringBuilder builder = new StringBuilder(); if (!isFragment) { _htmlGenerator.AppendHtmlHeader(builder); } builder.AppendLine("<!--StartFragment-->"); builder.AppendLine(@"Fill in the words below (one letter per box) based on the clues. "); builder.AppendLine("Starting in the top left box, follow the direction (e.g. three spaces to the right) to find the next letter. "); builder.AppendLine(@"<table border=""1"">"); for (int row = 0; row < Size; row++) { builder.AppendLine("<tr>"); StringBuilder wordRow = new StringBuilder(); for (int column = 0; column < Size; column++) { wordRow.Append(GetCellAtCoordinates(row, column).Letter); } string clueForThisRow = $@"Clue for {wordRow}"; if (!string.IsNullOrWhiteSpace(_clues[row])) { clueForThisRow = _clues[row]; } builder.AppendLine(@" <td width=""250"">" + clueForThisRow + @"</td>"); for (int column = 0; column < Size; column++) { builder.AppendLine($@" <td width=""20""><sup>{GetCellAtCoordinates(row, column)}</sup><br/> </td>"); } builder.AppendLine("</tr>"); } builder.AppendLine("</table>"); builder.Append("<h2>"); builder.Append("Solution: "); for (var index = 0; index < _solution.Length; index++) { builder.Append("_ "); } builder.Append("</h2>"); builder.AppendLine(); builder.AppendLine("<!--EndFragment-->"); if (!isFragment) { _htmlGenerator.AppendHtmlFooter(builder); } return(builder.ToString()); }
public string FormatHtmlForGoogle(bool includeSolution = false, bool isFragment = false) { var builder = new StringBuilder(); _htmlGenerator = new HtmlGenerator(); if (!isFragment) { _htmlGenerator.AppendHtmlHeader(builder); } builder.AppendLine(INSTRUCTIONS); StringBuilder tableBuilder = new StringBuilder(); StringBuilder clueBuilder = new StringBuilder(); tableBuilder.AppendLine("<table>"); clueBuilder.AppendLine("<ol>"); for (var index = 0; index < _hiddenWords.Count; index++) { var currentWord = _hiddenWords[index]; tableBuilder.AppendLine("<tr>"); tableBuilder.AppendLine($@"<td class=""normal centered"" width=""30""> {index+1} </td>"); AppendHiddenWord(tableBuilder, currentWord, includeSolution); clueBuilder.AppendLine($"<li>{currentWord.SentenceHidingWord}"); } tableBuilder.AppendLine("</table>"); clueBuilder.AppendLine("</ol>"); builder.Append(clueBuilder); builder.AppendLine("<br />"); builder.Append(tableBuilder); if (!isFragment) { _htmlGenerator.AppendHtmlFooter(builder); } return(builder.ToString()); }