aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
AgeCommit message (Collapse)AuthorFilesLines
2010-01-02Changed default of writerXeTeX to False.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1790 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Removed redundant imports (found by ghc 6.12).fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1750 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Use System.IO.UTF8 only if ghc < 6.12.fiddlosopher1-1/+6
GHC >= 6.12 (base >= 4.2) uses iconv to convert to unicode Strings. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1748 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Removed unneeded LANGUAGE pragmas.fiddlosopher1-1/+1
(CPP is enabled globally in the cabal file.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@1747 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Added --xetex option to pandoc and markdown2pdf.fiddlosopher1-0/+2
If --xetex is specified, pandoc produces latex suitable for processing by xelatex, and markdown2pdf uses xelatex to create the PDF. Resolves Issue #185. This seems better than using latex packages to detect xetex, since not all latex installations will have these. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1737 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Restored writerIncludeBefore, writerIncludeAfter.fiddlosopher1-0/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1700 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Changed Meta author and date types to Inline lists instead of Strings.fiddlosopher1-2/+2
Meta [Inline] [[Inline]] [Inline] rather than Meta [Inline] [String] String. This is a breaking change for libraries that use pandoc and manipulate the metadata. Changed .native files in test suite for new Meta format. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1699 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Changed readDataFile to look first in user data directory.fiddlosopher1-3/+6
This way all of the pandoc data files can be overridden by user files. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1693 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Removed TH module; refactored LaTeXMathML not to use TH.fiddlosopher1-1/+7
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1692 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Removed unneeded writer options; use template variables instead.fiddlosopher1-8/+0
Removed writerIncludeAfter, writerIncludeBefore, writerTitlePrefix, writerHeader. Removed corresponding fields of Options structure in pandoc.hs. The options now set template variables (writerVariables) instead. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1684 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-31Added writerTemplate and writerVariables to writerOptions.fiddlosopher1-0/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1678 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-08Added optional section numbering in HTML output.fiddlosopher1-7/+11
This involves a change to the Element data structure, including a section number as well as an id and title for each section. Section numbers are lists of integers; this should allow different numbering schemes to be used in the future. Currently [1,2,3] -> 1.2.3. Resolves Issue #150. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1658 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-07Improved syntax for markdown definition lists.fiddlosopher1-4/+6
Definition lists are now more compatible with PHP Markdown Extra. Resolves Issue #24. + You can have multiple definitions for a term (but still not multiple terms). + Multi-block definitions no longer need a column before each block (indeed, this will now cause multiple definitions). + The marker no longer needs to be flush with the left margin, but can be indented at or two spaces. Also, ~ as well as : can be used as the marker (this suggestion due to David Wheeler.) + There can now be a blank line between the term and the definitions. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1656 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-05Added --id-prefix option.fiddlosopher1-0/+2
This adds a prefix to all automatically generated HTML identifiers, which helps prevent duplicate identifiers when you're generating a fragment (say a blog post). Added writerIdentifierPrefix to WriterOptions. Resolves Issue #41. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1650 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-05Changed --default-code-classes -> --indented-code-classes.fiddlosopher1-2/+2
Also changed stateDefaultCodeClasses -> stateIndentedCodeClasses. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1643 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-01Allow . and ~ in header identifiers.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1638 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-12-01Added --default-code-classes option.fiddlosopher1-2/+4
This specifies classes to use for indented code blocks. Thanks to buttock for the (slightly modified) patch. Resolves Issue #87. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1637 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-11-29Allow _ character in automatically generated identifiers.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1635 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-11-28Markdown reader: parse refs and notes in the same pass.fiddlosopher1-1/+1
Previously the markdown reader made one pass for references, a second pass for notes (which it parsed and stored in the parser state), and a third pass for the rest. This patch achieves a 10% speed improvement by storing the raw notes on the first (reference) pass, then parsing them when the notes are inserted into the AST. This eliminates the need for a second pass to parse notes. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1629 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-11-01Changed heuristic in compactify.fiddlosopher1-19/+15
compactify has to decide whether a Para that ends a list is a Para intentionally, or just because of the blank lines at the end of every list. In the latter case the Para is turned to a Plain. The old heuristic was: change final Para to Plain iff the other items all end in Plain. This produces bad results when, for example, an item contains just a Plain and an HTML comment, as it - a <!-- - b --> -c The new heuristic: change final Para to Plain iff the other items don't contain a Para. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1616 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-06-28RST reader: Allow # to continue list...fiddlosopher1-2/+3
...even if the list was started with an explicit marker. For example: A. my list #. continued Resolves Issue #140. Test case also added. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1584 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-04-25HTML writer: wrap sections in divs. Resolves Issue #70.fiddlosopher1-16/+71
+ hierarchicalize has been rationalized; it builds a hierarchical representation of the document from the headers, and simultaneously gives each section a unique identifier based on the heading title. + Identifiers are now attached to the divs rather than to the headers themselves. + Table of content backlinks go to the beginning of the table, rather than to the section reference that was clicked. This seems better. + Code for constructing identifiers has been moved to Text.Pandoc.Shared from the HTML writer, since it is now consumed only by hierarchicalize. + In --strict mode, pandoc just prints bare headings, as before (unless --toc has been specified). + In s5 output, it does not wrap sections in divs, as that seems to confuse the s5 javascript. + Test suite updated accordingly. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1562 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-01-31Moved tabFilter to Shared.fiddlosopher1-0/+21
Removed optPreserveTabs; instead, tabstop of 0 means preserve tabs. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1532 788f1e2b-df1e-0410-8736-df70ead52e1b
2009-01-24Moved all haskell source to src subdirectory.fiddlosopher1-0/+953
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1528 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-29Moved everything from src into the top-level directory.fiddlosopher1-836/+0
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1104 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-23Reverted changes in r1086 (implicit section header references).fiddlosopher1-53/+3
This caused too much of a performance hit. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1093 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-22Improved efficiency of romanNumeral parser (in Text.Pandoc.Shared)fiddlosopher1-8/+11
for a big speed boost in (non-strict) markdown parsing. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1089 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-22Implemented implicit reference-style links to section headers in markdown.fiddlosopher1-3/+53
For example, if you have a header '# Supported architectures', you can link to it with '[Supported architectures]'. If there are multiple headers with this label, the link will point to the first of them. Implicit references are always overridden by explicitly specified references. Addresses Issue #20. + Moved isPunctuation, uniqueIdentifiers, and inlineListToIdentifier from Text.Pandoc.Writers.HTML to Text.Pandoc.Shared. + Added stHeaders to ParserState. This holds a list of header texts used in the document, and is used to construct implicit header references. + In Text.Pandoc.Readers.Markdown, added call to headerReference parser in initial parsing pass, constructing a list of section header labels. This is then passed to uniqueIdentifiers to produce identifiers, and a list of implicit references is constructed. This is added to the end of the explicitly specified references, so it will be overridden by explicitly specified references. All of this processing is skipped if --strict was specified. + Modified documentation in README. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1086 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-18Fixed some haddock documentation bugs in Shared.hs.fiddlosopher1-4/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1085 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-17Adjusted formatting of LaTeX and ConTeXt footnotes:fiddlosopher1-9/+19
- in ConTeXt, % is not needed at end of line before note, since space is gobbled. - beginning of footnote indented four spaces. - this required an additional parameter in wrappedTeX and wrapTeXIfNeeded, in Text.Pandoc.Shared. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1080 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-15Added wrappedTeX and wrapTeXIfNeeded functions to Text.Pandoc.Shared.fiddlosopher1-1/+32
These ensure that footnotes occur on lines by themselves (to make them easier to move around), and that they don't screw up text wrapping. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1070 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-03Reverted back to state as of r1062. The template haskell changesfiddlosopher1-0/+792
are more trouble than they're worth. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1064 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-11-03Use template haskell to avoid the need for templates:fiddlosopher1-792/+0
+ Added library Text.Pandoc.Include, with a template haskell function $(includeStrFrom fname) to include a file as a string constant at compile time. + This removes the need for the 'templates' directory or Makefile target. These have been removed. + The base source directory has been changed from src to . + A new 'data' directory has been added, containing the ASCIIMathML.js script, writer headers, and S5 files. + The src/wrappers directory has been moved to 'wrappers'. + The Text.Pandoc.ASCIIMathML library is no longer needed, since Text.Pandoc.Writers.HTML can use includeStrFrom to include the ASCIIMathML.js code directly. It has been removed. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1063 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-10-29Fixed bug in parsing files that begin with blank lines.fiddlosopher1-4/+2
+ In Text.Pandoc.Shared: rewrote lineClump to parse EITHER a string of blank lines OR a string of nonblanks. Removed code for parsing eof. + In Markdown and RST readers, use 'manyTill (... <|> lineClump) eof' instead of many, since lineClump no longer parses eof. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1057 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-10-13Save and restore position in parseFromString, so that it doesn'tfiddlosopher1-0/+2
mess up accurate error location reporting. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1049 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-09-27Added a writer option for wrapped text and a command-line optionfiddlosopher1-15/+25
'--no-wrap', which disables text wrapping. (Resolves Issue #26.) + Added support for '--no-wrap' to Main.hs. + Added wrapIfNeeded function to Text.Pandoc.Shared. + Use wrapIfNeeded instead of wrapped in the RST, Man, Docbook, and Markdown writers. + Note: Not yet implemented in HTML, LaTeX, or ConTeXt writers. No documentation yet. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1034 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-09-05Simplified parsing of reference keys and notes in markdown and RSTfiddlosopher1-24/+0
readers: + The Reference data structure from Text.Pandoc.Shared is no longer needed, since + referenceKey and noteBlock parses return strings (as many blank lines as are occuried by the key or note) and update state themselves. + getPosition and setPosition are now used to ensure that error messages will give the correct line number. + This yields cleaner (and slightly faster) code, with more accurate parsing error messages. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1012 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-31Cleanup up Text.Pandoc.Shared to eliminate warningsfiddlosopher1-39/+40
when compiling with -Wall. git-svn-id: https://pandoc.googlecode.com/svn/trunk@969 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-30Added 'wrapped' function to Text.Pandoc.Shared.fiddlosopher1-0/+7
This helps wrap text into paragraphs, using the prettyprinting library. git-svn-id: https://pandoc.googlecode.com/svn/trunk@965 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-29Rewrote charsInBalanced and charsInBalanced'.fiddlosopher1-9/+9
- Documented restriction: open and close must be distinct characters. - Rearranged options for greater efficiency. - Changed inner call to charsInBalanced inside charsInBalanced' to charsInBalanced'. git-svn-id: https://pandoc.googlecode.com/svn/trunk@951 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Minor reformatting.fiddlosopher1-2/+2
git-svn-id: https://pandoc.googlecode.com/svn/trunk@946 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28anyLine now requires that the line end with a newline (not eof).fiddlosopher1-1/+1
This is a harmless assumption, since we always add newlines to the end of a block before parsing with anyLine. Yields a 10% speed boost! git-svn-id: https://pandoc.googlecode.com/svn/trunk@944 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28+ Removed tabsToSpaces and tabsInLine from Text.Pandoc.Shared.fiddlosopher1-22/+0
(They were used only in Main.) + Wrote new tabsToSpacesInLine function in Main that changes tabs to spaces and removes DOS line-endings in one pass, for a slight speed improvement. git-svn-id: https://pandoc.googlecode.com/svn/trunk@942 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Removed unneeded 'try' from romanNumeral parser.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@930 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Use notFollowedBy instead of notFollowedBy' in charsInBalanced.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@929 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Removed unneeded 'try' in 'parseFromString'.fiddlosopher1-1/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@928 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Removed unneeded 'try' from stringAnyCase. (Now it behavesfiddlosopher1-2/+2
like 'string'.) git-svn-id: https://pandoc.googlecode.com/svn/trunk@927 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Changed definition of 'enclosed' in Text.Pandoc.Shared so thatfiddlosopher1-2/+2
'try' is not automatically applied to the 'end' parser. Added 'try' in calls to 'enclosed' where needed. Slight speed increase. git-svn-id: https://pandoc.googlecode.com/svn/trunk@926 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Minor code cleanup in Text.Pandoc.Shared.fiddlosopher1-4/+7
git-svn-id: https://pandoc.googlecode.com/svn/trunk@925 788f1e2b-df1e-0410-8736-df70ead52e1b
2007-08-28Removed unnecessary 'try' in 'anyLine' (Text.Pandoc.Shared).fiddlosopher1-2/+1
git-svn-id: https://pandoc.googlecode.com/svn/trunk@923 788f1e2b-df1e-0410-8736-df70ead52e1b