public inbox archive for pandoc-discuss@googlegroups.com
 help / color / mirror / Atom feed
From: gw2286-WLbs8XpHrcb2fBVCVOL8/A@public.gmane.org
To: pandoc-discuss <pandoc-discuss-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
Subject: Using Pandoc for general text processing, e.g. writing a Ctags emitter: source text info in the AST
Date: Wed, 11 Oct 2017 10:35:55 -0700 (PDT)	[thread overview]
Message-ID: <9c830d97-68ca-4cda-8892-3cad8b2c975d@googlegroups.com> (raw)


[-- Attachment #1.1: Type: text/plain, Size: 2172 bytes --]

I'm interested in using Pandoc to write a generic Ctags emitter. However, 
I'm finding this is difficult because it seems impossible to connect a node 
to its original source code in the current API(s).

Is there any way to access the line number in the source file where a node 
first appears, from the Haskell API or the JSON formatted output? If not, 
is this something that would be feasible to track and expose?

Or, to stretch the idea a bit, would it be totally crazy to extend Pandoc 
with the ability to attach this kind of metadata to each node, or perhaps 
allow a reader to attach *arbitrary* metadata? In the latter case, the 
structure of the node-level metadata would be a matter of convention, and 
writers would be free to simply ignore it.

I'm asking about both the feasbility of implementation ("would it be 
possible without having to rewrite huge amounts of code?") and the 
desirability of implementation ("is this something the Pandoc project is 
interested in?").

For what it's worth, I don't envision this being useful solely for Ctags 
tag generation, although IMO a "format-agnostic" tag generator for dozens 
of markup formats that comes "for free" out of a single implementation 
seems like a good enough prize on its own, so long as you can easily add, 
say, "linenrStart", "linenrEnd", and/or "verbatimSource" attributes to the 
reader. You could also use this ability to create Pandoc-based code/text 
formatters and linters that introspect on the contents of nodes, or 
automatically inject a "view source for this section on GitHub" link into 
top-level headings.

-- 
You received this message because you are subscribed to the Google Groups "pandoc-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pandoc-discuss+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To post to this group, send email to pandoc-discuss-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To view this discussion on the web visit https://groups.google.com/d/msgid/pandoc-discuss/9c830d97-68ca-4cda-8892-3cad8b2c975d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

[-- Attachment #1.2: Type: text/html, Size: 2693 bytes --]

             reply	other threads:[~2017-10-11 17:35 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-11 17:35 gw2286-WLbs8XpHrcb2fBVCVOL8/A [this message]
     [not found] ` <9c830d97-68ca-4cda-8892-3cad8b2c975d-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org>
2017-10-11 18:20   ` John MACFARLANE

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=9c830d97-68ca-4cda-8892-3cad8b2c975d@googlegroups.com \
    --to=gw2286-wlbs8xphrcb2fbvcvol8/a@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).