public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: Andrea Rossato <andrea.rossato-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
To: pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
Subject: Re: Re: textual citation
Date: Wed, 17 Nov 2010 22:49:01 +0100	[thread overview]
Message-ID: <20101117214900.GB8887@eeepc.istitutocolli.org> (raw)
In-Reply-To: <20101117043955.GA18136-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>

[-- Attachment #1: Type: text/plain, Size: 2049 bytes --]

On Tue, Nov 16, 2010 at 08:39:56PM -0800, John MacFarlane wrote:
> +++ Andrea Rossato [Nov 14 10 14:26 ]:
> pandoc-types:  citationPrefix is now [Inline] rather than String.
> citationSuffix has been added (also [Inline]).
> 
> pandoc:  updated for changes in the Citation type in pandoc-types.

I'm attaching a patch that removes stringify and directly passes
[Inline] to citeproc-hs.

There's also a small but important fix for the parser, just to
remember you to be careful not to pass to citeproc empty content in a
non empty list of [Inline]. citeproc will always assume that a
non-empty list of inlines will produce some output (this is relevant,
for instance, to suppress delimiters when suppressing the author's
name).
 
> The pandoc changes don't presuppose any changes in citeproc-hs -- pandoc still
> passes raw strings to citeproc. citeproc should be changed to take [Inline]
> for CSL.citePrefix and CSL.citeSuffix. I'm guessing this will allow a lot
> of code simplification, since citeproc currently uses a custom pandoc-like
> structure (OStr, OSpace, etc.).

Unfortunately this is not the case: the Output data structure is
needed to encode enough information during the evaluation of the style
so to be able to process the output to remove ambiguous cites, to add
year suffixes, and to collapse citations (actually the most difficult
part of the processor code).

> With these changes, I can start working on the parser, and Andrea
> can work on converting citeproc to use [Inline].

I've already pushed the needed changes to citeproc-hs: the [inline]
will be passed back to pandoc as citation affixes.

Andrea

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
For more options, visit this group at http://groups.google.com/group/pandoc-discuss?hl=en.


[-- Attachment #2: 0021-update-tp-latest-changes.patch --]
[-- Type: text/plain, Size: 2426 bytes --]

From 0e077fa54824a90bcfccde4eeb912350c9bbca10 Mon Sep 17 00:00:00 2001
From: Andrea Rossato <andrea.rossato-/Q1r7N5in3P/wltNWqQaag@public.gmane.org>
Date: Wed, 17 Nov 2010 22:37:07 +0100
Subject: [PATCH 21/21] update tp latest changes

---
 src/Text/Pandoc/Biblio.hs           |   14 ++------------
 src/Text/Pandoc/Readers/Markdown.hs |    2 +-
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/src/Text/Pandoc/Biblio.hs b/src/Text/Pandoc/Biblio.hs
index 60e0591..dde822d 100644
--- a/src/Text/Pandoc/Biblio.hs
+++ b/src/Text/Pandoc/Biblio.hs
@@ -150,16 +150,6 @@ setCiteNoteNum               _  _ = []
 setCitationNoteNum :: Int -> [Citation] -> [Citation]
 setCitationNoteNum i = map $ \c -> c { citationNoteNum = i}
 
--- a temporary function to tide us over until citeproc is
--- changed to use Inline lists for prefixes and suffixes...
-stringify :: [Inline] -> String
-stringify = queryWith go
-  where go :: Inline -> [Char]
-        go Space = " "
-        go (Str x) = x
-        go (Code x) = x
-        go _ = ""
-
 toCslCite :: Citation -> CSL.Cite
 toCslCite c
     = let (la,lo) = parseLocator $ citationLocator c
@@ -168,8 +158,8 @@ toCslCite c
                       SuppressAuthor -> (False,True )
                       NormalCitation -> (False,False)
       in   emptyCite { CSL.citeId         = citationId c
-                     , CSL.citePrefix     = stringify $ citationPrefix c
-                     , CSL.citeSuffix     = stringify $ citationSuffix c
+                     , CSL.citePrefix     = PandocText $ citationPrefix c
+                     , CSL.citeSuffix     = PandocText $ citationSuffix c
                      , CSL.citeLabel      = la
                      , CSL.citeLocator    = lo
                      , CSL.citeNoteNumber = show $ citationNoteNum c
diff --git a/src/Text/Pandoc/Readers/Markdown.hs b/src/Text/Pandoc/Readers/Markdown.hs
index 8101d30..4975ee0 100644
--- a/src/Text/Pandoc/Readers/Markdown.hs
+++ b/src/Text/Pandoc/Readers/Markdown.hs
@@ -1392,7 +1392,7 @@ citation = try $ do
   key <- citeKey
   loc <- option "" locator
   return $ Citation{ citationId        = key
-                     , citationPrefix  = [Str pref]
+                     , citationPrefix  = if pref /= [] then [Str pref] else []
                      , citationSuffix  = []
                      , citationLocator = loc
                      , citationMode    = if suppress_auth

  parent reply	other threads:[~2010-11-17 21:49 UTC|newest]

Thread overview: 71+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-11  1:49 [citeproc] " Andrea Rossato
     [not found] ` <20101111014927.GP24988-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-12  6:36   ` John MacFarlane
     [not found]     ` <20101112063622.GA8676-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-12  8:43       ` John MacFarlane
     [not found]         ` <20101112084314.GA15038-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-12 11:16           ` Andrea Rossato
     [not found]             ` <20101112111654.GE19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-12 16:08               ` John MacFarlane
2010-11-12 13:45           ` Nathan Gass
     [not found]             ` <4CDD4501.7030700-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-12 16:13               ` John MacFarlane
2010-11-12 23:26               ` Andrea Rossato
2010-11-12 15:38           ` Andrea Rossato
     [not found]             ` <20101112153829.GG19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-12 16:16               ` John MacFarlane
2010-11-12 23:23           ` Andrea Rossato
     [not found]             ` <20101112232354.GH19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-13  2:56               ` John MacFarlane
     [not found]                 ` <20101113025645.GA25386-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-13  9:16                   ` Andrea Rossato
     [not found]                     ` <20101113091616.GK19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-13 11:40                       ` Andrea Rossato
     [not found]                         ` <20101113114018.GM19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-13 16:57                           ` John MacFarlane
2010-11-13 16:50                       ` John MacFarlane
2010-11-13  1:11           ` Andrea Rossato
     [not found]             ` <20101113011105.GJ19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-13  3:38               ` John MacFarlane
     [not found]                 ` <20101113033806.GA27595-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-13 13:15                   ` Andrea Rossato
     [not found]                     ` <20101113131538.GO19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-13 16:27                       ` John MacFarlane
     [not found]                         ` <20101113162702.GC1212-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-13 16:55                           ` Bruce
2010-11-14 13:26                           ` Andrea Rossato
     [not found]                             ` <20101114132646.GR19143-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-17  4:39                               ` John MacFarlane
     [not found]                                 ` <20101117043955.GA18136-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-17 21:49                                   ` Andrea Rossato [this message]
2010-11-19 19:51                                   ` John MacFarlane
     [not found]                                     ` <20101119195134.GB30277-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-20  2:53                                       ` Andrea Rossato
     [not found]                                         ` <20101120025350.GA13438-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-21 18:23                                           ` John MacFarlane
     [not found]                                             ` <20101121182302.GK24768-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-22 17:09                                               ` Andrea Rossato
2010-11-23  9:56                                   ` Nathan Gass
     [not found]                                     ` <4CEB8FB6.807-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-23 15:46                                       ` John MacFarlane
     [not found]                                         ` <20101123154639.GB12884-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-23 20:09                                           ` Andrea Rossato
2010-11-24  1:20                                           ` Nathan Gass
     [not found]                                             ` <4CEC6860.7020908-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-24  2:39                                               ` John MacFarlane
     [not found]                                                 ` <20101124023950.GA25133-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-24  9:39                                                   ` Nathan Gass
     [not found]                                                     ` <4CECDD5D.6010400-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-24 16:09                                                       ` John MacFarlane
     [not found]                                                         ` <20101124160951.GD1590-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-26 12:33                                                           ` Nathan Gass
     [not found]                                                             ` <4CEFA937.7040606-8UOIJiGH10pyDzI6CaY1VQ@public.gmane.org>
2010-11-27 15:12                                                               ` John MacFarlane
     [not found]                                                                 ` <20101127151254.GA535-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-27 18:58                                                                   ` Andrea Rossato
     [not found]                                                                     ` <20101127185836.GD32527-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-27 19:32                                                                       ` John MacFarlane
     [not found]                                                                         ` <20101127193232.GA3576-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-27 20:09                                                                           ` John MacFarlane
     [not found]                                                                             ` <20101127200931.GA4421-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-27 20:39                                                                               ` Andrea Rossato
     [not found]                                                                                 ` <20101127203907.GH32527-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-28 12:57                                                                                   ` Andrea Rossato
2010-11-28 13:03                                                                               ` Andrea Rossato
     [not found]                                                                                 ` <20101128130345.GK32527-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-28 16:16                                                                                   ` John MacFarlane
     [not found]                                                                                     ` <20101128161612.GB29510-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-29 16:10                                                                                       ` Andrea Rossato
     [not found]                                                                                         ` <20101129161059.GC20563-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-12-01 13:06                                                                                           ` Andrea Rossato
     [not found]                                                                                             ` <20101201130603.GJ10338-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-12-01 16:17                                                                                               ` John MacFarlane
     [not found]                                                                                                 ` <20101201161702.GD3038-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-01 20:55                                                                                                   ` dsanson
     [not found]                                                                                                     ` <8f044663-b02a-45bd-b299-60fef03bf457-n9fKM5ssUrqdjmvXPhoLGFYGCWtFR9XvQQ4Iyu8u01E@public.gmane.org>
2010-12-07 16:35                                                                                                       ` John MacFarlane
     [not found]                                                                                                         ` <20101207163551.GC13385-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-09 11:23                                                                                                           ` Andrea Rossato
     [not found]                                                                                                             ` <20101209112343.GD28254-u31zCTIHpvLVI6Gt0zCidg@public.gmane.org>
2010-12-09 16:29                                                                                                               ` John MacFarlane
2010-12-03  5:57                                                                                                   ` John MacFarlane
     [not found]                                                                                                     ` <20101203055730.GA24661-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-03  6:09                                                                                                       ` John MacFarlane
     [not found]                                                                                                         ` <20101203060948.GA24736-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-03  6:45                                                                                                           ` John MacFarlane
2010-12-03 14:18                                                                                                           ` Andrea Rossato
2010-12-07 17:27                                                                                                           ` Andrea Rossato
2010-12-03 14:11                                                                                                       ` Andrea Rossato
     [not found]                                                                                                         ` <20101203141139.GD14815-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-12-03 14:19                                                                                                           ` Andrea Rossato
     [not found]                                                                                                             ` <20101203141953.GF14815-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-12-03 15:40                                                                                                               ` John MacFarlane
     [not found]                                                                                                                 ` <20101203154032.GB28210-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-07 10:30                                                                                                                   ` Andrea Rossato
     [not found]                                                                                                                     ` <20101207103034.GA22516-u31zCTIHpvLVI6Gt0zCidg@public.gmane.org>
2010-12-07 16:30                                                                                                                       ` John MacFarlane
2010-12-03 15:30                                                                                                           ` John MacFarlane
2010-11-28 18:10                                                                                   ` John MacFarlane
     [not found]                                                                                     ` <20101128181002.GA30854-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-11-29 16:12                                                                                       ` Andrea Rossato
2010-11-27 20:10                                                                           ` Andrea Rossato
     [not found]                                                                             ` <20101127201014.GF32527-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-11-27 20:18                                                                               ` Andrea Rossato
2010-11-28  2:22                                                                               ` John MacFarlane
     [not found]                                                                                 ` <20101128022210.GA6819-nFAEphtLEs+AA6luYCgp0U1S2cYJDpTV9nwVQlTi/Pw@public.gmane.org>
2010-12-01 11:28                                                                                   ` Andrea Rossato
     [not found]                                                                                     ` <20101201112806.GH10338-j4W6CDmL7uNdAaE8spi6tJZpQXiuRcL9@public.gmane.org>
2010-12-01 15:52                                                                                       ` John MacFarlane
2010-11-24 20:32                                                       ` Andrea Rossato
2010-11-16 23:17                   ` Nathan Gass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101117214900.GB8887@eeepc.istitutocolli.org \
    --to=andrea.rossato-re5jqeeqqe8avxtiumwx3w@public.gmane.org \
    --cc=pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).