diff --git a/assets/images/fork-me.png b/assets/images/fork-me.png deleted file mode 100644 index 146ef8a..0000000 Binary files a/assets/images/fork-me.png and /dev/null differ diff --git a/assets/images/logo.jpg b/assets/images/logo.jpg deleted file mode 100644 index 626f6f4..0000000 Binary files a/assets/images/logo.jpg and /dev/null differ diff --git a/example.html b/example.html index 3ce9218..42f12ec 100644 --- a/example.html +++ b/example.html @@ -1,78 +1,88 @@ - Developer's Notes + DNote's Own Notes
-

Developer's Notes

+

DNote's Own Notes

-

CREDIT

+

TEST

+
    +
  1. lib/dnote.rb

      +
    1. + This is a test of an arbitrary label. 4 +
    2. +
  2. +
+

CREDIT

    -
  1. lib/dnote/string.rb

      -
    1. Trans 19
    2. -
    3. Gavin Sinclair 37
    4. -
    5. Gavin Sinclair 50
    6. -
    7. Trans 51
    8. +
    9. lib/dnote/core_ext.rb

        +
      1. + Trans 20 +
      2. +
      3. + Gavin Sinclair 35 +
      4. +
      5. + Gavin Sinclair 46 +
      6. +
      7. + Trans 47 +
    -

    TODO

    +

    TODO

      -
    1. test/cases/notes_case.rb

        -
      1. Do something or another!", 1, "foo.rb" 27
      2. -
      3. Do something or another!", 1, "foo.rb" 34
      4. -
    2. -
    3. lib/dnote/notes.rb

        -
      1. Add ability to read header notes. They often -have a outline format, rather then the single line. 16
      2. -
      3. Play gold with Notes#parse. 73
      4. -
      5. should this be done? 79
      6. -
      7. ruby-1.9.1-p378 reports: `match': invalid byte sequence in UTF-8 134
      8. -
      9. Would to_xoxo be better organized by label and or file? 254
      10. -
    4. -
    5. lib/plugins/syckle/dnote.rb

        -
      1. Should this service be part of the +site+ cycle? 18
      2. -
      3. Is #trial? correct? 79
      4. -
    6. -
    7. work/site.rb

        -
      1. Don't use chdir. 102
      2. -
    8. lib/dnote/format.rb

        -
      1. Need good CSS file. 6
      2. -
      3. Need XSL? 8
      4. +
      5. + Need good CSS file. 12 +
      6. +
      7. + Need XSL? 14 +
    9. -
    -

    TEST

    -
      -
    1. lib/dnote.rb

        -
      1. This is a test of arbitraty labels. 31
      2. -
    2. -
    -

    NOTE

    -
      -
    1. lib/dnote.rb

        -
      1. Toying with the idea of making DNote a class. 6
      2. +
      3. lib/dnote/note.rb

          +
        1. + Add +url+? 70 +
        2. +
        3. + Add +code+? Problem is that xml needs code in CDATA. 71 +
      4. -
      5. lib/dnote/string.rb

          -
        1. This may still need a bit of tweaking. 17
        2. -
      6. -
      7. work/command.rb

          -
        1. If DNote were a class. 139
        2. +
        3. lib/dnote/notes.rb

            +
          1. + Add ability to read header notes. They often +have a outline format, rather then the single line. 20 +
          2. +
          3. + Play golf with Notes#parse. 97 +
          4. +
          5. + should this be done? 103 +
          6. +
          7. + Continue to add comment types. 315 +
          8. +
          9. + Would to_xoxo be better organized by label and or file? 356 +
diff --git a/example.json b/example.json new file mode 100644 index 0000000..57d1e61 --- /dev/null +++ b/example.json @@ -0,0 +1 @@ +[{"label":"TEST","text":"This is a test of an arbitrary label.","file":"lib/dnote.rb","line":4,"code":""},{"label":"CREDIT","text":"Trans","file":"lib/dnote/core_ext.rb","line":20,"code":""},{"label":"CREDIT","text":"Gavin Sinclair","file":"lib/dnote/core_ext.rb","line":35,"code":""},{"label":"CREDIT","text":"Gavin Sinclair","file":"lib/dnote/core_ext.rb","line":46,"code":""},{"label":"CREDIT","text":"Trans","file":"lib/dnote/core_ext.rb","line":47,"code":""},{"label":"TODO","text":"Need good CSS file.","file":"lib/dnote/format.rb","line":12,"code":""},{"label":"TODO","text":"Need XSL?","file":"lib/dnote/format.rb","line":14,"code":""},{"label":"TODO","text":"Add +url+?","file":"lib/dnote/note.rb","line":70,"code":""},{"label":"TODO","text":"Add +code+? Problem is that xml needs code in CDATA.","file":"lib/dnote/note.rb","line":71,"code":""},{"label":"TODO","text":"Add ability to read header notes. They often\nhave a outline format, rather then the single line.","file":"lib/dnote/notes.rb","line":20,"code":""},{"label":"TODO","text":"Play golf with Notes#parse.","file":"lib/dnote/notes.rb","line":97,"code":""},{"label":"TODO","text":"should this be done?","file":"lib/dnote/notes.rb","line":103,"code":""},{"label":"TODO","text":"Continue to add comment types.","file":"lib/dnote/notes.rb","line":315,"code":""},{"label":"TODO","text":"Would to_xoxo be better organized by label and or file?","file":"lib/dnote/notes.rb","line":356,"code":""}] diff --git a/example.md b/example.md new file mode 100644 index 0000000..a04e65b --- /dev/null +++ b/example.md @@ -0,0 +1,42 @@ +Developer's Notes +================= + +TEST +---- + +### file://lib/dnote.rb + +* TEST: This is a test of an arbitrary label. (4) + +CREDIT +------ + +### file://lib/dnote/core_ext.rb + +* CREDIT: Trans (20) +* CREDIT: Gavin Sinclair (35) +* CREDIT: Gavin Sinclair (46) +* CREDIT: Trans (47) + +TODO +---- + +### file://lib/dnote/format.rb + +* TODO: Need good CSS file. (12) +* TODO: Need XSL? (14) + +### file://lib/dnote/note.rb + +* TODO: Add +url+? (70) +* TODO: Add +code+? Problem is that xml needs code in CDATA. (71) + +### file://lib/dnote/notes.rb + +* TODO: Add ability to read header notes. They often +have a outline format, rather then the single line. (20) +* TODO: Play golf with Notes#parse. (97) +* TODO: should this be done? (103) +* TODO: Continue to add comment types. (315) +* TODO: Would to_xoxo be better organized by label and or file? (356) + diff --git a/example.xml b/example.xml index 69a7874..8218a99 100644 --- a/example.xml +++ b/example.xml @@ -1,51 +1,61 @@ - - - - + + + diff --git a/example.yaml b/example.yaml index fa5d043..aa44dbd 100644 --- a/example.yaml +++ b/example.yaml @@ -1,83 +1,73 @@ ---- -- label: NOTE - line: 6 - text: Toying with the idea of making DNote a class. - file: lib/dnote.rb +--- - label: TEST - line: 31 - text: This is a test of arbitraty labels. + text: This is a test of an arbitrary label. file: lib/dnote.rb + line: 4 + code: '' +- label: CREDIT + text: Trans + file: lib/dnote/core_ext.rb + line: 20 + code: '' +- label: CREDIT + text: Gavin Sinclair + file: lib/dnote/core_ext.rb + line: 35 + code: '' +- label: CREDIT + text: Gavin Sinclair + file: lib/dnote/core_ext.rb + line: 46 + code: '' +- label: CREDIT + text: Trans + file: lib/dnote/core_ext.rb + line: 47 + code: '' - label: TODO - line: 6 text: Need good CSS file. file: lib/dnote/format.rb + line: 12 + code: '' - label: TODO - line: 8 text: Need XSL? file: lib/dnote/format.rb + line: 14 + code: '' +- label: TODO + text: Add +url+? + file: lib/dnote/note.rb + line: 70 + code: '' +- label: TODO + text: Add +code+? Problem is that xml needs code in CDATA. + file: lib/dnote/note.rb + line: 71 + code: '' - label: TODO - line: 16 text: |- Add ability to read header notes. They often have a outline format, rather then the single line. file: lib/dnote/notes.rb + line: 20 + code: '' - label: TODO - line: 73 - text: Play gold with Notes#parse. + text: Play golf with Notes#parse. file: lib/dnote/notes.rb + line: 97 + code: '' - label: TODO - line: 79 text: should this be done? file: lib/dnote/notes.rb + line: 103 + code: '' - label: TODO - line: 134 - text: "ruby-1.9.1-p378 reports: `match': invalid byte sequence in UTF-8" + text: Continue to add comment types. file: lib/dnote/notes.rb + line: 315 + code: '' - label: TODO - line: 254 text: Would to_xoxo be better organized by label and or file? file: lib/dnote/notes.rb -- label: NOTE - line: 17 - text: This may still need a bit of tweaking. - file: lib/dnote/string.rb -- label: CREDIT - line: 19 - text: Trans - file: lib/dnote/string.rb -- label: CREDIT - line: 37 - text: Gavin Sinclair - file: lib/dnote/string.rb -- label: CREDIT - line: 50 - text: Gavin Sinclair - file: lib/dnote/string.rb -- label: CREDIT - line: 51 - text: Trans - file: lib/dnote/string.rb -- label: TODO - line: 18 - text: Should this service be part of the +site+ cycle? - file: lib/plugins/syckle/dnote.rb -- label: TODO - line: 79 - text: "Is #trial? correct?" - file: lib/plugins/syckle/dnote.rb -- label: TODO - line: 27 - text: Do something or another!", 1, "foo.rb" - file: test/cases/notes_case.rb -- label: TODO - line: 34 - text: Do something or another!", 1, "foo.rb" - file: test/cases/notes_case.rb -- label: NOTE - line: 139 - text: If DNote were a class. - file: work/command.rb -- label: TODO - line: 102 - text: Don't use chdir. - file: work/site.rb + line: 356 + code: '' diff --git a/index.html b/index.html index 1a129e9..8f2442e 100644 --- a/index.html +++ b/index.html @@ -1,216 +1,407 @@ - - - D'Note + + + + + + D'Note: developer's notes from source code + + + - - - - - - + background: var(--desk); + color: var(--ink); + font-family: Georgia, "Iowan Old Style", "Palatino Linotype", serif; + line-height: var(--line); + } -
-
+ a { color: var(--accent); text-underline-offset: 0.15em; } + a:hover { text-decoration-thickness: 2px; } + a:focus-visible, summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; } -

