User:EMBee/Scrap

From Rosetta Code
Revision as of 11:39, 4 January 2012 by rosettacode>EMBee (potential algorithm for a text to html conversion)
  • add "suggest task" and "task by category" links to tasks page.
  • suggest task for binary math.
  • draft task for math with boolean lists like in early lisp as per http://paste.lisp.org/display/126287

Text to HTML

Convert plain text to HTML. The plain text has no formatting information. It may have centered headlines, numbered sections, paragraphs, lists, and URIs. It could even have tables.

potential algorithm:

  • split by line
  • find average line length to identify centered lines
  • find isolated lines to identify section headings
  • find URIs
  • identify section numbering
  • identify bullet and numbered lists
  • identify paragraphs
  • identify indented lines
  • if possible identify tables

to ensure valid html/xhtml create a nested structure:

  • create an xml node
  • add elements to node
  • add lines to element if multiline like paragraph