Skip to content

Commit

Permalink
Support SHFB version 2021.8.14.0 or later.
Browse files Browse the repository at this point in the history
  • Loading branch information
Giovanni Lafratta committed Dec 11, 2023
1 parent d427d30 commit 8c4b833
Show file tree
Hide file tree
Showing 646 changed files with 29,094 additions and 51,117 deletions.
7 changes: 3 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Set default behavior to automatically normalize line endings.
###############################################################################
* text=auto

###############################################################################
# Set default behavior for command prompt diff.
#
Expand All @@ -11,7 +10,6 @@
# Note: This is only used by command line
###############################################################################
#*.cs diff=csharp

###############################################################################
# Set the merge driver for project and solution files
#
Expand All @@ -34,7 +32,6 @@
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary

###############################################################################
# behavior for image files
#
Expand All @@ -43,7 +40,6 @@
#*.jpg binary
#*.png binary
#*.gif binary

###############################################################################
# diff behavior for common document formats
#
Expand All @@ -61,3 +57,6 @@
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
.jpg filter=lfs diff=lfs merge=lfs -text
.svg filter=lfs diff=lfs merge=lfs -text
.json filter=lfs diff=lfs merge=lfs -text
34 changes: 12 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,37 +1,27 @@
# Novacta.Shfb.LatexTools

