zulip/zerver/lib
Steve Howell ace12bcab6 Support arbitrarily nested fenced quote/code blocks.
Now we can nest fenced code/quote blocks inside of quote
blocks down to arbitrary depths.  Code blocks are always leafs.
Fenced blocks start with at least three tildes or backticks,
and the clump of punctuation then becomes the terminator for
the block.  If the user ends their message without terminators,
all blocks are automatically closed.

When inside a quote block, you can start another fenced block
with any header that doesn't match the end-string of the outer
block.  (If you don't want to specify a language, then you
can change the number of backticks/tildes to avoid amiguity.)

Most of the heavy lifting happens in FencedBlockPreprocessor.run().
The parser works by pushing handlers on to a stack and popping
them off when the ends of blocks are encountered. Parents communicate
with their children by passing in a simple Python list of strings
for the child to append to.  Handlers also maintain their own
lists for their own content, and when their done() method is called,
they render their data as needed.

The handlers are objects returned by functions, and the handler
functions close on variables push, pop, and processor.  The closure
style here makes the handlers pretty tightly coupled to the outer
run() method.  If we wanted to move to a class-based style, the
tradeoff would be that the class instances would have to marshall
push/pop/processor etc., but we could test the components more
easily in isolation.

Dealing with blank lines is very fiddly inside of bugdown.

The new functionality here is captured in the test
BugdownTest.test_complexly_nested_quote().

(imported from commit 53886c8de74bdf2bbd3cef8be9de25f05bddb93c)
2013-11-21 17:13:17 -05:00
..
bugdown Support arbitrarily nested fenced quote/code blocks. 2013-11-21 17:13:17 -05:00
__init__.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
actions.py fix use of EXTERNAL_URL to EXTERNAL_HOST, and some typos 2013-11-20 17:39:07 -05:00
alert_words.py Clean up some unused imports. 2013-11-04 11:51:17 -05:00
avatar.py Allow overriding the default avatar image 2013-11-18 11:48:53 -05:00
bulk_create.py Supply a name when creating realms. 2013-10-17 13:47:51 -04:00
cache_helpers.py Support filling memcached caches with no messages. 2013-11-13 12:07:16 -05:00
cache.py Update active_user_dicts_in_realm cache when touching is_active flag. 2013-11-16 11:35:25 -05:00
ccache.py Clean up some unused imports. 2013-11-04 11:51:17 -05:00
context_managers.py Use os.path directly rather than sometimes importing it separately. 2013-10-28 15:44:13 -04:00
create_user.py Only create initial passwords for local dev setups 2013-11-12 22:42:05 -05:00
debug.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
digest.py Don't use hardcoded noreply@zulip.com, zulip@zulip.com, or https://zulip.com 2013-11-15 21:31:37 -05:00
event_queue.py Revert "Don't send heartbeat events to clients that don't request them." 2013-11-21 12:53:26 -05:00
html_diff.py Make built-in bots come from settings.py, and allow localserver-specific ones 2013-11-01 14:13:05 -04:00
initial_password.py Only create initial passwords for local dev setups 2013-11-12 22:42:05 -05:00
logging_util.py Enable absolute imports for non-third-party code where it was omitted previously 2013-10-25 14:13:30 -04:00
mandrill_client.py [schema] Add ScheduledJob table, and update mandrill related code 2013-11-13 16:41:36 -05:00
mention.py Clean up some unused imports. 2013-11-04 11:51:17 -05:00
parallel.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
push_notifications.py localserver: Add support for not having an APNS_CERT_FILE. 2013-11-12 09:34:25 -05:00
query.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
queue.py Simplify callback protocol for register_json_consumer(). 2013-10-31 13:18:11 -04:00
rate_limiter.py [schema] Support for authenticating Deployments via the API. 2013-10-25 14:13:30 -04:00
response.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
rest.py Make rest_dispatch errors cleaner for requests from browsers. 2013-10-31 14:36:34 -04:00
socket.py [manual] socket: Send explicit ACKs 2013-11-19 11:06:14 -05:00
statistics.py Clean up some unused imports. 2013-11-04 11:51:17 -05:00
timeout.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
timestamp.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
tornado_ioloop_logging.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
unminify.py [manual] Rename Django app from zephyr to zerver. 2013-08-06 07:39:36 -04:00
upload.py Clean up some unused imports. 2013-11-04 11:51:17 -05:00
utils.py Move to a common random token generation function instead of several one-offs. 2013-08-09 14:59:26 -04:00