# Escaping Mechanisms Upon tinkering with writing blog posts through {mod}`paxter.author` subpackage, we would eventually find out some technical limitations with the command syntax in Paxter language. On this page, we discuss these limitations. ## Escaping ‘@’ As readers have already noticed that ‘**@**’ symbol has special meaning in Paxter language: it acts as a switch which turns the subsequence piece of source text into a command. Therefore, if Paxter library users wish to include ‘**@**’ string literal as-is in the final HTML output, an escape of some sort is required. … except that the core Paxter language specification actually does _not_ provide a way to escape ‘**@**’ symbols per se. However, there are a few ways around this. ### Method 1: Define Constants For ‘@’ We will take advantage of being able to run python code within the source text. Specifically, we will define a variable to store the `@` symbol character. ```paxter @python##" at = '@' "## This is the @bold{at} symbol: @at. ``` ```html
This is the at symbol: @.
``` But this method would not work when you wish to write an email address or a twitter handle. For this, additional bar-delimiters surrounding the phrase is needed ([see the next section of this page for more information](#escaping-delimiters-curly-braces-quotes-and-bars)). ```paxter @python##" at = '@' "## Email me at @link["mailto:person@example.com"]{person@|at|example.com} and my twitter handle is @|at|example. Don’t @at me. ``` ```htmlEmail me at person@example.com and my twitter handle is @example. Don’t @ me.
``` ### Method 2: Using `@verb` Command The pre-defined `@verb` command (short for **verbatim**) accepts a string argument and returns it as-is. Here is an example of how to author the same document from the previous example. ```paxter Email me at @link["mailto:person@example.com"]{@verb##"person@example.com"##} and my twitter handle is @verb"@"example. @verb"Don’t @ me". ``` ```htmlEmail me at person@example.com and my twitter handle is @example. Don’t @ me.
``` ### Method 3: Using Symbol-Only Command Recall the {ref}`predefined-raw-html` section from a past page. We have the commands `@\`, `@%`, `@.`, and `@,` as shortcuts for some raw HTML strings. In fact, commands under the symbol-only form may represent other kinds of objects as well. Particularly in {mod}`paxter.author` subpackage, we can display the string ‘**@**’ through the command `@@`. Suppose we wish to include an email address in a blog post. Here is an example of the source text: ```paxter Email me at @link["mailto:person@example.com"]{person@@example.com} and my twitter handle is @@example. Don’t @@ me. ``` The above source text gets transformed into the following HTML output. ```htmlEmail me at person@example.com and my twitter handle is @example. Don’t @ me.
``` What would happen if we forgot to _double_ the `@` symbol? Consider the following example source text. ```paxter Email me at @link["mailto:person@example.com"]{person@@example.com} and my twitter handle is @example. Don’t @@ me. ``` Parsing the above source text would yield the following error. Essentially, the `@example` command at line 2 column 27 is an unknown command. (The stack trace may be long and scary. It is totally to skim over it.) ```pytb Traceback (most recent call last): File ".../paxter/src/paxter/evaluate/context.py", line 149, in transform_command phrase_value = phrase_eval(token.phrase, self.env) File ".../paxter/src/paxter/author/standards.py", line 31, in phrase_unsafe_eval return eval(phrase, env) File "