ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* Encoding reserved characters in URI query strings
@ 2017-02-05 14:06 Rogers, Michael K
  2017-02-05 17:09 ` Aditya Mahajan
  0 siblings, 1 reply; 5+ messages in thread
From: Rogers, Michael K @ 2017-02-05 14:06 UTC (permalink / raw)
  To: mailing list for ConTeXt users

Let's say I want a link to plot x+2 in Wolfram|Alpha.  I need to catenate "http://www.wolframalpha.com/input/?i=" and  "plot+x%2B2".  Is there any way already available in ConTeXt to translate reserved characters like "+" to the percent-hexcode "%2B"?

Something like

    \encode[plot x+2]

would become

    plot+x%2B2

Or more generally, some languages have a query constructor like this

    \queryURI
      [http://www.wolframalpha.com/input]
      [i=plot x+2]

which would construct the URI

    http://www.wolframalpha.com/input/?i=plot+x%2B2

I could write my own, of course.  But no need to reinvent the wheel.

TIA,

Michael

________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Encoding reserved characters in URI query strings
  2017-02-05 14:06 Encoding reserved characters in URI query strings Rogers, Michael K
@ 2017-02-05 17:09 ` Aditya Mahajan
  2017-02-05 17:22   ` Rogers, Michael K
  2017-02-07 12:24   ` Bibliography Jean-Pierre Delange
  0 siblings, 2 replies; 5+ messages in thread
From: Aditya Mahajan @ 2017-02-05 17:09 UTC (permalink / raw)
  To: mailing list for ConTeXt users

On Sun, 5 Feb 2017, Rogers, Michael K wrote:

