branch: externals/org-real commit 7d5574d7144a952c10923286a83d4b3d83578a74 Author: Tyler Grinn <tylergr...@gmail.com> Commit: Tyler Grinn <tylergr...@gmail.com>
Adding margin and padding tests --- Eldev | 59 +++++++--- org-real.el | 144 ++++++++++++------------- tests/edge-cases.org | 298 +++++++++++++++++++++++++------------------------- tests/margin.org | 153 ++++++++++++++++++++++++++ tests/padding.org | 300 +++++++++++++++++++++++++++++++++++++++++++++++++++ tests/smoke-test.org | 160 +++++++++++++-------------- 6 files changed, 790 insertions(+), 324 deletions(-) diff --git a/Eldev b/Eldev index de0ac6c..5991ac1 100644 --- a/Eldev +++ b/Eldev @@ -43,6 +43,7 @@ (current-buffer) nil t)) (with-current-buffer (get-buffer "*Diff*") + (message "@@ -actual +expected @@") (message (string-join (butlast @@ -67,29 +68,53 @@ (org-element-map (org-element-parse-buffer) 'link (lambda (link) (goto-char (org-element-property :begin link)) - (let ((title (and (org-in-regexp org-link-bracket-re) - (match-string 2))) - (result (catch 'result - (save-window-excursion - (condition-case nil - (org-open-at-point) - (error (throw 'result nil)))) - (string= (get-expected) (get-actual))))) + (let* ((title (and (org-in-regexp org-link-bracket-re) + (match-string 2))) + (org-real-margin-y (if (org-entry-get nil "MARGIN-Y" t) + (string-to-number (org-entry-get nil "MARGIN-Y" t)) + org-real-margin-y)) + (org-real-margin-x (if (org-entry-get nil "MARGIN-X" t) + (string-to-number (org-entry-get nil "MARGIN-X" t)) + org-real-margin-x)) + (org-real-padding-y (if (org-entry-get nil "PADDING-Y" t) + (string-to-number (org-entry-get nil "PADDING-Y" t)) + org-real-padding-y)) + (org-real-padding-x (if (org-entry-get nil "PADDING-X" t) + (string-to-number (org-entry-get nil "PADDING-X" t)) + org-real-padding-x)) + (result (catch 'result + (save-window-excursion + (condition-case nil + (org-open-at-point) + (error (throw 'result nil)))) + (string= (get-expected) (get-actual))))) (print-result title result) (set-result result)))) (message "\n Merging links:\n") (org-babel-map-src-blocks nil (goto-char beg-block) - (let ((title (org-entry-get nil "ITEM")) - (result (catch 'result - (save-window-excursion - (condition-case nil - (progn - (org-edit-special) - (org-real-world)) - (error (throw 'result nil)))) - (string= (get-expected) (get-actual))))) + (let* ((title (org-entry-get nil "ITEM")) + (org-real-margin-y (if (org-entry-get nil "MARGIN-Y") + (string-to-number (org-entry-get nil "MARGIN-Y" t)) + org-real-margin-y)) + (org-real-margin-x (if (org-entry-get nil "MARGIN-X" t) + (string-to-number (org-entry-get nil "MARGIN-X" t)) + org-real-margin-x)) + (org-real-padding-y (if (org-entry-get nil "PADDING-Y" t) + (string-to-number (org-entry-get nil "PADDING-Y" t)) + org-real-padding-y)) + (org-real-padding-x (if (org-entry-get nil "PADDING-X" t) + (string-to-number (org-entry-get nil "PADDING-X" t)) + org-real-padding-x)) + (result (catch 'result + (save-window-excursion + (condition-case nil + (progn + (org-edit-special) + (org-real-world)) + (error (throw 'result nil)))) + (string= (get-expected) (get-actual))))) (print-result title result) (set-result result))))) (directory-files "tests" t "\\.org\\'")) diff --git a/org-real.el b/org-real.el index 7f67cf9..941d14c 100644 --- a/org-real.el +++ b/org-real.el @@ -1,7 +1,7 @@ ;;; org-real.el --- Keep track of real things as org-mode links -*- lexical-binding: t -*- ;; Author: Tyler Grinn <tylergr...@gmail.com> -;; Version: 0.4.1 +;; Version: 0.4.2 ;; File: org-real.el ;; Package-Requires: ((emacs "26.1")) ;; Keywords: tools @@ -226,9 +226,13 @@ "Current containers the buffer is displaying.") (make-variable-buffer-local 'org-real--current-containers) -(defvar org-real--current-offset 0 - "Current offset for the box diagram.") -(make-variable-buffer-local 'org-real--current-offset) +(defvar org-real--current-offset-y 0 + "Current offset rows for the box diagram.") +(make-variable-buffer-local 'org-real--current-offset-y) + +(defvar org-real--current-offset-x 0 + "Current offset columns for the box diagram.") +(make-variable-buffer-local 'org-real--current-offset-x) (defvar org-real--visibility org-real-default-visibility "Visibility of children in the current org real diagram.") @@ -313,14 +317,15 @@ (erase-buffer) (if org-real--current-containers (org-real--pp-text org-real--current-containers)) - (setq org-real--current-offset (- (line-number-at-pos) - org-real-margin-y - (* 2 org-real-padding-y))) + (setq org-real--current-offset-y (- (line-number-at-pos) + 2 + (* 2 org-real-padding-y))) + (setq org-real--current-offset-x (- 0 1 org-real-padding-x)) (org-real--draw org-real--current-box) (org-real-mode-recalculate-box-ring) (goto-char (point-max)) (insert "\n") - (goto-char 0))) + (goto-char (point-min)))) (defun org-real-mode-recalculate-box-ring () "Recalculate the position of all boxes in `org-real--current-box'." @@ -383,14 +388,7 @@ The following commands are available: (org-real-box :name (plist-get (pop containers) :name)) world))) (when match - (let ((top (org-real--get-top match)) - (left (org-real--get-left match))) - (run-with-timer - 0 nil - (lambda () - (forward-line (- (+ org-real--current-offset top 1 org-real-padding-y) - (line-number-at-pos))) - (move-to-column (+ left 1 org-real-padding-x)))))))))) + (run-with-timer 0 nil (lambda () (org-real--jump-to-box match)))))))) (defun org-real-headlines () "View all org headlines as an org real diagram. @@ -404,14 +402,7 @@ MAX-LEVEL is the maximum level to show headlines for." (while (and path (or (not match) (not (org-real--is-visible match t)))) (setq match (org-real--find-matching (org-real-box :name (pop path)) world))) (when match - (let ((top (org-real--get-top match)) - (left (org-real--get-left match))) - (run-with-timer - 0 nil - (lambda () - (forward-line (- (+ org-real--current-offset top 1 org-real-padding-y) - (line-number-at-pos))) - (move-to-column (+ left 1 org-real-padding-x)))))))) + (run-with-timer 0 nil (lambda () (org-real--jump-to-box match)))))) (defun org-real-apply () "Apply any change from the real link at point to the current buffer." @@ -539,8 +530,8 @@ visibility." (let* ((reversed (reverse containers)) (container (pop reversed)) (primary-name (plist-get container :name))) - (dotimes (_ org-real-padding-y) (insert "\n")) - (insert (make-string org-real-padding-x ?\s)) + (dotimes (_ org-real-margin-y) (insert "\n")) + (insert (make-string org-real-margin-x ?\s)) (insert "The ") (put-text-property 0 (length primary-name) 'face 'org-real-primary primary-name) @@ -853,19 +844,47 @@ non-nil, skip setting :primary slot on the last box." (org-real--get-all children)))))) (mapc 'org-real--update-visibility (org-real--get-children box 'all))) +(cl-defmethod org-real--is-visible ((box org-real-box) &optional calculate) + "Determine if BOX is visible according to `org-real--visibility'. + +If CALCULATE, determine if the box has been expanded manually." + (if calculate + (with-slots (parent) box + (seq-find + (lambda (sibling) (eq sibling box)) + (org-real--get-children parent))) + (with-slots (level) box + (or (= 0 org-real--visibility) + (<= level org-real--visibility))))) + (cl-defmethod org-real--get-positions ((box org-real-box)) "Get the buffer position of the names of BOX and its children." - (if-let ((pos (and (slot-boundp box :name) - (let ((top (org-real--get-top box)) - (left (org-real--get-left box))) - (forward-line (- (+ org-real--current-offset 1 top org-real-padding-y) - (line-number-at-pos))) - (move-to-column (+ 1 left org-real-padding-x)) - (point))))) - (apply 'append (list pos) (mapcar 'org-real--get-positions (org-real--get-children box))) + (if (slot-boundp box :name) + (progn + (org-real--jump-to-box box) + (apply 'append (list (point)) (mapcar 'org-real--get-positions (org-real--get-children box)))) (apply 'append (mapcar 'org-real--get-positions (org-real--get-children box))))) +(cl-defmethod org-real--jump-to-box ((box org-real-box)) + "Jump cursor to the first character in the label of BOX." + (let ((top (org-real--get-top box)) + (left (org-real--get-left box))) + (forward-line (- (+ org-real--current-offset-y top 1 org-real-padding-y) + (line-number-at-pos))) + (move-to-column (+ org-real--current-offset-x left 1 org-real-padding-x)))) + +(cl-defmethod org-real--find-matching ((search-box org-real-box) (world org-real-box)) + "Find a box in WORLD with a matching name as SEARCH-BOX." + (when (slot-boundp search-box :name) + (with-slots ((search-name name)) search-box + (seq-find + (lambda (box) + (and (slot-boundp box :name) + (string= search-name + (with-slots (name) box name)))) + (org-real--expand world))))) + ;;;; Drawing (cl-defmethod org-real--draw ((box org-real-box) &optional arg) @@ -877,7 +896,8 @@ border using the `org-real-selected' face. If ARG is 'rel, draw the border using `org-real-rel' face, else use `org-real-default' face. -Uses `org-real--current-offset' to determine row offset. +Uses `org-real--current-offset-y' and +`org-real--current-offset-x' to determine row and column offsets. Adds to list `org-real--box-ring' the buffer position of each button drawn." @@ -893,8 +913,8 @@ button drawn." hidden-children) box (when (slot-boundp box :name) - (let* ((top (+ org-real--current-offset (org-real--get-top box))) - (left (org-real--get-left box)) + (let* ((top (+ org-real--current-offset-y (org-real--get-top box))) + (left (+ org-real--current-offset-x (org-real--get-left box))) (width (org-real--get-width box)) (height (org-real--get-height box)) (double (or (org-real--get-all hidden-children) @@ -1092,7 +1112,7 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." children))) (children-height (seq-reduce (lambda (sum row) - (+ sum org-real-padding-y row)) + (+ sum org-real-margin-y row)) (mapcar (lambda (r) (apply 'max 0 @@ -1103,7 +1123,7 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." (with-slots (y-order) child (= r y-order))) children)))) row-indices) - (* -1 org-real-padding-y)))) + (* -1 org-real-margin-y)))) (setq stored-height (+ height children-height)) (+ stored-height on-top-height)))))))) @@ -1116,13 +1136,13 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." (t (let ((on-top-height (org-real--get-on-top-height box))) (if (not (slot-boundp box :parent)) - (setq stored-top on-top-height) + (setq stored-top (+ on-top-height org-real-margin-y)) (let* ((siblings (seq-filter (lambda (sibling) (with-slots (on-top in-front) sibling (not (or on-top in-front)))) (org-real--get-children parent))) - (offset (+ 2 org-real-padding-y org-real-margin-y)) + (offset (+ 2 (* 2 org-real-padding-y))) (top (+ on-top-height offset (org-real--get-top parent)))) (if-let* ((directly-above (seq-reduce (lambda (above sibling) @@ -1155,7 +1175,7 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." (if (slot-boundp box :left) stored-left (if (not (slot-boundp box :parent)) - (setq stored-left 0) + (setq stored-left org-real-margin-x) (let* ((left (+ 1 org-real-padding-x (org-real--get-left parent))) @@ -1280,13 +1300,9 @@ If INCLUDE-ON-TOP is non-nil, also include height on top of box." (with-slots (rel-box) box (if (not (slot-boundp box :rel-box)) (lambda () (interactive)) - (let ((left (org-real--get-left rel-box)) - (top (org-real--get-top rel-box))) - (lambda () - (interactive) - (forward-line (- (+ org-real--current-offset top 1 org-real-padding-y) - (line-number-at-pos))) - (move-to-column (+ left 1 org-real-padding-x))))))) + (lambda () + (interactive) + (org-real--jump-to-box box))))) (cl-defmethod org-real--create-button-keymap ((box org-real-box)) "Create a keymap for a button in Org Real mode. @@ -1305,19 +1321,6 @@ BOX is the box the button is being made for." ;;;; Private class methods -(cl-defmethod org-real--is-visible ((box org-real-box) &optional calculate) - "Determine if BOX is visible according to `org-real--visibility'. - -If CALCULATE, determine if the box has been expanded manually." - (if calculate - (with-slots (parent) box - (seq-find - (lambda (sibling) (eq sibling box)) - (org-real--get-children parent))) - (with-slots (level) box - (or (= 0 org-real--visibility) - (<= level org-real--visibility))))) - (cl-defmethod org-real--get-children ((box org-real-box) &optional arg) "Get all visible children of BOX. @@ -1484,17 +1487,6 @@ PREV must already exist in PARENT." (org-real--make-instance-helper containers parent box skip-primary) (unless skip-primary (oset box :primary t)))))))) -(cl-defmethod org-real--find-matching ((search-box org-real-box) (world org-real-box)) - "Find a box in WORLD with a matching name as SEARCH-BOX." - (when (slot-boundp search-box :name) - (with-slots ((search-name name)) search-box - (seq-find - (lambda (box) - (and (slot-boundp box :name) - (string= search-name - (with-slots (name) box name)))) - (org-real--expand world))))) - (cl-defmethod org-real--add-matching ((box org-real-box) (match org-real-box)) "Add relatives of BOX to MATCH." (oset match :primary (or (with-slots (primary) match primary) @@ -1816,11 +1808,7 @@ characters if possible." (org-real--get-all children)))) (org-real--flex-adjust parent (org-real--get-world parent))) (org-real-mode-redraw) - (let ((top (org-real--get-top box)) - (left (org-real--get-left box))) - (forward-line (- (+ org-real--current-offset top 1 org-real-padding-y) - (line-number-at-pos))) - (move-to-column (+ left 1 org-real-padding-x))))) + (org-real--jump-to-box box))) ;;;; Utility expressions diff --git a/tests/edge-cases.org b/tests/edge-cases.org index 0d41305..7ba56a1 100644 --- a/tests/edge-cases.org +++ b/tests/edge-cases.org @@ -7,21 +7,21 @@ The 1-0 is above the 1-1 on top of the 1-2. - ┌───────┐ - │ │ - │ 1-0 │ - │ │ - └───────┘ - - ┌───────┐ - │ │ - │ 1-1 │ - │ │ - ┌──┴───────┴──┐ - │ │ - │ 1-2 │ - │ │ - └─────────────┘ + ╭───────╮ + │ │ + │ 1-0 │ + │ │ + ╰───────╯ + + ╭───────╮ + │ │ + │ 1-1 │ + │ │ + ╭──┴───────┴──╮ + │ │ + │ 1-2 │ + │ │ + ╰─────────────╯ #+end_example ** PASS [[real://6-4/6-3?rel=on top of/6-2?rel=on top of/6-1?rel=above][Is above an on top of an on top]] @@ -29,25 +29,25 @@ The 6-1 is above the 6-2 on top of the 6-3 on top of the 6-4. - ┌───────┐ - │ │ - │ 6-1 │ - │ │ - └───────┘ - - ┌───────┐ - │ │ - │ 6-2 │ - │ │ - ┌──┴───────┴──┐ - │ │ - │ 6-3 │ - │ │ - ┌──┴─────────────┴──┐ - │ │ - │ 6-4 │ - │ │ - └───────────────────┘ + ╭───────╮ + │ │ + │ 6-1 │ + │ │ + ╰───────╯ + + ╭───────╮ + │ │ + │ 6-2 │ + │ │ + ╭──┴───────┴──╮ + │ │ + │ 6-3 │ + │ │ + ╭──┴─────────────┴──╮ + │ │ + │ 6-4 │ + │ │ + ╰───────────────────╯ #+end_example ** PASS [[real://7-3/7-2?rel=on top of/7-1?rel=below][Is below an on top]] @@ -55,20 +55,20 @@ The 7-1 is below the 7-2 on top of the 7-3. - ┌───────┐ - │ │ - │ 7-2 │ - │ │ - ┌──┴───────┴──┐ - │ │ - │ 7-3 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 7-1 │ │ - │ │ │ │ - │ └───────┘ │ - └─────────────┘ + ╭───────╮ + │ │ + │ 7-2 │ + │ │ + ╭──┴───────┴──╮ + │ │ + │ 7-3 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 7-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + ╰─────────────╯ #+end_example ** PASS [[real://2-4/2-3?rel=on top of/2-2?rel=on top of/2-1?rel=below][Is below an on top of an on top]] @@ -76,24 +76,24 @@ The 2-1 is below the 2-2 on top of the 2-3 on top of the 2-4. - ┌───────┐ - │ │ - │ 2-2 │ - │ │ - ┌──┴───────┴──┐ - │ │ - │ 2-3 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 2-1 │ │ - │ │ │ │ - │ └───────┘ │ - ┌──┴─────────────┴──┐ - │ │ - │ 2-4 │ - │ │ - └───────────────────┘ + ╭───────╮ + │ │ + │ 2-2 │ + │ │ + ╭──┴───────┴──╮ + │ │ + │ 2-3 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 2-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + ╭──┴─────────────┴──╮ + │ │ + │ 2-4 │ + │ │ + ╰───────────────────╯ #+end_example ** PASS [[real://3-3?rel=in/3-2?rel=in front of/3-1?rel=above][Is above an in front]] @@ -101,21 +101,21 @@ The 3-1 is above the 3-2 in front of the 3-3. - ┌─────────────┐ - │ │ - │ 3-3 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 3-1 │ │ - │ │ │ │ - │ └───────┘ │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 3-2 │ │ - │ │ │ │ - └──┴───────┴──┘ + ╭─────────────╮ + │ │ + │ 3-3 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 3-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 3-2 │ │ + │ │ │ │ + ╰──┴───────┴──╯ #+end_example ** PASS [[real://5-4/5-3?rel=in front of/5-2?rel=in front of/5-1?rel=above][Is above an in front of an in front]] @@ -123,25 +123,25 @@ The 5-1 is above the 5-2 in front of the 5-3 in front of the 5-4. - ┌───────────────────┐ - │ │ - │ 5-4 │ - │ │ - │ ┌─────────────┐ │ - │ │ │ │ - │ │ 5-3 │ │ - │ │ │ │ - │ │ ┌───────┐ │ │ - │ │ │ │ │ │ - │ │ │ 5-1 │ │ │ - │ │ │ │ │ │ - │ │ └───────┘ │ │ - │ │ │ │ - │ │ ┌───────┐ │ │ - │ │ │ │ │ │ - │ │ │ 5-2 │ │ │ - │ │ │ │ │ │ - └──┴──┴───────┴──┴──┘ + ╭───────────────────╮ + │ │ + │ 5-4 │ + │ │ + │ ╭─────────────╮ │ + │ │ │ │ + │ │ 5-3 │ │ + │ │ │ │ + │ │ ╭───────╮ │ │ + │ │ │ │ │ │ + │ │ │ 5-1 │ │ │ + │ │ │ │ │ │ + │ │ ╰───────╯ │ │ + │ │ │ │ + │ │ ╭───────╮ │ │ + │ │ │ │ │ │ + │ │ │ 5-2 │ │ │ + │ │ │ │ │ │ + ╰──┴──┴───────┴──┴──╯ #+end_example ** PASS [[real://4-3/4-2?rel=in front of/4-1?rel=below][Is below an in front]] @@ -149,21 +149,21 @@ The 4-1 is below the 4-2 in front of the 4-3. - ┌─────────────┐ - │ │ - │ 4-3 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 4-2 │ │ - │ │ │ │ - └──┴───────┴──┘ - - ┌───────┐ - │ │ - │ 4-1 │ - │ │ - └───────┘ + ╭─────────────╮ + │ │ + │ 4-3 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 4-2 │ │ + │ │ │ │ + ╰──┴───────┴──╯ + + ╭───────╮ + │ │ + │ 4-1 │ + │ │ + ╰───────╯ #+end_example ** PASS [[real://8-4/8-3?rel=in front of/8-2?rel=in front of/8-1?rel=below][Is below an in front of an in front]] @@ -171,25 +171,25 @@ The 8-1 is below the 8-2 in front of the 8-3 in front of the 8-4. - ┌───────────────────┐ - │ │ - │ 8-4 │ - │ │ - │ ┌─────────────┐ │ - │ │ │ │ - │ │ 8-3 │ │ - │ │ │ │ - │ │ ┌───────┐ │ │ - │ │ │ │ │ │ - │ │ │ 8-2 │ │ │ - │ │ │ │ │ │ - └──┴──┴───────┴──┴──┘ - - ┌───────┐ - │ │ - │ 8-1 │ - │ │ - └───────┘ + ╭───────────────────╮ + │ │ + │ 8-4 │ + │ │ + │ ╭─────────────╮ │ + │ │ │ │ + │ │ 8-3 │ │ + │ │ │ │ + │ │ ╭───────╮ │ │ + │ │ │ │ │ │ + │ │ │ 8-2 │ │ │ + │ │ │ │ │ │ + ╰──┴──┴───────┴──┴──╯ + + ╭───────╮ + │ │ + │ 8-1 │ + │ │ + ╰───────╯ #+end_example * Merging links @@ -200,21 +200,21 @@ #+end_src #+begin_example - ┌─────────┐ - │ │ - │ above │ - │ │ - └─────────┘ - - ┌──────────┐ - │ │ - │ thing1 │ - │ │ - ┌──┴──────────┴──┐ - │ │ - │ thing2 │ - │ │ - └────────────────┘ + ╭─────────╮ + │ │ + │ above │ + │ │ + ╰─────────╯ + + ╭──────────╮ + │ │ + │ thing1 │ + │ │ + ╭──┴──────────┴──╮ + │ │ + │ thing2 │ + │ │ + ╰────────────────╯ #+end_example diff --git a/tests/margin.org b/tests/margin.org new file mode 100644 index 0000000..3fc3edd --- /dev/null +++ b/tests/margin.org @@ -0,0 +1,153 @@ +#+TODO: FAIL | PASS + +* Opening links + +** Margin 0 + :PROPERTIES: + :MARGIN-Y: 0 + :MARGIN-X: 0 + :END: +*** PASS [[real://5-2/5-1?rel=above][above]] + #+begin_example +The 5-1 is above the 5-2. +╭───────╮ +│ │ +│ 5-1 │ +│ │ +╰───────╯ +╭───────╮ +│ │ +│ 5-2 │ +│ │ +╰───────╯ + #+end_example + +*** PASS [[real://6-2/6-1?rel=below][below]] + #+begin_example +The 6-1 is below the 6-2. +╭───────╮ +│ │ +│ 6-2 │ +│ │ +╰───────╯ +╭───────╮ +│ │ +│ 6-1 │ +│ │ +╰───────╯ + #+end_example + +*** PASS [[real://7-2/7-1?rel=to the left of][left]] + #+begin_example +The 7-1 is to the left of the 7-2. +╭───────╮╭───────╮ +│ ││ │ +│ 7-1 ││ 7-2 │ +│ ││ │ +╰───────╯╰───────╯ + #+end_example + +*** PASS [[real://8-2/8-1?rel=to the right of][right]] + #+begin_example +The 8-1 is to the right of the 8-2. +╭───────╮╭───────╮ +│ ││ │ +│ 8-2 ││ 8-1 │ +│ ││ │ +╰───────╯╰───────╯ + #+end_example + +** Margin x: 3, y: 2 + :PROPERTIES: + :MARGIN-Y: 2 + :MARGIN-X: 3 + :END: +*** PASS [[real://1-2/1-1][in]] + #+begin_example + + + The 1-1 is in the 1-2. + + + ╭─────────────╮ + │ │ + │ 1-2 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 1-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + ╰─────────────╯ + #+end_example + +*** PASS [[real://5-2/5-1?rel=above][above]] + #+begin_example + + + The 5-1 is above the 5-2. + + + ╭───────╮ + │ │ + │ 5-1 │ + │ │ + ╰───────╯ + + + ╭───────╮ + │ │ + │ 5-2 │ + │ │ + ╰───────╯ + #+end_example + +*** PASS [[real://6-2/6-1?rel=below][below]] + #+begin_example + + + The 6-1 is below the 6-2. + + + ╭───────╮ + │ │ + │ 6-2 │ + │ │ + ╰───────╯ + + + ╭───────╮ + │ │ + │ 6-1 │ + │ │ + ╰───────╯ + #+end_example + +*** PASS [[real://7-2/7-1?rel=to the left of][left]] + #+begin_example + + + The 7-1 is to the left of the 7-2. + + + ╭───────╮ ╭───────╮ + │ │ │ │ + │ 7-1 │ │ 7-2 │ + │ │ │ │ + ╰───────╯ ╰───────╯ + #+end_example + +*** PASS [[real://8-2/8-1?rel=to the right of][right]] + #+begin_example + + + The 8-1 is to the right of the 8-2. + + + ╭───────╮ ╭───────╮ + │ │ │ │ + │ 8-2 │ │ 8-1 │ + │ │ │ │ + ╰───────╯ ╰───────╯ + #+end_example + diff --git a/tests/padding.org b/tests/padding.org new file mode 100644 index 0000000..a7a05ef --- /dev/null +++ b/tests/padding.org @@ -0,0 +1,300 @@ +#+TODO: FAIL | PASS + +* Opening links + +** Padding 0 + :PROPERTIES: + :PADDING-Y: 0 + :PADDING-X: 0 + :END: +*** PASS [[real://1-2/1-1][in]] + #+begin_example + + The 1-1 is in the 1-2. + + ╭─────╮ + │1-2 │ + │╭───╮│ + ││1-1││ + │╰───╯│ + ╰─────╯ + #+end_example + +*** PASS [[real://2-2/2-1?rel=on][on]] + #+begin_example + + The 2-1 is on the 2-2. + + ╭─────╮ + │2-2 │ + │╭───╮│ + ││2-1││ + │╰───╯│ + ╰─────╯ + #+end_example + +*** PASS [[real://3-2/3-1?rel=behind][behind]] + #+begin_example + + The 3-1 is behind the 3-2. + + ╭─────╮ + │3-2 │ + │╭╌╌╌╮│ + │╎3-1╎│ + │╰╌╌╌╯│ + ╰─────╯ + #+end_example + +*** PASS [[real://4-2/4-1?rel=in front of][in front of]] + #+begin_example + + The 4-1 is in front of the 4-2. + + ╭─────╮ + │4-2 │ + │╭───╮│ + ││4-1││ + ╰┴───┴╯ + #+end_example + +*** PASS [[real://5-2/5-1?rel=above][above]] + #+begin_example + + The 5-1 is above the 5-2. + + ╭───╮ + │5-1│ + ╰───╯ + + ╭───╮ + │5-2│ + ╰───╯ + #+end_example + +*** PASS [[real://6-2/6-1?rel=below][below]] + #+begin_example + + The 6-1 is below the 6-2. + + ╭───╮ + │6-2│ + ╰───╯ + + ╭───╮ + │6-1│ + ╰───╯ + #+end_example + +*** PASS [[real://7-2/7-1?rel=to the left of][left]] + #+begin_example + + The 7-1 is to the left of the 7-2. + + ╭───╮ ╭───╮ + │7-1│ │7-2│ + ╰───╯ ╰───╯ + #+end_example + +*** PASS [[real://8-2/8-1?rel=to the right of][right]] + #+begin_example + + The 8-1 is to the right of the 8-2. + + ╭───╮ ╭───╮ + │8-2│ │8-1│ + ╰───╯ ╰───╯ + #+end_example + +*** PASS [[real://9-2/9-1?rel=on top of][on top]] + #+begin_example + + The 9-1 is on top of the 9-2. + + ╭───╮ + │9-1│ + ╭┴───┴╮ + │9-2 │ + ╰─────╯ + #+end_example + +** Padding x: 3, y: 2 + :PROPERTIES: + :PADDING-Y: 2 + :PADDING-X: 3 + :END: +*** PASS [[real://1-2/1-1][in]] + #+begin_example + + The 1-1 is in the 1-2. + + ╭─────────────────╮ + │ │ + │ │ + │ 1-2 │ + │ │ + │ │ + │ ╭─────────╮ │ + │ │ │ │ + │ │ │ │ + │ │ 1-1 │ │ + │ │ │ │ + │ │ │ │ + │ ╰─────────╯ │ + ╰─────────────────╯ + #+end_example + +*** PASS [[real://2-2/2-1?rel=on][on]] + #+begin_example + + The 2-1 is on the 2-2. + + ╭─────────────────╮ + │ │ + │ │ + │ 2-2 │ + │ │ + │ │ + │ ╭─────────╮ │ + │ │ │ │ + │ │ │ │ + │ │ 2-1 │ │ + │ │ │ │ + │ │ │ │ + │ ╰─────────╯ │ + ╰─────────────────╯ + #+end_example + +*** PASS [[real://3-2/3-1?rel=behind][behind]] + #+begin_example + + The 3-1 is behind the 3-2. + + ╭─────────────────╮ + │ │ + │ │ + │ 3-2 │ + │ │ + │ │ + │ ╭╌╌╌╌╌╌╌╌╌╮ │ + │ ╎ ╎ │ + │ ╎ ╎ │ + │ ╎ 3-1 ╎ │ + │ ╎ ╎ │ + │ ╎ ╎ │ + │ ╰╌╌╌╌╌╌╌╌╌╯ │ + ╰─────────────────╯ + #+end_example + +*** PASS [[real://4-2/4-1?rel=in front of][in front of]] + #+begin_example + + The 4-1 is in front of the 4-2. + + ╭─────────────────╮ + │ │ + │ │ + │ 4-2 │ + │ │ + │ │ + │ ╭─────────╮ │ + │ │ │ │ + │ │ │ │ + │ │ 4-1 │ │ + │ │ │ │ + │ │ │ │ + ╰───┴─────────┴───╯ + #+end_example + +*** PASS [[real://5-2/5-1?rel=above][above]] + #+begin_example + + The 5-1 is above the 5-2. + + ╭─────────╮ + │ │ + │ │ + │ 5-1 │ + │ │ + │ │ + ╰─────────╯ + + ╭─────────╮ + │ │ + │ │ + │ 5-2 │ + │ │ + │ │ + ╰─────────╯ + #+end_example + +*** PASS [[real://6-2/6-1?rel=below][below]] + #+begin_example + + The 6-1 is below the 6-2. + + ╭─────────╮ + │ │ + │ │ + │ 6-2 │ + │ │ + │ │ + ╰─────────╯ + + ╭─────────╮ + │ │ + │ │ + │ 6-1 │ + │ │ + │ │ + ╰─────────╯ + #+end_example + +*** PASS [[real://7-2/7-1?rel=to the left of][left]] + #+begin_example + + The 7-1 is to the left of the 7-2. + + ╭─────────╮ ╭─────────╮ + │ │ │ │ + │ │ │ │ + │ 7-1 │ │ 7-2 │ + │ │ │ │ + │ │ │ │ + ╰─────────╯ ╰─────────╯ + #+end_example + +*** PASS [[real://8-2/8-1?rel=to the right of][right]] + #+begin_example + + The 8-1 is to the right of the 8-2. + + ╭─────────╮ ╭─────────╮ + │ │ │ │ + │ │ │ │ + │ 8-2 │ │ 8-1 │ + │ │ │ │ + │ │ │ │ + ╰─────────╯ ╰─────────╯ + #+end_example + +*** PASS [[real://9-2/9-1?rel=on top of][on top]] + #+begin_example + + The 9-1 is on top of the 9-2. + + ╭─────────╮ + │ │ + │ │ + │ 9-1 │ + │ │ + │ │ + ╭───┴─────────┴───╮ + │ │ + │ │ + │ 9-2 │ + │ │ + │ │ + ╰─────────────────╯ + #+end_example + diff --git a/tests/smoke-test.org b/tests/smoke-test.org index f5ad46e..7fd198e 100644 --- a/tests/smoke-test.org +++ b/tests/smoke-test.org @@ -7,16 +7,16 @@ The 1-1 is in the 1-2. - ┌─────────────┐ - │ │ - │ 1-2 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 1-1 │ │ - │ │ │ │ - │ └───────┘ │ - └─────────────┘ + ╭─────────────╮ + │ │ + │ 1-2 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 1-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + ╰─────────────╯ #+end_example ** PASS [[real://2-2/2-1?rel=on][on]] @@ -24,16 +24,16 @@ The 2-1 is on the 2-2. - ┌─────────────┐ - │ │ - │ 2-2 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 2-1 │ │ - │ │ │ │ - │ └───────┘ │ - └─────────────┘ + ╭─────────────╮ + │ │ + │ 2-2 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 2-1 │ │ + │ │ │ │ + │ ╰───────╯ │ + ╰─────────────╯ #+end_example ** PASS [[real://3-2/3-1?rel=behind][behind]] @@ -41,16 +41,16 @@ The 3-1 is behind the 3-2. - ┌─────────────┐ - │ │ - │ 3-2 │ - │ │ - │ ┌╌╌╌╌╌╌╌┐ │ - │ ╎ ╎ │ - │ ╎ 3-1 ╎ │ - │ ╎ ╎ │ - │ └╌╌╌╌╌╌╌┘ │ - └─────────────┘ + ╭─────────────╮ + │ │ + │ 3-2 │ + │ │ + │ ╭╌╌╌╌╌╌╌╮ │ + │ ╎ ╎ │ + │ ╎ 3-1 ╎ │ + │ ╎ ╎ │ + │ ╰╌╌╌╌╌╌╌╯ │ + ╰─────────────╯ #+end_example ** PASS [[real://4-2/4-1?rel=in front of][in front of]] @@ -58,15 +58,15 @@ The 4-1 is in front of the 4-2. - ┌─────────────┐ - │ │ - │ 4-2 │ - │ │ - │ ┌───────┐ │ - │ │ │ │ - │ │ 4-1 │ │ - │ │ │ │ - └──┴───────┴──┘ + ╭─────────────╮ + │ │ + │ 4-2 │ + │ │ + │ ╭───────╮ │ + │ │ │ │ + │ │ 4-1 │ │ + │ │ │ │ + ╰──┴───────┴──╯ #+end_example ** PASS [[real://5-2/5-1?rel=above][above]] @@ -74,17 +74,17 @@ The 5-1 is above the 5-2. - ┌───────┐ - │ │ - │ 5-1 │ - │ │ - └───────┘ - - ┌───────┐ - │ │ - │ 5-2 │ - │ │ - └───────┘ + ╭───────╮ + │ │ + │ 5-1 │ + │ │ + ╰───────╯ + + ╭───────╮ + │ │ + │ 5-2 │ + │ │ + ╰───────╯ #+end_example ** PASS [[real://6-2/6-1?rel=below][below]] @@ -92,17 +92,17 @@ The 6-1 is below the 6-2. - ┌───────┐ - │ │ - │ 6-2 │ - │ │ - └───────┘ - - ┌───────┐ - │ │ - │ 6-1 │ - │ │ - └───────┘ + ╭───────╮ + │ │ + │ 6-2 │ + │ │ + ╰───────╯ + + ╭───────╮ + │ │ + │ 6-1 │ + │ │ + ╰───────╯ #+end_example @@ -111,11 +111,11 @@ The 7-1 is to the left of the 7-2. - ┌───────┐ ┌───────┐ - │ │ │ │ - │ 7-1 │ │ 7-2 │ - │ │ │ │ - └───────┘ └───────┘ + ╭───────╮ ╭───────╮ + │ │ │ │ + │ 7-1 │ │ 7-2 │ + │ │ │ │ + ╰───────╯ ╰───────╯ #+end_example ** PASS [[real://8-2/8-1?rel=to the right of][right]] @@ -123,11 +123,11 @@ The 8-1 is to the right of the 8-2. - ┌───────┐ ┌───────┐ - │ │ │ │ - │ 8-2 │ │ 8-1 │ - │ │ │ │ - └───────┘ └───────┘ + ╭───────╮ ╭───────╮ + │ │ │ │ + │ 8-2 │ │ 8-1 │ + │ │ │ │ + ╰───────╯ ╰───────╯ #+end_example ** PASS [[real://9-2/9-1?rel=on top of][on top]] @@ -135,13 +135,13 @@ The 9-1 is on top of the 9-2. - ┌───────┐ - │ │ - │ 9-1 │ - │ │ - ┌──┴───────┴──┐ - │ │ - │ 9-2 │ - │ │ - └─────────────┘ + ╭───────╮ + │ │ + │ 9-1 │ + │ │ + ╭──┴───────┴──╮ + │ │ + │ 9-2 │ + │ │ + ╰─────────────╯ #+end_example