aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
AgeCommit message (Collapse)AuthorFilesLines
2010-07-05Removed writerInclude{Before,After} from WriterOptions.John MacFarlane1-4/+0
This is no longer used with the new templating system.
2010-07-05Moved Pandoc prettyprinting code from Shared to new Native writer.John MacFarlane1-52/+0
+ Text.Pandoc.Writers.Native + The function prettyPandoc is now gone. Use writeNative instead.
2010-07-05Moved parsing functions from Text.Pandoc.Shared to new module.John MacFarlane1-507/+3
+ Text.Pandoc.Parsing
2010-05-08Made KeyTable a map instead of an association list.John MacFarlane1-6/+16
* This affects the RST and Markdown readers. * The type for stateKeys in ParserState has also changed. * Pandoc, Meta, Inline, and Block have been given Ord instances. * Reference keys now have a type of their own (Key), with its own Ord instance for case-insensitive comparison.
2010-05-07Use explicit imports from Data.Generics.John MacFarlane1-1/+1
Otherwise we have a conflict with the 'empty' symbol, introduced in syb >= 0.2. Thanks to ddssff for pointing out the problem. Resolves Issue #237.
2010-05-06Use new UTF8 module in Shared, ODT, and the executables.John MacFarlane1-11/+5
2010-03-28Shared: Fixed uniqueIdent so it behaves as described in README.John MacFarlane1-33/+34
Previously some characters that are illegal in HTML identifiers, such as '<', were being allowed in header identifiers. The logic has now been fixed. Thanks to Xyne for reporting.
2010-03-27Implemented @ for sequentially numbered examples.John MacFarlane1-5/+28
Also implemented (@label) for example labels and references.
2010-03-23Shared: Export unescapeURI.John MacFarlane1-2/+9
2010-03-23Shared: Rewrote uri and emailAddress to return original text + escaped URI.John MacFarlane1-12/+17
2010-03-23Shared: enamed stringToURI -> escapeURI.John MacFarlane1-4/+4
2010-03-23Better definition of stringToURI.John MacFarlane1-14/+6
Now it escapes all characters that aren't allowed in a URI. %, ?, /, and other characters that are allowed in a URI are left alone. Unicode high characters are UTF-8 encoded.
2010-03-23Updated copyright notices.John MacFarlane1-2/+2
2010-03-23Fixed treatment of unicode characters in URIs.John MacFarlane1-1/+17
* Added stringToURI to Shared. This is used in the HTML writer for all URIs. It properly URI-encodes high characters (> 127), leaving everything else (including symbols and spaces) the same. * Modified unsanitaryURI to allow UTF8 characters in a URI. (First, we convert the URI to URI-encoded octets, then we pass through parseURIReference.) This resolves gitit Issue #99. Previously '[abc](http://gitit.net/测试)' would not be rendered as a link when --sanitize was selected.
2010-03-18Added --mathml option; removed Text.Pandoc.LaTeXMathML.fiddlosopher1-0/+1
* Added data/MathMLinHTML.js, which is included when no URL is provided for --mathml. This allows MathML to be displayed in better browsers, as text/html. * The module was no longer necessary; its functionality (two lines) was incorporated into pandoc.hs. * Consolidated the two LaTeXMathML.js files into one. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1909 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-03-16Shared: Export uniqueIdent, don't allow tilde in identifier.fiddlosopher1-1/+4
git-svn-id: https://pandoc.googlecode.com/svn/trunk@1894 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-18Made user directory a Maybe in readFile, s5HeaderIncludes, laTeXMathML.fiddlosopher1-4/+6
This is more uniform, and calling libraries can always disable searching of user directories for overrides. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1821 788f1e2b-df1e-0410-8736-df70ead52e1b
2010-01-14Added --data-dir option.fiddlosopher1-6/+6
+ This specifies a user data directory. If not specified, will default to ~/.pandoc on unix or Application Data\pandoc on Windows. Files placed in the user data directory will override system default data files. + Added datadir parameter to readDataFile, saveOpenDocumentAsODT, latexMathMLScript, s5HeaderIncludes, and getTemplate. Removed getDefaultTemplate. + Updated documentation. git-svn-id: https://pandoc.googlecode.com/svn/trunk@1809 788f1e2b-df1e-0410-8736-df70ead52e1b
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