summaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Readers/HTML.hs
Commit message (Collapse)AuthorAge
...
* Major code cleanup in all modules. (Removed unneeded imports,fiddlosopher2007-08-15
| | | | | | | | | | | | | | | | | | | | | | | | | | | reformatted, etc.) More major changes are documented below: + Removed Text.Pandoc.ParserCombinators and moved all its definitions to Text.Pandoc.Shared. + In Text.Pandoc.Shared: - Removed unneeded 'try' in blanklines. - Removed endsWith function and rewrote functions to use isSuffixOf instead. - Added >>~ combinator. - Rewrote stripTrailingNewlines, removeLeadingSpaces. + Moved Text.Pandoc.Entities -> Text.Pandoc.CharacterReferences. - Removed unneeded functions charToEntity, charToNumericalEntity. - Renamed functions using proper terminology (character references, not entities). decodeEntities -> decodeCharacterReferences, characterEntity -> characterReference. - Moved escapeStringToXML to Docbook writer, which is the only thing that uses it. - Removed old entity parser in HTML and Markdown readers; replaced with new charRef parser in Text.Pandoc.Shared. + Fixed accent bug in Text.Pandoc.Readers.LaTeX: \^{} now correctly parses as a '^' character. + Text.Pandoc.ASCIIMathML is no longer an exported module. git-svn-id: https://pandoc.googlecode.com/svn/trunk@835 788f1e2b-df1e-0410-8736-df70ead52e1b
* Major change in the way ordered lists are handled:fiddlosopher2007-08-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + The changes are documented in README, under Lists. + The OrderedList block element now stores information about list number style, list number delimiter, and starting number. + The readers parse this information, when possible. + The writers use this information to style ordered lists. + Test suites have been changed accordingly. Motivation: It's often useful to start lists with numbers other than 1, and to have control over the style of the list. Added to Text.Pandoc.Shared: + camelCaseToHyphenated + toRomanNumeral + anyOrderedListMarker + orderedListMarker + orderedListMarkers Added to Text.Pandoc.ParserCombinators: + charsInBalanced' + withHorizDisplacement + romanNumeral RST writer: + Force blank line before lists, so that sublists will be handled correctly. LaTeX reader: + Fixed bug in parsing of footnotes containing multiple paragraphs, introduced by use of charsInBalanced. Fix: use charsInBalanced' instead. LaTeX header: + use mathletters option in ucs package, so that basic unicode Greek letters will work properly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@834 788f1e2b-df1e-0410-8736-df70ead52e1b
* In HTML reader, filter Nulls in lists of blocks. (These canfiddlosopher2007-07-23
| | | | | | | be caused by raw HTML when the parse-raw option isn't selected.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@787 788f1e2b-df1e-0410-8736-df70ead52e1b
* Fixed bug in spanStrikeout: case was not exhaustive.fiddlosopher2007-07-23
| | | | git-svn-id: https://pandoc.googlecode.com/svn/trunk@786 788f1e2b-df1e-0410-8736-df70ead52e1b
* README: Removed the statement that the RST reader doesn't parsefiddlosopher2007-07-23
| | | | | | | | | | definition lists. HTML reader: Added failIfStrict to the definitionList parser, so definition lists will be passed through as raw HTML if --strict specified. git-svn-id: https://pandoc.googlecode.com/svn/trunk@783 788f1e2b-df1e-0410-8736-df70ead52e1b
* Added definition list support to HTML reader.fiddlosopher2007-07-23
| | | | | | | Added a test for definition lists to the html-reader test suite. git-svn-id: https://pandoc.googlecode.com/svn/trunk@781 788f1e2b-df1e-0410-8736-df70ead52e1b
* Added support for Strikeout, Superscript, and Subscript tofiddlosopher2007-07-21
| | | | | | | | HTML reader. Thanks to Bradley Sif for the patch for Strikeout (Issue #18). git-svn-id: https://pandoc.googlecode.com/svn/trunk@753 788f1e2b-df1e-0410-8736-df70ead52e1b
* HTML reader: haddock comment fix.fiddlosopher2007-07-12
| | | | git-svn-id: https://pandoc.googlecode.com/svn/trunk@690 788f1e2b-df1e-0410-8736-df70ead52e1b
* Moved Text.ParserCombinators.Pandoc ->fiddlosopher2007-07-09
| | | | | | | | Text.Pandoc.ParserCombinators. This way, all the Pandoc modules are in one place. git-svn-id: https://pandoc.googlecode.com/svn/trunk@663 788f1e2b-df1e-0410-8736-df70ead52e1b
* Adjusted copyright notices to 2006-7; usefiddlosopher2007-07-07
| | | | | | | | real email address instead of lamely attempting to obfuscate. git-svn-id: https://pandoc.googlecode.com/svn/trunk@640 788f1e2b-df1e-0410-8736-df70ead52e1b
* Extensive changes stemming from a rethinking of the Pandoc datafiddlosopher2007-04-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | structure. Key and Note blocks have been removed. Link and image URLs are now stored directly in Link and Image inlines, and note blocks are stored in Note inlines. This requires changes in both parsers and writers. Markdown and RST parsers need to extract data from key and note blocks and insert them into the relevant inline elements. Other parsers can be simplified, since there is no longer any need to construct separate key and note blocks. Markdown, RST, and HTML writers need to construct lists of notes; Markdown and RST writers need to construct lists of link references (when the --reference-links option is specified); and the RST writer needs to construct a list of image substitution references. All writers have been rewritten to use the State monad when state is required. This rewrite yields a small speed boost and considerably cleaner code. * Text/Pandoc/Definition.hs: + blocks: removed Key and Note + inlines: removed NoteRef, added Note + modified Target: there is no longer a 'Ref' target; all targets are explicit URL, title pairs * Text/Pandoc/Shared.hs: + Added 'Reference', 'isNoteBlock', 'isKeyBlock', 'isLineClump', used in some of the readers. + Removed 'generateReference', 'keyTable', 'replaceReferenceLinks', 'replaceRefLinksBlockList', along with some auxiliary functions used only by them. These are no longer needed, since reference links are resolved in the Markdown and RST readers. + Moved 'inTags', 'selfClosingTag', 'inTagsSimple', and 'inTagsIndented' to the Docbook writer, since that is now the only module that uses them. + Changed name of 'escapeSGMLString' to 'escapeStringForXML' + Added KeyTable and NoteTable types + Removed fields from ParserState; 'stateKeyBlocks', 'stateKeysUsed', 'stateNoteBlocks', 'stateNoteIdentifiers', 'stateInlineLinks'. Added 'stateKeys' and 'stateNotes'. + Added clause for Note to 'prettyBlock'. + Added 'writerNotes', 'writerReferenceLinks' fields to WriterOptions. * Text/Pandoc/Entities.hs: Renamed 'escapeSGMLChar' and 'escapeSGMLString' to 'escapeCharForXML' and 'escapeStringForXML' * Text/ParserCombinators/Pandoc.hs: Added lineClump parser: parses a raw line block up to and including following blank lines. * Main.hs: Replaced --inline-links with --reference-links. * README: + Documented --reference-links and removed description of --inline-links. + Added note that footnotes may occur anywhere in the document, but must be at the outer level, not embedded in block elements. * man/man1/pandoc.1, man/man1/html2markdown.1: Removed --inline-links option, added --reference-links option * Markdown and RST readers: + Rewrote to fit new Pandoc definition. Since there are no longer Note or Key blocks, all note and key blocks are parsed on a first pass through the document. Once tables of notes and keys have been constructed, the remaining parts of the document are reassembled and parsed. + Refactored link parsers. * LaTeX and HTML readers: Rewrote to fit new Pandoc definition. Since there are no longer Note or Key blocks, notes and references can be parsed in a single pass through the document. * RST, Markdown, and HTML writers: Rewrote using state monad new Pandoc and definition. State is used to hold lists of references footnotes to and be printed at the end of the document. * RTF and LaTeX writers: Rewrote using new Pandoc definition. (Because of the different treatment of footnotes, the "notes" parameter is no longer needed in the block and inline conversion functions.) * Docbook writer: + Moved the functions 'attributeList', 'inTags', 'selfClosingTag', 'inTagsSimple', 'inTagsIndented' from Text/Pandoc/Shared, since they are now used only by the Docbook writer. + Rewrote using new Pandoc definition. (Because of the different treatment of footnotes, the "notes" parameter is no longer needed in the block and inline conversion functions.) * Updated test suite * Throughout: old haskell98 module names replaced by hierarchical module names, e.g. List by Data.List. * debian/control: Include libghc6-xhtml-dev instead of libghc6-html-dev in "Build-Depends." * cabalize: + Remove haskell98 from BASE_DEPENDS (since now the new hierarchical module names are being used throughout) + Added mtl to BASE_DEPENDS (needed for state monad) + Removed html from GHC66_DEPENDS (not needed since xhtml is now used) git-svn-id: https://pandoc.googlecode.com/svn/trunk@580 788f1e2b-df1e-0410-8736-df70ead52e1b
* Made image parsing in HTML reader sensitive to thefiddlosopher2007-03-03
| | | | | | | --inline-links option. git-svn-id: https://pandoc.googlecode.com/svn/trunk@556 788f1e2b-df1e-0410-8736-df70ead52e1b
* Added --inline-links option to force links in HTML to be parsedfiddlosopher2007-03-03
| | | | | | | | as inline links, rather than reference links. (Addresses Issue #4.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@554 788f1e2b-df1e-0410-8736-df70ead52e1b
* + Simplified entity handling by removing stringToSGML from Entities.hs.fiddlosopher2007-01-28
| | | | | | | | | | | | | | | | | | | It is no longer needed now that all entities are processed in the markdown and HTML readers. All calls to stringToSGML have been replaced by calls to encodeEntities. + Since inTag's attribute handling already encodes entities, calls to encodeEntities are no longer needed for attribute values, so they've been removed. + The HTML and Markdown readers now call decodeEntities on all raw strings (e.g. authors, dates, link titles), to ensure that no unprocessed entities are included in the native representation of the document. (In the HTML reader, most of this work is done by a change in extractAttributeName.) + The result is a small speed improvement (around 5% on my benchmark) and cleaner code. git-svn-id: https://pandoc.googlecode.com/svn/trunk@519 788f1e2b-df1e-0410-8736-df70ead52e1b
* Changes in entity handling:fiddlosopher2007-01-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | + Entities are parsed (and unicode characters returned) in both Markdown and HTML readers. + Parsers characterEntity, namedEntity, decimalEntity, hexEntity added to Entities.hs; these parse a string and return a unicode character. + Changed 'entity' parser in HTML reader to use the 'characterEntity' parser from Entities.hs. + Added new 'entity' parser to Markdown reader, and added '&' as a special character. Adjusted test suite accordingly since now we get 'Str "AT",Str "&",Str "T"' instead of 'Str "AT&T".. + stringToSGML moved to Entities.hs. escapeSGML removed as redundant, given encodeEntities. + stringToSGML, encodeEntities, and specialCharToEntity are given a boolean parameter that causes only numerical entities to be used. This is used in the docbook writer. The HTML writer uses named entities where possible, but not all docbook-consumers know about the named entities without special instructions, so it seems safer to use numerical entities there. + decodeEntities is rewritten in a way that avoids Text.Regex, using the new parsers. + charToEntity and charToNumericalEntity added to Entities.hs. + Moved specialCharToEntity from Shared.hs to Entities.hs. + Removed unneeded 'decodeEntities' from 'str' parser in HTML and Markdown readers. + Removed sgmlHexEntity, sgmlDecimalEntity, sgmlNamedEntity, and sgmlCharacterEntity from Shared.hs. + Modified Docbook writer so that it doesn't rely on Text.Regex for detecting "mailto" links. git-svn-id: https://pandoc.googlecode.com/svn/trunk@515 788f1e2b-df1e-0410-8736-df70ead52e1b
* Fixed bug in 'extractTagType' in HTML reader: previousfiddlosopher2007-01-24
| | | | | | | version was not skipping / in close tags. git-svn-id: https://pandoc.googlecode.com/svn/trunk@512 788f1e2b-df1e-0410-8736-df70ead52e1b
* Fixed a bug in extractTagType in HTML Reader: the previousfiddlosopher2007-01-24
| | | | | | | version extracted the attributes, too, which is not wanted. git-svn-id: https://pandoc.googlecode.com/svn/trunk@510 788f1e2b-df1e-0410-8736-df70ead52e1b
* Fixed bug in HTML attribute parser: now a space isfiddlosopher2007-01-24
| | | | | | | | required before an attribute. Previously, <a.b> would be parsed as an HTML tag with an attribute! git-svn-id: https://pandoc.googlecode.com/svn/trunk@509 788f1e2b-df1e-0410-8736-df70ead52e1b
* Rewrote 'extractTagType' in HTML reader so that it doesn't usefiddlosopher2007-01-24
| | | | | | | regexs. git-svn-id: https://pandoc.googlecode.com/svn/trunk@507 788f1e2b-df1e-0410-8736-df70ead52e1b
* Modified HTML reader to skip a newline following a <br> tag.fiddlosopher2007-01-03
| | | | | | | | Otherwise the newline will be treated as a space at the beginning of the next line. git-svn-id: https://pandoc.googlecode.com/svn/trunk@410 788f1e2b-df1e-0410-8736-df70ead52e1b
* Change 'HtmlEntities' module to 'Entities'. Adjusted callingfiddlosopher2007-01-02
| | | | | | | code accordingly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@395 788f1e2b-df1e-0410-8736-df70ead52e1b
* Merged 'strict' branch from r324. This adds a '--strict'fiddlosopher2006-12-30
| | | | | | | | option to pandoc, which forces it to stay as close as possible to official Markdown syntax. git-svn-id: https://pandoc.googlecode.com/svn/trunk@347 788f1e2b-df1e-0410-8736-df70ead52e1b
* Added license text to top of source files.fiddlosopher2006-12-20
| | | | git-svn-id: https://pandoc.googlecode.com/svn/trunk@258 788f1e2b-df1e-0410-8736-df70ead52e1b
* Changed 'stability' from 'provisional' to 'alpha'.fiddlosopher2006-12-20
| | | | git-svn-id: https://pandoc.googlecode.com/svn/trunk@257 788f1e2b-df1e-0410-8736-df70ead52e1b
* Changed 'status' in comment headers from 'unstable' to 'provisional'fiddlosopher2006-12-20
| | | | | | | (which seems to be the term that is used in this context). git-svn-id: https://pandoc.googlecode.com/svn/trunk@255 788f1e2b-df1e-0410-8736-df70ead52e1b
* + Added module data for haddock.fiddlosopher2006-12-20
| | | | | | | + Reformatted code consistently. git-svn-id: https://pandoc.googlecode.com/svn/trunk@252 788f1e2b-df1e-0410-8736-df70ead52e1b
* Pandoc bug fixes:fiddlosopher2006-11-26
| | | | | | | | | | | | | | | | | | | | | | + LaTeX reader did not parse metadata correctly. Now the title, author, and date are parsed correctly, and everything else in the preamble is skipped. + Simplified parsing of LaTeX command arguments and options. The function commandArgs now returns a list of arguments OR options (in whatever order they appear). The brackets are included, and a new stripFirstAndLast function is provided to strip them off when needed. This fixes a problem in dealing with \newcommand, etc. + Added a "try" before "parser" in definition of notFollowedBy' combinator. Adjusted the code using this combinator accordingly. + Changed handling of code blocks. Previously, some readers allowed trailing newlines, while others stripped them. Now, all readers strip trailing newlines in code blocks; writers insert a newline at the end of code blocks as needed. + Changed test suite to reflect these changes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@137 788f1e2b-df1e-0410-8736-df70ead52e1b
* initial importfiddlosopher2006-10-17
git-svn-id: https://pandoc.googlecode.com/svn/trunk@2 788f1e2b-df1e-0410-8736-df70ead52e1b