Developer's take note! All those TODO's and FIXME's floating around - your source code are rotting away. They are trapped, and in desperate need of your attention.

+ code, pre, kbd { + font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace; + font-size: 0.86em; + } -

But not to fret! D'Note will help you liberate them. D'Note will scan your - source code for labeled comments; collect, collate and sort them; and then return them to you in a - format of your choosing. Wunderbar!

+ /* The desk: navigation along the top. */ + .desk { + display: flex; + flex-wrap: wrap; + gap: 0.25rem 1.5rem; + justify-content: center; + padding: 0.9rem 1rem; + font-family: system-ui, sans-serif; + font-size: 0.85rem; + letter-spacing: 0.03em; + } + .desk a { color: var(--desk-text); text-decoration: none; } + .desk a:hover { color: #fff; text-decoration: underline; } + + /* The pad. */ + .pad { + position: relative; + max-width: 52rem; + margin: 0 auto 3rem; + background: + linear-gradient(to right, transparent 3.4rem, var(--margin) 3.4rem, var(--margin) calc(3.4rem + 2px), transparent calc(3.4rem + 2px)), + repeating-linear-gradient(to bottom, transparent 0, transparent calc(var(--line) - 1px), var(--rule) calc(var(--line) - 1px), var(--rule) var(--line)), + var(--paper); + background-position: 0 0, 0 0.45rem, 0 0; + border-radius: 4px; + box-shadow: 0 1px 0 var(--paper-edge), 0 4px 0 -1px var(--paper), 0 5px 0 -1px var(--paper-edge), 0 18px 40px rgba(0, 0, 0, 0.45); + } -

Note Structure

+ /* The binding along the top of the pad. */ + .binding { + height: 3.5rem; + border-radius: 4px 4px 0 0; + background: linear-gradient(#8a2a24, #6d201b); + border-bottom: 3px solid #4d1612; + } -

D'Note scans for the common "LABEL:" pattern (all-caps label followed by a colon) used by many - developers of many languages. To be more specific, for D'Note to recognize a note, it needs to - conform to the following simple set of rules:

+ .sheet { padding: 1.75rem 2rem 3.5rem 4.6rem; } -

1) Notes start with an all-caps label punctuated with a colon, followed by the note's text.

+ header h1 { + margin: 0; + font-size: clamp(3.2rem, 11vw, 6rem); + line-height: 1.05; + letter-spacing: -0.02em; + font-weight: 700; + } + header h1 span { color: var(--accent); } -
-  # LABEL: description ...
-  
+ .tagline { + margin: 0.4rem 0 0; + font-family: system-ui, sans-serif; + font-size: 0.95rem; + color: var(--ink-soft); + } - + h2 { + margin: 3.5rem 0 0.75rem; + font-size: 1.6rem; + line-height: 1.2; + } + h2::before { + content: "ยง"; + position: absolute; + left: 1.15rem; + color: var(--margin); + font-weight: 400; + } -

2) Any note that requires more than one line must remain flush to the left - margin (the margin is set by the first line). This is done because RDoc will mistake - the second line for a <pre> block if it is indented.

+ h3 { margin: 2rem 0 0.25rem; font-size: 1.1rem; } -
-  # LABEL: description ...
-  # continue ...
-  
+ p { margin: 0 0 var(--line); } + ul, ol { margin: 0 0 var(--line); padding-left: 1.3rem; } + li { margin: 0; } -

3) An alternative to the limitation of the last rule is to indent the whole note (making - the whole note a <pre> block with regards to RDoc). Then the text layout is - free-form.

