aboutsummaryrefslogtreecommitdiff
path: root/src/Text/Pandoc/Shared.hs
AgeCommit message (Collapse)AuthorFilesLines
2013-08-16Shared: Changed stringify so it ignores notes.John MacFarlane1-1/+5
Also documented this in README.
2013-08-16Revert "Shared: stringify now skips over footnotes."John MacFarlane1-1/+0
This reverts commit 19591df739a6c50a3d0a9af55ba90b883264b21d. This change didn't work; query has already written the contents of the note by the time it gets to Note.
2013-08-16Shared: stringify now skips over footnotes.John MacFarlane1-0/+1
That is usually the right thing to do for section labels, etc.
2013-08-15Shared: Better error message when default data file not found.John MacFarlane1-3/+7
Listing the full path can confuse people who are using `--self-contained`: they might have intended the file to be found locally. So now we just list the data file name.
2013-08-11Options: Changed `writerSourceDir` to `writerSourceURL` (now a Maybe).John MacFarlane1-10/+10
Previously we used to store the directory of the first input file, even if it was local, and used this as a base directory for finding images in ODT, EPUB, Docx, and PDF. This has been confusing to many users. It seems better to look for images relative to the current working directory, even if the first file argument is in another directory. writerSourceURL is set to 'Just url' when the first command-line argument is an absolute URL. (So, relative links will be resolved in relation to the first page.) Otherwise, 'Nothing'. The ODT, EPUB, Docx, and PDF writers have been modified accordingly. Note that this change may break some existing workflows. If you have been assuming that relative links will be interpreted relative to the directory of the first file argument, you'll need to make that the current directory before running pandoc. Closes #942.
2013-08-10Use walk, walkM in place of bottomUp, bottomUpM when possible.John MacFarlane1-1/+1
They are significantly faster.
2013-08-10Use query instead of queryWith.John MacFarlane1-2/+27
2013-07-30Fixed compilation with http-conduit flag False.John MacFarlane1-2/+2
2013-07-18Improved fetching of external resources.John MacFarlane1-7/+9
* In Shared, openURL and fetchItem now return an Either, for better error handling. (API change.) * Better error message when fetching a URL fails with `--self-contained`. * EPUB writer: If resource not found, skip it, as in Docx writer. * Closes #916.
2013-07-04cabal: Added http-conduit flag, which allows fetching https resources.John MacFarlane1-12/+28
It also brings in a large number of dependencies (http-conduit and its dependencies), which is why for now it is an optional flag. Closes #820.
2013-07-01Created Text.Pandoc.Writers.Shared, improved metaToJSON.John MacFarlane1-81/+1
* Text.Pandoc.Writers.Shared contains shared functions used only in writers. * metaToJSON now takes a WriterOptions parameter, and will return an empty object if standalone is not specified.
2013-07-01Shared: Export getField.John MacFarlane1-1/+14
2013-06-29Metadata changes: Variables now completely shadow metadata.John MacFarlane1-2/+9
Previously if you set a value both in metadata and with a variable, they'd be combined into a list. Now the variable replaces the value in document metadata. If many variables with the same name are set, a list is created. Shared: metaToJSON now has an argument for a variable list.
2013-06-27Shared: Added `defField`.John MacFarlane1-0/+14
`defField` is like `setField`, but does nothing if the field already has a value.
2013-06-25Fixed merge bugs in Shared.John MacFarlane1-10/+10
2013-06-25Removed 'Functor' constraint.John MacFarlane1-2/+2
2013-06-24Use new flexible metadata type.John MacFarlane1-3/+74
* Depend on pandoc 1.12. * Added yaml dependency. * `Text.Pandoc.XML`: Removed `stripTags`. (API change.) * `Text.Pandoc.Shared`: Added `metaToJSON`. This will be used in writers to create a JSON object for use in the templates from the pandoc metadata. * Revised readers and writers to use the new Meta type. * `Text.Pandoc.Options`: Added `Ext_yaml_title_block`. * Markdown reader: Added support for YAML metadata block. Note that it must come at the beginning of the document. * `Text.Pandoc.Parsing.ParserState`: Replace `stateTitle`, `stateAuthors`, `stateDate` with `stateMeta`. * RST reader: Improved metadata. Treat initial field list as metadata when standalone specified. Previously ALL fields "title", "author", "date" in field lists were treated as metadata, even if not at the beginning. Use `subtitle` metadata field for subtitle. * `Text.Pandoc.Templates`: Export `renderTemplate'` that takes a string instead of a compiled template.. * OPML template: Use 'for' loop for authors. * Org template: '#+TITLE:' is inserted before the title. Previously the writer did this.
2013-05-28Shared.openURL: Properly handle data: URIs.John MacFarlane1-2/+8
2013-05-04Less verbose output from --self-contained.John MacFarlane1-1/+2
Now one gets "Fetching [URL]..." for each URL fetched, but not the full header.
2013-05-01Shared.openURL: Print diagnostic output to stderr, not stdout.John MacFarlane1-3/+5
2013-04-28Shared.openURL: URL-escape pipe characters.John MacFarlane1-3/+2
Even though these are legal, Network.URI doesn't regard them as legal in URLs. So we escape them first. Closes #535.
2013-04-20Shared: Fixed readDefaultDataFile so it works on Windows.John MacFarlane1-2/+2
2013-04-20Revert "Improved previous patch so it really solves the Windows issue."John MacFarlane1-1/+2
This reverts commit e80116c813ecfc8cde094cddd36a3b083c108fd8.
2013-04-19Improved previous patch so it really solves the Windows issue.John MacFarlane1-2/+1
2013-04-19Shared: readDefaultDataFile: normalize the paths.John MacFarlane1-1/+7
This fixes bugs in `--self-contained` on pandoc compiled with `embed_data_files`. The bugs affect (a) paths containing `..`, (b) Windows, where `\` is path separator. Closes #833.
2013-03-26Shared: openURL now follows redirects.John MacFarlane1-8/+10
Closes #701.
2013-02-13hierarchicalize: Do not number section with class "unnumbered".John MacFarlane1-6/+8
Unnumbered sections get [] for their section number. So far only the HTML writer has been adjusted to be sensitive to this. If we keep this change, all the writers will need to be changed either (a) to directly check for the "unnumbered" class, if they do section numbering themselves, or (b) to check for a null section number, if they use hierarchicalize.
2013-02-12Shared: Changed type of Element.John MacFarlane1-4/+4
Sec now includes a field for Attr rather than just String (the identifier). Note, this is an API change.
2013-01-23Added Text.Pandoc.Data (non-exported) if embed_data_files selected.John MacFarlane1-7/+2
This module just exports the association list of embedded data files, which is used by Shared.
2013-01-11Refactoring:John MacFarlane1-12/+17
* Shared now exports fetchItem (instead of getItem) and openURL * fetchItem has different parameters than getItem and includes some logic formerly in the ODT and Docx writers * getItem still used in SelfContained
2013-01-11Move getItem from SelfContained to Share; export getItem.John MacFarlane1-2/+28
2013-01-09Added Attr field to Header.John MacFarlane1-10/+9
Previously header ids were autogenerated by the writers. Now they are generated (unless supplied explicitly) in the markdown parser, if the `header_identifiers` extension is selected. In addition, the textile reader now supports id attributes on headers.
2013-01-07Shared: export isTightList.John MacFarlane1-0/+7
2012-12-30Revert "Workaround for problem with file-embed."John MacFarlane1-3/+1
This reverts commit 84ed0f055f71f32fc2db1dbe962e83cd0bb0b5d8.
2012-12-29Workaround for problem with file-embed.John MacFarlane1-1/+3
file-embed uses forward slashes as path separators, even on Windows. So we just convert backslashes to forward before doing a lookup.
2012-12-29Made `embed_data_files` flag work.John MacFarlane1-3/+11
2012-12-29Data files changes.John MacFarlane1-14/+27
* Added `embed_data_files` flag. (not yet used) * Shared no longer exports `findDataFile`. * `readDataFile` now returns a strict bytestring. * Shared now exports `readDataFileUTF8` which returns a string like the old `readDataFile`. * Rewrote modules to use new data file functions and to avoid using functions from Paths_pandoc directly.
2012-09-29Renamed removedLeadingTrailingSpace to trim.John MacFarlane1-9/+9
Also removeLeadingSpace to triml, removeTrailingSpace to trimr.
2012-09-27Shared: Export compactify', formerly in Markdown reader.John MacFarlane1-0/+18
2012-09-26Shared: Count \r as space in removeLeading/TrailingSpace.John MacFarlane1-1/+1
2012-09-23Revert "More intelligent handling of text encodings."John MacFarlane1-3/+3
This reverts commit 7272735b3d413a644fd9ab01eeae8ae9cd5a925b.
2012-09-23More intelligent handling of text encodings.John MacFarlane1-3/+3
Previously, UTF-8 was enforced for both input and output. The new system: * For input, UTF-8 is tried first; if an error is raised, the locale encoding is tried. * For output, the locale encoding is always used.
2012-08-15Moved renderTags' from HTML reader & SelfContained to Shared.John MacFarlane1-0/+22
Improved removal of markdown="1" attribute in Markdow reader.
2012-08-09Removed `--strict`, added extensions to writer/reader names.John MacFarlane1-2/+3
* The `--strict` option has been removed. * Instead of using `--strict`, one can now use `strict` instead of `markdown` as an input or output format name. * The `--enable` and `--disable` optinos have been removed. * It is now possible to enable or disable specific extensions by appending them (with '+' or '-') to the writer or reader name. For example `pandoc -f markdown-footnotes+hard_line_breaks`. * The lhs extensions are now implemented this way, too; you can use either `+lhs` or `+literate_haskell`.
2012-08-09Added safeRead to Text.Pandoc.Shared.John MacFarlane1-1/+12
2012-07-26Moved WriterOptions and associated types Shared -> Options.John MacFarlane1-128/+0
2012-07-26Fixed whitespace errors.John MacFarlane1-9/+9
2012-07-24Slightly more efficient normalizeSpaces.John MacFarlane1-6/+5
2012-07-24Added fields to WriterOptions.John MacFarlane1-0/+8
writerEpubStylesheet, writerEpubFonts, writerReferenceODT, writerReferenceDocx. These can now be removed as extra parameters to the writers.
2012-07-19Provide Data.Default instances for ParserState and WriterOptions.John MacFarlane1-1/+5
Now you can use def (which is re-exported by Text.Pandoc) instead of defaultParserState or defaultWriterOptions. For now, these are still defined too, so existing code need not change. Closes #546.