@@ -270,58 +270,58 @@ resources if point is under a heading that declares an ontology."
270
270
(defun unprefix-uri (puri abbrev-alist )
271
271
" Replace prefix in puri with full form from abbrev-alist, if there's a match."
272
272
(if (eq abbrev-alist nil ) puri
273
- (if (string-match puri-re puri)
274
- (let* ((this-prefix (match-string-no-properties 1 puri))
275
- (this-localname (match-string-no-properties 2 puri))
276
- (this-ns (cdr (assoc this-prefix abbrev-alist))))
277
- (if this-ns
278
- (concat " <" this-ns this-localname " >" )
279
- puri))
280
- puri)))
273
+ (if (string-match puri-re puri)
274
+ (let* ((this-prefix (match-string-no-properties 1 puri))
275
+ (this-localname (match-string-no-properties 2 puri))
276
+ (this-ns (cdr (assoc this-prefix abbrev-alist))))
277
+ (if this-ns
278
+ (concat " <" this-ns this-localname " >" )
279
+ puri))
280
+ puri)))
281
281
282
282
(defun annotation-string-or-uri (str )
283
- " str is wanted as an annotation value in Manchester Syntax. Expand uri, or return number, or wrap in quotes."
284
- ; maybe this entry contains string representation of meta-annotations, remove them
285
- (setq str (replace-regexp-in-string " - [^ ]+ ::.*$" " " str))
286
- ; ; maybe there's macros in the string, expand them
287
- (if (string-match " {{{.+}}}" str)
288
- (let ((omt org-macro-templates))
289
- (with-temp-buffer (org-mode )
290
- (insert str) (org-macro-replace-all omt)
291
- (setq str (buffer-string )))))
292
- (cond (; a number -- return the string
293
- (string-match " ^[[:digit:]]+[.]?[[:digit:]]*$" str)
294
- (concat " " str))
295
- (; a bare URI, which org-mode wraps in double brackets -- wrap in angles
296
- (string-match " ^[[][[]\\ (https?[^ ]*\\ )[]][]]$" str)
297
- (concat " <" (match-string 1 str) " >" ))
298
- (; a bare URI, but no double brackets -- wrap in angles
299
- (string-match " ^\\ (https?[^ ]*\\ )$" str)
300
- (concat " <" (match-string 1 str) " >" ))
301
- (; a bare URI, in angles
302
- (string-match " ^\\ (<https?[^ ]*>\\ )$" str)
303
- (concat " " (match-string 1 str)))
304
- (; true -- make it an explicit boolean
305
- (string-match " true" str) " \" true\" ^^xsd:boolean" )
306
- (; false -- make it an explicit boolean
307
- (string-match " false" str) " \" false\" ^^xsd:boolean" )
308
- (; string with datatype -- return unchanged
309
- (string-match " ^\" .*\" ^^[-_[:alnum:]]*:[-_[:alnum:]]+$" str)
310
- (concat " " str))
311
- (; not a puri -- normal string, wrap in quotes
312
- (equal str (unprefix-uri str org-link-abbrev-alist-local))
313
- ; ; if a language tag @en is present, return unchanged
314
- (if (string-match " \" \\ (.*\n \\ )*.*\" @[a-z]+" str)
315
- (concat " " str)
316
- ; ; escape all quotes with \", note this gives invalid results if some are already escaped
317
- (concat " \" " (replace-regexp-in-string " \" " " \\\\ \" " str) " \" " )))
318
- (; else, a puri -- wrap in angles
319
- t (concat " " (unprefix-uri str org-link-abbrev-alist-local))))
283
+ " str is wanted as an annotation value in Manchester Syntax. Expand uri, or return number, or wrap in quotes."
284
+ ; maybe this entry contains string representation of meta-annotations, remove them
285
+ (setq str (replace-regexp-in-string " - [^ ]+ ::.*$" " " str))
286
+ ; ; maybe there's macros in the string, expand them
287
+ (if (string-match " {{{.+}}}" str)
288
+ (let ((omt org-macro-templates))
289
+ (with-temp-buffer (org-mode )
290
+ (insert str) (org-macro-replace-all omt)
291
+ (setq str (buffer-string )))))
292
+ (cond (; a number -- return the string
293
+ (string-match " ^[[:digit:]]+[.]?[[:digit:]]*$" str)
294
+ (concat " " str))
295
+ (; a bare URI, which org-mode wraps in double brackets -- wrap in angles
296
+ (string-match " ^[[][[]\\ (https?[^ ]*\\ )[]][]]$" str)
297
+ (concat " <" (match-string 1 str) " >" ))
298
+ (; a bare URI, but no double brackets -- wrap in angles
299
+ (string-match " ^\\ (https?[^ ]*\\ )$" str)
300
+ (concat " <" (match-string 1 str) " >" ))
301
+ (; a bare URI, in angles
302
+ (string-match " ^\\ (<https?[^ ]*>\\ )$" str)
303
+ (concat " " (match-string 1 str)))
304
+ (; true -- make it an explicit boolean
305
+ (string-match " true" str) " \" true\" ^^xsd:boolean" )
306
+ (; false -- make it an explicit boolean
307
+ (string-match " false" str) " \" false\" ^^xsd:boolean" )
308
+ (; string with datatype -- return unchanged
309
+ (string-match " ^\" .*\" ^^[-_[:alnum:]]*:[-_[:alnum:]]+$" str)
310
+ (concat " " str))
311
+ (; not a puri -- normal string, wrap in quotes
312
+ (equal str (unprefix-uri str org-link-abbrev-alist-local))
313
+ ; ; if a language tag @en is present, return unchanged
314
+ (if (string-match " \" \\ (.*\n \\ )*.*\" @[a-z]+" str)
315
+ (concat " " str)
316
+ ; ; escape all quotes with \", note this gives invalid results if some are already escaped
317
+ (concat " \" " (replace-regexp-in-string " \" " " \\\\ \" " str) " \" " )))
318
+ (; else, a puri -- wrap in angles
319
+ t (concat " " (unprefix-uri str org-link-abbrev-alist-local) ))))
320
320
321
321
(defun omn-restriction-string (str )
322
- " str is wanted as OMN value. Strip any meta-annotations. Otherwise return unchanged."
323
- (setq str (replace-regexp-in-string " - [^ ]+ ::.*$" " " str))
324
- str)
322
+ " str is wanted as OMN value. Strip any meta-annotations. Otherwise return unchanged."
323
+ (setq str (replace-regexp-in-string " - [^ ]+ ::.*$" " " str))
324
+ str)
325
325
; ; defun-puri ends here
326
326
327
327
; ; [[file:../elot-defs.org::defun-resource-headings][defun-resource-headings]]
@@ -742,17 +742,17 @@ to ELOT default image (sub)directory. Return output file name."
742
742
743
743
; ; [[file:../elot-defs.org::*ELOT document header][ELOT document header:1]]
744
744
(tempo-define-template " elot-doc-header"
745
- '(" # -*- eval: (load-library \" elot-defaults\" ) -*-" > n
746
- " #+title: " (p " Document title: " doctitle) > n
747
- " #+subtitle: An OWL ontology" > n
748
- " #+author: " (p " Author name: " authname) > n
749
- " #+date: WIP (version of " (format-time-string " %Y-%m-%d %H:%M" ) " )" > n
750
- " #+call: theme-readtheorg()" n n
751
- (progn (load-library " elot-defaults" ) (message " Loaded ELOT " ) " " )
752
- )
753
- " <odh"
754
- " ELOT document header"
755
- 'org-tempo-tags )
745
+ '(" # -*- eval: (load-library \" elot-defaults\" ) -*-" > n
746
+ " #+title: " (p " Document title: " doctitle) > n
747
+ " #+subtitle: An OWL ontology" > n
748
+ " #+author: " (p " Author name: " authname) > n
749
+ " #+date: WIP (version of " (format-time-string " %Y-%m-%d %H:%M" ) " )" > n
750
+ " #+call: theme-readtheorg()" n n
751
+ (progn (load-library " elot-defaults" ) (message " Loaded ELOT " ) " " )
752
+ )
753
+ " <odh"
754
+ " ELOT document header"
755
+ 'org-tempo-tags )
756
756
; ; ELOT document header:1 ends here
757
757
758
758
; ; [[file:../elot-defs.org::*ELOT ontology skeleton][ELOT ontology skeleton:1]]
0 commit comments