summary refs log tree commit diff stats
path: root/compiler/sourcemap.nim
Commit message (Collapse)AuthorAgeFilesLines
* chore: fix some typos (#23412)soonsouth2024-03-161-1/+1
| | | Signed-off-by: soonsouth <cuibuwei@163.com>
* fixes yet another strictdefs bug (#23069)ringabout2023-12-151-4/+1
|
* use strictdefs for compiler (#22365)ringabout2023-08-061-6/+8
| | | | | | | | | | | | | | | * wip; use strictdefs for compiler * checkpoint * complete the chores * more fixes * first phase cleanup * Update compiler/bitsets.nim * cleanup
* Fix typo in sourcemap.nim (#21438)Ikko Eltociear Ashimine2023-02-271-1/+1
| | | seperated -> separated
* Refactor JS sourcemap generator (#21053)Jake Leahy2022-12-131-370/+194
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Parse the new line format * Fix pattern Didn't have space after the path * Remove duplicate sources Sources would sometimes double up with a new line at the end * Remove unused variable * Refactor sourcemap.nim Removes the multiple translations needed, now goes from single high level type to the final SourceMap Adds documentation for procs * Line numbers line up properly now Files aren't linking correctly though * Files now link up correctly Lines are sometimes off but overall seems pretty good Just need to implement parser * Add column info to output Add sourceMappingURL to rope directly to prevent copy * Properly handle columns * Remove debug lines * Add testcase * Finish testcase * Use the outdir folder instead of the folder the test is in to find the sourcemap Co-authored-by: ringabout <43030857+ringabout@users.noreply.github.com>
* cString => cSourceString; tyCString => tyCstring so that error msgs show ↵Timothee Cour2021-04-171-5/+5
| | | | cstring, not cString (#17744)
* Big compiler Cleanup (#14777)Clyybber2020-08-281-5/+3
|
* Remove my wrongly written mangled-related code, not needed anymore (#13858)Alexander Ivanov2020-04-031-3/+3
|
* sourcemaps for the JS codegen (#7508)Alexander Ivanov2020-04-031-0/+385
.sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
.\" Automatically generated by Pandoc 3.6.4
.\"
.TH "cha\-urimethodmap" "5" "" "" "URI method map support in Chawan"
.SH URI method map support in Chawan
Chawan can be used to map unrecognized protocols to known protocols
using the \f[CR]urimethodmap\f[R] format.
.PP
The main use case for this is implementing handlers to protocols unknown
to Chawan through a protocol that the browser \f[I]does\f[R] understand.
.SS Search path
The search path for urimethodmap files can be overridden using the
configuration variable \f[CR]external.urimethodmap\f[R].
.PP
The default search path for urimethodmap files is:
.IP
.EX
$HOME/.urimethodmap:$HOME/.w3m/urimethodmap:/etc/urimethodmap:/usr/local/etc/urimethodmap
.EE
.SS Format
The urimethodmap format is taken 1:1 from w3m, with only some
modifications to the interpretation of templates.
.PP
A rough attempt at the formal description of this:
.IP
.EX
URIMethodMap\-File = *URIMethodMap\-line

URIMethodMap\-Line = Comment / URIMethodMap\-Entry

URIMethodMap\-Entry = Protocol *WHITESPACE Template *WHITESPACE CR

Protocol = 1*CHAR COLON

Template = [see below]

Comment = *WHITESPACE CR / \[dq]#\[dq] *CHAR CR
.EE
.PP
Note that an ASCII colon sign (:) must be present after the protocol
name.
However, the whitespace may be omitted.
.PP
Examples:
.IP
.EX
# This is ok:
protocol:   /cgi\-bin/interpret\-protocol?%s
# This is ok too:
protocol:/cgi\-bin/interpret\-protocol?%s
# Spaces and tabs are both allowed, so this is also ok:
protocol:   /cgi\-bin/interpret\-protocol?%s
# However, this is incorrect, because the colon sign is missing:
protocol    /cgi\-bin/interpret\-protocol?%s
.EE
.PP
The redirection template is the target URL.
If the string \f[CR]%s\f[R] is contained in the template, it will be
replaced by the target URL.
.PP
Note: Chawan used to URL\-encode the substituted URL in the past, but
this is no longer the case.
.PP
For compatibility with w3m, templates starting with
\f[CR]/cgi\-bin/\f[R] and \f[CR]file:/cgi\-bin/\f[R] are special\-cased
and the starting string is replaced with \f[CR]cgi\-bin:\f[R].
So for example, the template \f[CR]/cgi\-bin/w3mdict.cgi\f[R] is the
same as \f[CR]cgi\-bin:w3mdict.cgi\f[R] (and so is
\f[CR]file:/cgi\-bin/w3mdict.cgi\f[R]).
.PP
Example:
.IP
.EX
# The following are the same in Chawan
protocol:   /cgi\-bin/interpret\-protocol?%s
protocol:   file:/cgi\-bin/interpret\-protocol?%s
# Note: this last entry does not work in w3m.
protocol:   cgi\-bin:interpret\-protocol?%s
.EE
.PP
Note however that absolute paths to cgi scripts are NOT special cased,
so e.g.\ \f[CR]file:///usr/local/libexec/w3m/cgi\-bin/w3mdict.cgi\f[R]
will simply open w3mdict.cgi in the file viewer.
(Unlike in w3m, where it could run \f[CR]w3mdict.cgi\f[R] depending on
the user\[cq]s configuration.)
.SS Examples
.SS In config.toml
.IP
.EX
# Following sets the urimethodmap search path to the path relative to the
# configuration file. So if your configuration file is in
# \[ti]/.config/chawan/config.toml, Chawan will use \[ti]/.config/chawan/urimethodmap.
# If it\[aq]s in \[ti]/.chawan/config.toml, then it uses \[ti]/.chawan/urimethodmap.
[external]
urimethodmap = \[dq]urimethodmap\[dq]
.EE
.SS In urimethodmap
.SS magnet.cgi
.IP
.EX
# Use the \[ga]magnet.cgi\[ga] CGI shell script to pass magnet links to Transmission.
magnet:     /cgi\-bin/magnet.cgi?%s
.EE
.PP
\f[CR]magnet.cgi\f[R] can be found in the \f[CR]bonus/\f[R] directory.
You can also write a local CGI wrapper to pass the links to your
BitTorrent client of choice.
.SS dict
In w3m, urimethodmap is commonly (ab)used to define shorthands for CGI
scripts.
.PP
This works in Chawan too; for an example, you could define a
\f[CR]tl:\f[R] shorthand like this:
.IP
.EX
# (trans.cgi is a script you can find and study in the bonus/ directory.)
tl:     /cgi\-bin/trans.cgi?%s
.EE
.PP
Then, you could open the translation of any word using
\f[CR]tl:word\f[R].
.PP
Note however that Chawan has a more powerful facility for substitution
shorthands like this in the form of omni\-rules.
So if you want to redirect to an on\-line dictionary site with tl:word
instead of providing a local CGI interface, it is probably easier to
just use omni\-rules instead of urimethodmap + local CGI redirection.
.PP
Rule of thumb: if you find yourself writing local CGI scripts that just
send a \f[CR]Location:\f[R] header, maybe consider just using an
omni\-rule.
.SS See also
\f[B]cha\f[R](1) \f[B]cha\-localcgi\f[R](5)