> Let's say I want a link to plot x+2 in Wolfram|Alpha.  I need to catenate "http://www.wolframalpha.com/input/?i=" and  "plot+x%2B2".  Is there any way already available in ConTeXt to translate reserved characters like "+" to the percent-hexcode "%2B"?
>
> Something like
>
>    \encode[plot x+2]
>
> would become
>
>    plot+x%2B2
>
> Or more generally, some languages have a query constructor like this
>
>    \queryURI
>      [http://www.wolframalpha.com/input]
>      [i=plot x+2]
>
> which would construct the URI
>
>    http://www.wolframalpha.com/input/?i=plot+x%2B2
>
> I could write my own, of course.  But no need to reinvent the wheel.

url.escape does exactly that.

\startluacode
   local base="http://www.wolframalpha.com/input"
   local query="i=plot x+2"
   local fullname = base .. query
   print(url.escape(fullname))
\stopluacode

gives

http%3A//www.wolframalpha.com/inputi%3Dplot%20x%2B2

Also look at l-url.lua for other helper functions for parsing and 
escaping/unescaping urls.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Encoding reserved characters in URI query strings
  2017-02-05 17:09 ` Aditya Mahajan
@ 2017-02-05 17:22   ` Rogers, Michael K
  2017-02-07 12:24   ` Bibliography Jean-Pierre Delange
  1 sibling, 0 replies; 5+ messages in thread
From: Rogers, Michael K @ 2017-02-05 17:22 UTC (permalink / raw)
  To: mailing list for ConTeXt users


> On Feb 5, 2017, at 12:09 PM, Aditya Mahajan <adityam@umich.edu> wrote:
>
> On Sun, 5 Feb 2017, Rogers, Michael K wrote:
>
>> Let's say I want a link to plot x+2 in Wolfram|Alpha.  I need to catenate "http://www.wolframalpha.com/input/?i=" and  "plot+x%2B2".  Is there any way already available in ConTeXt to translate reserved characters like "+" to the percent-hexcode "%2B"?
>>
>> Something like
>>
>>   \encode[plot x+2]
>>
>> would become
>>
>>   plot+x%2B2
>>
>> Or more generally, some languages have a query constructor like this
>>
>>   \queryURI
>>     [http://www.wolframalpha.com/input]
>>     [i=plot x+2]
>>
>> which would construct the URI
>>
>>   http://www.wolframalpha.com/input/?i=plot+x%2B2
>>
>> I could write my own, of course.  But no need to reinvent the wheel.
>
> url.escape does exactly that.
>
> \startluacode
>  local base="http://www.wolframalpha.com/input"
>  local query="i=plot x+2"
>  local fullname = base .. query
>  print(url.escape(fullname))
> \stopluacode
>
> gives
>
> http%3A//www.wolframalpha.com/inputi%3Dplot%20x%2B2
>
> Also look at l-url.lua for other helper functions for parsing and escaping/unescaping urls.
>
> Aditya

Thanks! I figured there must be a function like that.

Michael


________________________________

This e-mail message (including any attachments) is for the sole use of
the intended recipient(s) and may contain confidential and privileged
information. If the reader of this message is not the intended
recipient, you are hereby notified that any dissemination, distribution
or copying of this message (including any attachments) is strictly
prohibited.

If you have received this message in error, please contact
the sender by reply e-mail message and destroy all copies of the
original message (including attachments).
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Bibliography
  2017-02-05 17:09 ` Aditya Mahajan
  2017-02-05 17:22   ` Rogers, Michael K
@ 2017-02-07 12:24   ` Jean-Pierre Delange
  2017-02-07 15:12     ` Bibliography Alan Braslau
  1 sibling, 1 reply; 5+ messages in thread
From: Jean-Pierre Delange @ 2017-02-07 12:24 UTC (permalink / raw)
  To: mailing list for ConTeXt users


Dear list,

Thanks to the list and to Hans and Alan's manual "mkiv-publications", I has achieved some footnotes with bibliographical dataset. All is fine and I success to manage what I want.

But I don't understand why the word 'Author' is printed at the end of each line as the following minimal sample below shows it, e.g. : 
Aristote (n.d.). Les Politiques. Author.
Cicéron (n.d.). Tusculanes, V, 8. Author.
(see the sample's printed page 2)

Is there a question of language (english), or anything else ? How to avoid this 'Author' ? I use the APA style with \usebtxdefinitions, and maybe one can use some other style ?
Anyway, many thanks for your help !
JP

\startbuffer[biblio]

@book{Cicéron1,
author = {Cicéron},
title = {Tusculanes, V, 8},
}


@book{Aristote2,
author = {Aristote},
title = {Les Politiques},
  
 }
 

\stopbuffer

\usebtxdataset[philosophie ancienne][biblio.buffer]
\usebtxdefinitions[apa]
\definebtxrendering[philosophie ancienne][apa][dataset=philosophie ancienne]
\setupbtxrendering[continue =yes]
 \starttext

\startchapter[title={Introduction à la Philosophie}]

Dans les notes qui suivent, on s’intéressera à la pensée philosophique comme philosophie politique. Aristote, le philosophe grec qui publia et commenta les Constitutions des anciennes cités grecques, commence son ouvrage {\it les Politiques} par la thèse selon laquelle \quotation {l’homme est un animal politique}\footnote{\cite[alternative=entry][philosophie ancienne::Aristote2]}.
\blank
Cicéron, ce grand homme politique et cet écrivain savant, a eu la formule bien connue, selon laquelle \quotation{Socrate fit descendre la philosophie du ciel sur la terre.}\footnote{\cite[alternative=entry][philosophie ancienne::Cicéron1]}, qui désigne la question fondamentale de l’intérêt nourri par la philosophie pour les {\it choses humaines}.

\stopchapter
 
\starttext

\startbackmatter

  \startchapter[title={Bibliographie}]

        \startsection[title={Philosophie ancienne}]

        \placelistofpublications[philosophie ancienne][method=local]

        \stopsection

        \stopchapter

\stopbackmatter

\stoptext 

___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Bibliography
  2017-02-07 12:24   ` Bibliography Jean-Pierre Delange
@ 2017-02-07 15:12     ` Alan Braslau
  0 siblings, 0 replies; 5+ messages in thread
From: Alan Braslau @ 2017-02-07 15:12 UTC (permalink / raw)
  To: Jean-Pierre Delange; +Cc: mailing list for ConTeXt users

On Tue, 7 Feb 2017 13:24:07 +0100
Jean-Pierre Delange <adeimantos@free.fr> wrote:

> But I don't understand why the word 'Author' is printed at the end of
> each line as the following minimal sample below shows it, e.g. :
> Aristote (n.d.). Les Politiques. Author. Cicéron (n.d.). Tusculanes,
> V, 8. Author.

According to the APA style manual, a book without a publisher is
self-published, and one is directed to use the word "Author".

To avoid this, you need to complete the dataset entry, or else choose
a category other than @book such as @unpublished.

Alan
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-02-07 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-05 14:06 Encoding reserved characters in URI query strings Rogers, Michael K
2017-02-05 17:09 ` Aditya Mahajan
2017-02-05 17:22   ` Rogers, Michael K
2017-02-07 12:24   ` Bibliography Jean-Pierre Delange
2017-02-07 15:12     ` Bibliography Alan Braslau

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).