Page MenuHomePhabricator

Pastes don't allow lua syntax highlighting
Closed, ResolvedPublic

Description

While in tasks, syntaxhighlighting is supported for lua uing lang=lua this option is not available when creating a paste. Pastes should also allow syntaxhighlighting for lua as it becomes more and more important to show examples of how lua can be used on Wikipedias.

Event Timeline

Bene raised the priority of this task from to Needs Triage.
Bene updated the task description. (Show Details)
Bene added a project: Phabricator.
Bene subscribed.
Aklapper triaged this task as Lowest priority.May 31 2015, 1:12 PM
Aklapper edited projects, added Phabricator (Upstream); removed Phabricator.
Aklapper set Security to None.

This is configurable in pygments.dropdown-choices.

Naming a file something.lua and leaving "Language" set to "Detect Automatically" should also engage the Lua highlighter.

Change 290409 had a related patch set uploaded (by Aklapper):
Add "Lua" to syntax highlighting dropdown choices in Phab's "Paste"

https://gerrit.wikimedia.org/r/290409

(Assuming as per previous comment that Lua is not wanted as a default choice in upstream, I've prepared a downstream configuration patch, for the lulz.)

Change 290409 merged by Dzahn:
Add "Lua" to syntax highlighting dropdown choices in Phab's "Paste"

https://gerrit.wikimedia.org/r/290409

Lua is now an option in the dropdown

Here's a paste with Lua code and highlighting:

1 print("Hello World")
2
3
4 -- defines a factorial function
5 function fact (n)
6 if n == 0 then
7 return 1
8 else
9 return n * fact(n-1)
10 end
11 end
12
13 print("enter a number:")
14 a = io.read("*number") -- read a number
15 print(fact(a))
16

Dzahn claimed this task.
Dzahn removed a project: Patch-For-Review.