(est-uri-decode-feature-name): New function.
authorMORIOKA Tomohiko <tomo.git@chise.org>
Thu, 11 Feb 2021 15:56:52 +0000 (00:56 +0900)
committerMORIOKA Tomohiko <tomo.git@chise.org>
Fri, 19 Feb 2021 02:29:00 +0000 (11:29 +0900)
chiset-common.el

index de5f723..4d147f2 100644 (file)
                     (t (char-to-string c))))
             feature ""))
 
+(defun est-uri-decode-feature-name (uri-feature)
+  (let (feature)
+    (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er))
+    (cond
+     ((string-match "^from\\." uri-feature)
+      (intern (format "<-%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^to\\." uri-feature)
+      (intern (format "->%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^meta\\." uri-feature)
+      (intern (format "*%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^rep\\." uri-feature)
+      (intern (format "=%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^rep[2i]\\." uri-feature)
+      (intern (format "===%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^g\\." uri-feature)
+      (intern (format "=>>%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^g[i2]\\." uri-feature)
+      (intern (format "==%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^gi\\([0-9]+\\)\\." uri-feature)
+      (intern (format "=>>%s%s"
+                     (make-string (string-to-int
+                                   (match-string 1 uri-feature))
+                                  ?>)
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^o\\." uri-feature)
+      (intern (format "=+>%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^a\\." uri-feature)
+      (intern (format "=>%s"
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     ((string-match "^a\\([0-9]+\\)\\." uri-feature)
+      (intern (format "%s>%s"
+                     (make-string (string-to-int
+                                   (match-string 1 uri-feature))
+                                  ?=)
+                     (est-uri-decode-feature-name-body
+                      (substring uri-feature (match-end 0)))))
+      )
+     (t
+      (intern (est-uri-decode-feature-name-body uri-feature))
+      ))))
+
 (defun www-uri-decode-feature-name (uri-feature)
   (let (feature)
     (setq uri-feature (decode-uri-string uri-feature 'utf-8-mcs-er))