+ p code, li code { + background: rgba(35, 38, 45, 0.08); + padding: 0.1em 0.35em; + border-radius: 3px; + white-space: nowrap; + } -
-  # This is a description of something...
-  #
-  #   LABEL: description ...
-  #          continue ...
-  
+ pre { + margin: 0 0 var(--line); + padding: 1rem 1.2rem; + background: var(--code-bg); + color: var(--code-text); + border-radius: 6px; + line-height: 1.5; + overflow-x: auto; + box-shadow: 0 2px 0 rgba(0, 0, 0, 0.2); + } + pre .c { color: #9aa3b5; } + pre .l { color: #f2b56b; font-weight: 700; } + pre .p { color: #7f8798; user-select: none; } + + .install { + display: inline-block; + margin: 1.75rem 0 0; + padding: 0.7rem 1.2rem; + font-size: 1rem; + } -

That's all there is to it. If I can convince the developers of RDoc to add recognition of - labels, we may eventually be able to relax the flush rule too, which would be very nice.

- -

There is also a command-line option, --no-colon, which deactives the need for - a colon after the note label. However this often produces false positives, so it's use is - discouraged.

+ .rules { counter-reset: rule; list-style: none; padding: 0; } + .rules > li { counter-increment: rule; position: relative; } + .rules > li::before { + content: counter(rule); + position: absolute; + left: -3.1rem; + width: 1.6rem; + text-align: right; + font-family: system-ui, sans-serif; + font-weight: 700; + color: var(--margin); + } -

Generating Notes

+ table { + width: 100%; + border-collapse: collapse; + margin: 0 0 var(--line); + background: rgba(255, 255, 255, 0.45); + font-size: 0.95rem; + } + th, td { padding: 0.35rem 0.6rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--rule); } + th { font-family: system-ui, sans-serif; font-size: 0.8rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-soft); } + .scroll { overflow-x: auto; } + + footer { + max-width: 52rem; + margin: 0 auto; + padding: 0 1rem 3rem; + color: var(--desk-text); + font-family: system-ui, sans-serif; + font-size: 0.85rem; + text-align: center; + } + footer a { color: #fff; } + + @media (max-width: 40rem) { + html { font-size: 16px; } + .pad { margin: 0 0.5rem 2rem; background-position: -1.6rem 0, 0 0.45rem, 0 0; } + .sheet { padding: 1.25rem 1rem 2.5rem 2.6rem; } + h2::before { left: 0.35rem; } + .rules > li::before { left: -2.4rem; } + } -

As you can see the commandline interface is quite straight-forward.

+ @media print { + body { background: #fff; } + .desk { display: none; } + .pad { box-shadow: none; } + } + + + + + + +
+ +
+ +
+

D'Note

+

Developer's notes, extracted from source code. For Ruby, and most other languages.

+
+ +

Developers, take note! All those TODOs and FIXMEs floating around + your source code are rotting away. They are trapped, and in desperate need of your attention.

-
-  USAGE:
+  

But not to fret! D'Note will help you liberate them. D'Note will scan your + source code for labeled comments; collect, collate and sort them; and then return them to you in a + format of your choosing. Wunderbar!

- dnote [OPTIONS] path1 [path2 ...] - - OUTPUT FORMAT: (choose one) - -f, --format NAME select a format [text] - -C, --custom FILE use a custom ERB template - --file shortcut for text/file format - --list shortcut for text/list format +
$ gem install dnote
+ +

Note Structure

+ +

D'Note scans for the common LABEL: pattern, an all-caps label followed by a colon, + used by many developers of many languages. To be more specific, for D'Note to recognize a note + it needs to conform to this simple set of rules:

+ +
    +
  1. +

    Notes start with an all-caps label punctuated with a colon, followed by the note's text.

    +
    # LABEL: description ...
    +
  2. +
  3. +

    Any note that requires more than one line must remain flush to the left + margin (the margin is set by the first line). This is done because RDoc will mistake + the second line for a <pre> block if it is indented.

    +
    # LABEL: description ...
    +# continue ...
    +
  4. +
  5. +

    An alternative to the limitation of the last rule is to indent the whole note (making + the whole note a <pre> block with regards to RDoc). Then the text layout is + free-form.

    +
    # This is a description of something...
    +#
    +#   LABEL: description ...
    +#          continue ...
    +
  6. +
+ +

That's all there is to it. A note ends at a blank comment line or at a line of code. + In the future the parsing may improve to allow page-top outlined notes as well.

+ +

There is also a command-line option, --no-colon, which deactivates the need for + a colon after the note label. However this often produces false positives, so its use is + discouraged.

- OTHER OPTIONS: - -l, --label LABEL labels to collect - --[no-]colon match labels with/without colon suffix - -m, --marker MARK alternative remark marker - -u, --url TEMPLATE url template for line entries (for HTML) - -c, --context INTEGER number of lines of context to display - -x, --exclude PATH exclude file or directory - -i, --ignore NAME ignore file based on any part of pathname - -t, --title TITLE title to use in header - -o, --output PATH save to file or directory - -n, --dryrun do not actually write to disk - --debug debug mode - - COMMAND OPTIONS: - -T, --templates list available format templates - -h, --help show this help information -
+

Tags

+ +

A note can also be written as a tag, in the manner of + YARD. A tag needs no colon.

+ +
# @TODO description ...
+#   continue ...
+# @return [String] not part of the note
+ +
+ + + + + + + + + +
Written asCollected?
@TODO, @WHATEVERAlways. A tag in capitals is a note.
@todo, @fixme, @optimize, @think, @deprecateYes. The usual labels count in lower case too, so YARD's own @todo is picked up.
@param, @return, @noteNo. These are documentation. Ask by name to collect one: --label NOTE.
+
-

There are a variety of formats are available, here are examples of some of the - XML, HTML and YAML - formats. You can get a list of all available format templates using the -T option.

+

A tag note ends at the next tag, as well as at a blank comment line or a line of code. + To turn tags off, use --no-tags.

+ +

YARD itself warns of a tag it doesn't know, such as @FIXME. To have YARD + accept one, name it in .yardopts:

+ +
--tag FIXME:"Fix Me"
+--hide-tag FIXME
+ +

Generating Notes

+ +

As you can see the command-line interface is quite straightforward.

+ +
USAGE:
+  dnote [OPTIONS] path1 [path2 ...]
+
+OUTPUT FORMAT: (choose one)
+    -f, --format NAME                select a format [text]
+    -C, --custom FILE                use a custom ERB template
+        --file                       shortcut for text/file format
+        --list                       shortcut for text/list format
+
+OTHER OPTIONS:
+    -l, --label LABEL                labels to collect
+        --[no-]colon                 match labels with/without colon suffix
+        --[no-]tags                  match labels written as tags, e.g. @TODO [yes]
+    -m, --marker MARK                alternative remark marker
+    -u, --url TEMPLATE               url template for line entries (for HTML)
+    -c, --context INTEGER            number of lines of context to display
+    -x, --exclude PATH               exclude file or directory
+    -i, --ignore NAME                ignore file based on any part of pathname
+    -t, --title TITLE                title to use in header
+    -o, --output PATH                save to file or directory
+    -n, --dryrun                     do not actually write to disk
+        --debug                      debug mode
+
+COMMAND OPTIONS:
+    -T, --templates                  list available format templates
+    -h, --help                       show this help information
+ +

The default path is **/*.rb and the default format is -f text. + A path that is a directory takes in everything below it. The comment marker is chosen by + a file's extension; use --marker for any other.

+ +

Here are some of D'Note's own notes:

+ +
$ dnote -l TODO lib/dnote/format.rb lib/dnote/note.rb
+Developer's Notes
+
+TODO
+
+   1. Need good CSS file. (lib/dnote/format.rb:12)
+   2. Need XSL? (lib/dnote/format.rb:14)
+   3. Add +url+? (lib/dnote/note.rb:70)
+   4. Add +code+? Problem is that xml needs code in CDATA. (lib/dnote/note.rb:71)
+
+(4 TODOs)
+ +

Formats

+ +

A variety of formats are available. Here is D'Note's own source in a few of them: + HTML, Markdown, + XML, YAML and + JSON.

+ +
+ + + + + + + + + + + +
FormatWhat you get
textPlain text, the default.
md, rdocMarkdown or RDoc, ready to add to your documentation.
htmlA page of its own. Give --url to link each note to its line.
xml, json, yamlData, for other tools.
soap, xoxoNeed the soap4r-ng and xoxo gems, which aren't installed with D'Note.
+
-

The default path is **/*.rb and the default format -f text. - Here is an example of DNote's own notes in -f rdoc format:

+

Each arranges the notes by label and then by file. Add /file, + /label or /list for another arrangement, as in + -f md/list. The -T option lists them all.

-
-  = Development Notes
+  

For anything else, write an ERB template and pass it with --custom. + It has notes and title to work with.

- == TODO +

Rake Task

- === file://lib/dnote/notes.rb +
require 'dnote/rake/dnotetask'
 
-  * TODO: Add ability to read header notes. They often
-  have a outline format, rather then the single line. (19)
-  * TODO: Need CSS? (22)
-  * TODO: Need XSL? (24)
+DNote::RakeTask.new do |t|
+  t.files   = 'lib/**/*.rb'
+  t.formats = ['html', 'md']
+  t.output  = 'doc/notes'
+end
- === file://plug/syckle/services/dnote.rb +

This defines a dnote task, which writes doc/notes/notes.html + and doc/notes/notes.md, and a dnote:clobber task that removes them.

- * TODO: Should this service be part of the +site+ cycle? (18) +

With YARD

- (4 TODOs) -
+

To add the notes to YARD documentation, write them to a file and list it in + .yardopts with the other extra files.

-

In the future the parsing may imnprove to allow page-top outlined notes as well.

+
$ dnote -f md -o NOTES.md
-
- - - -
- -
- -
- - -
- - - + + + + +