git: 4cb922f185 - main - Update nano config for adoc files

Muhammad Moinur Rahman <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
The branch main has been updated by bofh (ports committer):

URL: https://cgit.FreeBSD.org/doc/commit/?id=4cb922f1851bea57d264724cc5a81d5b3b6fcdfa

commit 4cb922f1851bea57d264724cc5a81d5b3b6fcdfa
Author:     Muhammad Moinur Rahman <[email protected]>
AuthorDate: 2022-06-26 22:55:52 +0000
Commit:     Muhammad Moinur Rahman <[email protected]>
CommitDate: 2022-06-26 22:55:52 +0000

    Update nano config for adoc files
    
    en/books/fdp-primer/book/#editor-config-nano
    
    section still refers to the old xml syntax. This patch updates the
    config to support adoc documents. Additionally:
    - The syntax highlight is collected from different locations in the web
    - Remove line-wrapping related stuffs as in ASCIIDOC we can have longer
      lines as there is a rule "one sentence per line".
    
    PR:             264899
    Obtained from:  crees
---
 .../en/books/fdp-primer/editor-config/_index.adoc  | 53 +++++++++++++++++-----
 1 file changed, 41 insertions(+), 12 deletions(-)

diff --git a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
index 3c865efb2b..d034d87737 100644
--- a/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
+++ b/documentation/content/en/books/fdp-primer/editor-config/_index.adoc
@@ -191,17 +191,48 @@ Install from package:editors/nano[] or package:editors/nano-devel[].
 [[editor-config-nano-config]]
 === Configuration
 
-Copy the sample XML syntax highlight file to the user's home directory:
-
-[source,shell]
-....
-% cp /usr/local/share/nano/xml.nanorc ~/.nanorc
-....
-
-Use an editor to replace the lines in the [.filename]#~/.nanorc# `syntax "xml"` block with these rules:
+Currently there is no adoc/asciidoc syntax highlight file with nano distribution. So let's create one from scratch and use an editor to create new file or add lines in the [.filename]#~/.nanorc# with these contents:
 
 ....
-syntax "xml" "\.([jrs]html?|xml|xslt?)$"
+syntax "asciidoc" "\.(adoc|asc|asciidoc)$"
+# main header
+color red "^====+$"
+# h1
+color red "^==[[:space:]].*$"
+color red "^----+$"
+# h2
+color magenta "^===[[:space:]].*$"
+color magenta "^~~~~+$"
+# h4
+color green "^====[[:space:]].*$"
+color green "^\^\^\^\^+$"
+# h5
+color brightblue "^=====[[:space:]].*$"
+color brightblue "^\+\+\+\++$"
+# attributes
+color brightgreen ":.*:"
+color brightred "\{[a-z0-9]*\}"
+color red "\\\{[a-z0-9]*\}"
+color red "\+\+\+\{[a-z0-9]*\}\+\+\+"
+# Paragraph Title
+color yellow "^\..*$"
+# source
+color magenta "^\[(source,.+|NOTE|TIP|IMPORTANT|WARNING|CAUTION)\]"
+# Other markup
+color yellow ".*[[:space:]]\+$"
+color yellow "_[^_]+_"
+color yellow "\*[^\*]+\*"
+color yellow "\+[^\+]+\+"
+color yellow "`[^`]+`"
+color yellow "\^[^\^]+\^"
+color yellow "~[^~]+~"
+color yellow "'[^']+'"
+color cyan "`{1,2}[^']+'{1,2}"
+# bullets
+color brightmagenta "^[[:space:]]*[\*\.-]{1,5}[[:space:]]"
+# anchors
+color brightwhite "\[\[.*\]\]"
+color brightwhite "<<.*>>"
 # trailing whitespace
 color ,blue "[[:space:]]+$"
 # multiples of eight spaces at the start a line
@@ -211,8 +242,6 @@ color ,blue "^([TAB]*[ ]{8})+"
 color ,yellow "( )+TAB"
 # highlight indents that have an odd number of spaces
 color ,red "^(([ ]{2})+|(TAB+))*[ ]{1}[^ ]{1}"
-# lines longer than 70 characters
-color ,yellow "^(.{71})|(TAB.{63})|(TAB{2}.{55})|(TAB{3}.{47}).+$"
 ....
 
 Process the file to create embedded tabs:
@@ -229,7 +258,7 @@ Specify additional helpful options when running the editor:
 
 [source,shell]
 ....
-% nano -AKipwz -r 70 -T8 _index.adoc
+% nano -AKipwz -T8 _index.adoc
 ....
 
 Users of man:csh[1] can define an alias in [.filename]#~/.cshrc# to automate these options:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.