This repo contains the source code for **Novacta.Shfb.LatexTools**, a .NET library that
enables adding LaTeX content in documentation files created via the
[Sandcastle Help File Builder](https://github.com/EWSoftware/SHFB) project.

The tools support SHFB, version 2021.10.23.0 or later.
**Novacta.Shfb.LatexTools** is a .NET library that
provides types to manage
[LaTeX](https://www.latex-project.org/) equations in reference and conceptual content files generated by the
[Sandcastle Help File Builder](https://github.com/EWSoftware/SHFB).

## Features

* The
[LatexComponent](https://novacta.github.io/shfb-latex-tools/html/T_Novacta_Shfb_LatexTools_LatexComponent.htm)
enables the representation of LaTeX equations
as images in SHFB documentation files.
Supported image formats are
[PNG](https://en.wikipedia.org/wiki/Portable_Network_Graphics)
and
[SVG](https://en.wikipedia.org/wiki/Scalable_Vector_Graphics).
* The
[LatexPlugIn](https://novacta.github.io/shfb-latex-tools/html/T_Novacta_Shfb_LatexTools_LatexPlugIn.htm),
which is responsible to support the *SVG* image file format for the *MSHelpViewer* help output.
* The presentation styles
[VS2010WithLatex](https://novacta.github.io/shfb-latex-tools/html/T_Novacta_Shfb_LatexTools_PresentationStyles_VS2010WithLatex.htm)
and
[VS2013WithLatex](https://novacta.github.io/shfb-latex-tools/html/T_Novacta_Shfb_LatexTools_PresentationStyles_VS2013WithLatex.htm),
which add to styles *VS2010* and *VS2013*, respectively, the ability to manage LaTeX content.
Available versions of the **LatexTools** have different features, as described in the following table.

| Feature | v2.0.0 | v1.0.0 |
| ------- | ------ | ------ |
| Supported [SHFB](https://github.com/EWSoftware/SHFB) versions | 2022.8.14.0 or later | 2021.11.7.0 - 2022.2.6.0 |
| Target presentation styles | Default 2022, Markdown, OpenXml, VS2013 | Customized versions of VS2010 and VS2013 styles |
| Documentation comments able to include LaTeX contents | MAML/XML | MAML/XML |

## Installation

The library is available as a [NuGet package](https://www.nuget.org/packages/Novacta.Shfb.LatexTools).

## Documentation

[Adding LaTeX equations](https://novacta.github.io/shfb-latex-tools/html/47a5afe5-726c-4f74-9ab1-90740bf0a692.htm)
[Adding LaTeX equations](https://novacta.github.io/shfb-latex-tools/html/781b55db-9cd4-401d-9c24-a5e4b93fe476.htm)
includes topics showing how to define LaTeX content in help files.

Full documentation is located [here](http://novacta.github.io/shfb-latex-tools/).
Expand Down
32 changes: 32 additions & 0 deletions docs/GeneralError.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="icons/favicon.ico" />
<link rel="stylesheet" href="css/bulma.css" />
<link rel="stylesheet" href="css/font-awesome.min.css" />
<link rel="stylesheet" href="css/presentationStyle.css" />
<script src="scripts/jquery-3.5.1.min.js"></script>
<script src="scripts/presentationStyle.js"></script>
<title>Novacta.Shfb.LatexTools Documentation - General Error</title>
</head>

<body>
<section id="MainSection" class="section p-0">
<div class="pageHeader level mb-2 pt-2 pb-2 pl-5 pr-5">
<div id="TitleContainer" class="level-left">
<div id="DocumentationTitle" class="level-item">
Novacta.Shfb.LatexTools Documentation - General Error
</div>
</div>
</div>
</section>

<div id="TopicContent" class="column content is-7">
<h1>We're sorry, a general error has occurred.</h1>
<p>Please try to load the page again. If the error persists, please contact the site administrator.</p>
</div>
</body>

</html>
34 changes: 34 additions & 0 deletions docs/PageNotFound.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link rel="shortcut icon" href="icons/favicon.ico" />
<link rel="stylesheet" href="css/bulma.css" />
<link rel="stylesheet" href="css/font-awesome.min.css" />
<link rel="stylesheet" href="css/presentationStyle.css" />
<script src="scripts/jquery-3.5.1.min.js"></script>
<script src="scripts/presentationStyle.js"></script>
<title>Novacta.Shfb.LatexTools Documentation - Page Not Found</title>
</head>

<body>
<section id="MainSection" class="section p-0">
<div class="pageHeader level mb-2 pt-2 pb-2 pl-5 pr-5">
<div id="TitleContainer" class="level-left">
<div id="DocumentationTitle" class="level-item">
Novacta.Shfb.LatexTools Documentation - Page Not Found
</div>
</div>
</div>
</section>

<div id="TopicContent" class="column content is-7">
<h1>We're sorry, the page you requested cannot be found.</h1>
<p>The URL might be misspelled or the page you are looking for is no longer available. If you typed in the
URL, check that it does not contain a typo. You can return to the <a href="html/5329bde0-92e2-4707-ad56-64caa353b849.htm">main page</a> to
use the table of contents or the search option to try and locate the page.</p>
</div>
</body>

</html>
33 changes: 18 additions & 15 deletions docs/SearchHelp.aspx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
// System : Sandcastle Help File Builder
// File : SearchHelp.aspx
// Author : Eric Woodruff (Eric@EWoodruff.us)
// Updated : 05/15/2014
// Note : Copyright 2007-2015, Eric Woodruff, All rights reserved
// Updated : 08/13/2022
// Note : Copyright 2007-202, Eric Woodruff, All rights reserved
//
// This file contains the code used to search for keywords within the help topics using the full-text index
// files created by the help file builder.
Expand Down Expand Up @@ -119,7 +119,7 @@ private List<string> ParseKeywords(string keywords)
{
checkWord = word.ToLower(CultureInfo.InvariantCulture);
if(checkWord.Length > 2 && !Char.IsDigit(checkWord[0]) && !keywordList.Contains(checkWord))
if(checkWord.Length >= 2 && !Char.IsDigit(checkWord[0]) && !keywordList.Contains(checkWord))
keywordList.Add(checkWord);
}
Expand All @@ -140,7 +140,8 @@ private string Search(List<string> keywords, List<string> fileInfo,
StringBuilder sb = new StringBuilder(10240);
Dictionary<string, List<long>> matches = new Dictionary<string, List<long>>();
List<long> occurrences;
List<int> matchingFileIndices = new List<int>(), occurrenceIndices = new List<int>();
HashSet<int> matchingFileIndices = new HashSet<int>();
List<int> occurrenceIndices = new List<int>();
List<Ranking> rankings = new List<Ranking>();
string filename, title;
Expand All @@ -150,7 +151,13 @@ private string Search(List<string> keywords, List<string> fileInfo,
foreach(string word in keywords)
{
if(!wordDictionary.TryGetValue(word, out occurrences))
occurrences = new List<long>();
foreach(KeyValuePair<string, List<long>> kv in wordDictionary)
if(kv.Key.Contains(word))
occurrences.AddRange(kv.Value);
if(occurrences.Count == 0)
return "<strong>Nothing found</strong>";
matches.Add(word, occurrences);
Expand All @@ -163,18 +170,14 @@ private string Search(List<string> keywords, List<string> fileInfo,
if(isFirst)
{
isFirst = false;
matchingFileIndices.AddRange(occurrenceIndices);
matchingFileIndices.UnionWith(occurrenceIndices);
}
else
{
// After the first match, remove files that do not appear for
// all found keywords.
for(idx = 0; idx < matchingFileIndices.Count; idx++)
if(!occurrenceIndices.Contains(matchingFileIndices[idx]))
{
matchingFileIndices.RemoveAt(idx);
idx--;
}
// After the first match, remove files that do not appear for all found keywords
foreach(int i in matchingFileIndices.ToArray())
if(!occurrenceIndices.Contains(i))
matchingFileIndices.Remove(i);
}
}
Expand Down Expand Up @@ -217,7 +220,7 @@ private string Search(List<string> keywords, List<string> fileInfo,
});
// Format the file list and return the results
sb.Append("<ol>");
sb.Append("<ol>");
foreach(Ranking r in rankings)
sb.AppendFormat("<li><a href=\"{0}\" target=\"_blank\">{1}</a></li>", r.Filename, r.PageTitle);
Expand Down
2 changes: 1 addition & 1 deletion docs/SearchHelp.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function ParseKeywords($keywords)
{
$checkWord = strtolower($word);
$first = substr($checkWord, 0, 1);
if(strlen($checkWord) > 2 && !ctype_digit($first) && !in_array($checkWord, $keywordList))
if(strlen($checkWord) >= 2 && !ctype_digit($first) && !in_array($checkWord, $keywordList))
{
array_push($keywordList, $checkWord);
}
Expand Down
7 changes: 4 additions & 3 deletions docs/Web.Config
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0"?>
<configuration xmlns="http://schemas.microsoft.com/.NetConfiguration/v2.0">
<system.web>
<customErrors mode="On" defaultRedirect="~/html/GeneralError.htm">
<error statusCode="404" redirect="~/html/PageNotFound.htm" />
<customErrors mode="On" defaultRedirect="~/GeneralError.html">
<error statusCode="404" redirect="~/PageNotFound.html" />
</customErrors>
<compilation debug="false">
<assemblies>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
</assemblies>
</compilation>
<pages>
Expand All @@ -15,6 +15,7 @@
<add namespace="System.Collections.Generic"/>
<add namespace="System.Globalization"/>
<add namespace="System.IO"/>
<add namespace="System.Linq"/>
<add namespace="System.Text"/>
<add namespace="System.Text.RegularExpressions"/>
<add namespace="System.Web"/>
Expand Down
Loading

0 comments on commit 8c4b833

Please sign in to comment.