Class HTMLformatter

java.lang.Object
com.articulate.sigma.HTMLformatter

public class HTMLformatter extends Object
A utility class that creates HTML-formatting Strings for various purposes.
  • Field Details

    • htmlDivider

      public static String htmlDivider
    • kbHref

      public static String kbHref
    • language

      public static String language
    • proofParaphraseInEnglish

      public static boolean proofParaphraseInEnglish
    • availableFormalLanguages

      public static List<String> availableFormalLanguages
    • debug

      public static boolean debug
  • Constructor Details

    • HTMLformatter

      public HTMLformatter()
  • Method Details

    • htmlDivider

      public static String htmlDivider(String label)
      Create the HTML for the labeled divider between the sections of the term display. Each section displays a sorted list of the Formulae for which a term appears in a specified argument position.
    • createKBHref

      public static String createKBHref(String kbName, String language)
      Create the HTML for a kb link.
    • createHrefStart

      public static String createHrefStart()
      Create the HTML for a link, taking care of http/https, hostname and port
    • proofTextFormat

      public static String proofTextFormat(String query, ProofStep step, String kbName, String language)
      Create the text for a single step in a proof.
    • proofTableFormat

      public static String proofTableFormat(String query, tptp_parser.TPTPFormula step, String kbName, String language)
      Create the HTML for a single step in a proof.
    • processFormalLanguage

      public static String processFormalLanguage(String flang)
    • processNaturalLanguage

      public static String processNaturalLanguage(String lang, KB kb)
    • termList

      public static String termList(List<String> terms, String kbHref)
      Show a hyperlinked list of terms.
    • getDate

      public static String getDate()
    • showStatistics

      public static String showStatistics(KB kb)
      Show knowledge base statistics with caching. If the statistics HTML cache exists and is newer than the KB manager serialization file (~/.sigmakee/KBs/kbmanager.ser), it reuses the cache. Otherwise, it recomputes and overwrites the cache.
    • showLanguageStats

      public static String showLanguageStats(KB kb, String lang)
      Show knowledge base statistics
    • showMap

      public static String showMap(KB kb, String term)
      Show a map if coordinates are given in the kb
    • showPictures

      public static String showPictures(KB kb, String term)
      Show knowledge base pictures
    • showNumberPictures

      public static String showNumberPictures(KB kb, String term, int count)
      Show knowledge base pictures
    • showNeighborTerms

      public static String showNeighborTerms(KB kb, String term)
    • showNeighborTerms

      public static String showNeighborTerms(KB kb, String nonRelTerm, String relTerm)
      Show alphabetic list of neighbor terms
    • getAllRelTerms

      public static List<String> getAllRelTerms(KB kb, List<String> matchesList)
    • getAllNonRelTerms

      public static List<String> getAllNonRelTerms(KB kb, List<String> matchesList)
    • showREMatches

      public static String showREMatches(KB kb, String relREmatch, String nonRelREmatch, String term)
      Show list of 30 relation invalid input: '&' nonRelation terms that contain a match to the input RE term. The inputed Strings relREmatch and nonRelREmatch are the two relation and nonRelation terms respectively that are the first terms at the top of the list. They are passed into the method to keep track of what 30 terms are being viewed.
    • termMappingsList

      public static String termMappingsList(String terms, String kbHref)
      Show a hyperlinked list of term mappings from WordNet.
    • synsetList

      public static String synsetList(List<String> synsets, String kbHref)
      Show a hyperlinked list of WordNet synsets.
    • formatFormulaList

      public static String formatFormulaList(List<Formula> forms, String header, KB kb, String language, String flang, int start, int localLimit, String limitString)
      Create the HTML for a section of the Sigma term browser page. Needs a ...
      enclosure to format HTML properly.
    • launchEditor

      public static void launchEditor(String file, int line)
      Launch the jEdit editor with the cursor at the specified line number. Edit the file in the specified editDir, which should be different from Sigma's KBs directory. Recommended practice is to edit .kif files in your local Git repository and then copy them to the .sigmakee/KBs directory
    • browserSectionFormatLimit

      public static String browserSectionFormatLimit(String term, String header, KB kb, String language, String flang, int start, int limit, int arg, String type)
      Create the HTML for a section of the Sigma term browser page.
    • browserSectionFormat

      public static String browserSectionFormat(String term, String header, KB kb, String language, String flang, int arg, String type)
      Create the HTML for a section of the Sigma term browser page.
    • encodeForURL

      public static String encodeForURL(String s)
      Change spaces to "%20" along with many other URL codes. (for passing regex expressions through hyperlinks)
    • decodeFromURL

      public static String decodeFromURL(String s)
      Change spaces to "%20"
    • encodeForHTML

      public static String encodeForHTML(String s)
      change reserved characters from 'invalid input: '&'' tags
    • decodeFromHTML

      public static String decodeFromHTML(String s)
      change reserved characters to 'invalid input: '&'' tags
    • createNumberedMenu

      public static String createNumberedMenu(String menuName, String selectedOption, ArrayList<String> options)
      Create an HTML menu, given an ArrayList of Strings where the value(s) are String representations of int(s) but the displayed menu items are String(s).
    • createMenu

      public static String createMenu(String menuName, String selectedOption, List<String> options)
      Create an HTML menu, given an ArrayList of Strings.
    • createKBMenu

      public static String createKBMenu(String kbName)
      Create an HTML menu of KB names
    • formatErrorsWarnings

      public static String formatErrorsWarnings(Set<String> list, KB kb)
      hyperlink formulas in error messages. It assumes that the errors are in a TreeSet of Strings in kb.errors. It further assumes that the error message is given first, followed by a colon, and then the axiom. There must be no other colon characters.
    • createMultiMenu

      public static String createMultiMenu(String menuName, Map<String,String> options)
      Create an HTML menu with an ID, given an ArrayList of Strings, and possibly multiple selections.
    • createMenu

      public static String createMenu(String menuName, String selectedOption, List<String> options, String params)
      Create an HTML menu with an ID, given an ArrayList of Strings.
    • formatTPTP3ProofResult

      public static String formatTPTP3ProofResult(TPTP3ProofProcessor tpp, String stmt, String lineHtml, String kbName, String language)
      Create HTML formatted output for a TPTP3 proof
    • formatConsistencyCheck

      public static String formatConsistencyCheck(String msg, String ccheckResult, String language, int page)
    • showHelp

      public static void showHelp()
    • main

      public static void main(String[] args) throws IOException
      Throws:
      IOException