markdown-up 1.7.5__tar.gz → 1.8.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown-up
3
- Version: 1.7.5
3
+ Version: 1.8.0
4
4
  Summary: The MarkdownUp launcher
5
5
  Home-page: https://github.com/craigahobbs/markdown-up-py
6
6
  Author: Craig A. Hobbs
@@ -11,7 +11,6 @@ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
14
- Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
@@ -36,11 +35,6 @@ launcher.
36
35
  is a Markdown viewer.
37
36
 
38
37
 
39
- ## Links
40
-
41
- - [Source code](https://github.com/craigahobbs/markdown-up-py)
42
-
43
-
44
38
  ## View Local Markdown Files
45
39
 
46
40
  To view local Markdown files, run the markdown-up command-line application from a terminal prompt:
@@ -12,11 +12,6 @@ launcher.
12
12
  is a Markdown viewer.
13
13
 
14
14
 
15
- ## Links
16
-
17
- - [Source code](https://github.com/craigahobbs/markdown-up-py)
18
-
19
-
20
15
  ## View Local Markdown Files
21
16
 
22
17
  To view local Markdown files, run the markdown-up command-line application from a terminal prompt:
@@ -1,6 +1,6 @@
1
1
  [metadata]
2
2
  name = markdown-up
3
- version = 1.7.5
3
+ version = 1.8.0
4
4
  url = https://github.com/craigahobbs/markdown-up-py
5
5
  author = Craig A. Hobbs
6
6
  author_email = craigahobbs@gmail.com
@@ -14,7 +14,6 @@ classifiers =
14
14
  Intended Audience :: Developers
15
15
  License :: OSI Approved :: MIT License
16
16
  Operating System :: OS Independent
17
- Programming Language :: Python :: 3.8
18
17
  Programming Language :: Python :: 3.9
19
18
  Programming Language :: Python :: 3.10
20
19
  Programming Language :: Python :: 3.11
@@ -33,6 +32,11 @@ install_requires =
33
32
  console_scripts =
34
33
  markdown-up = markdown_up.main:main
35
34
 
35
+ [options.package_data]
36
+ markdown_up =
37
+ static/*.bare
38
+ static/*.html
39
+
36
40
  [egg_info]
37
41
  tag_build =
38
42
  tag_date = 0
File without changes
@@ -6,39 +6,13 @@ The MarkdownUp launcher back-end application
6
6
  """
7
7
 
8
8
  from http import HTTPStatus
9
+ import importlib.resources
9
10
  import os
10
11
  from pathlib import PurePosixPath
11
12
 
12
13
  import chisel
13
14
 
14
15
 
15
- # The map of static file extension to content-type
16
- STATIC_EXT_TO_CONTENT_TYPE = {
17
- '.bare': 'text/plain; charset=utf-8',
18
- '.css': 'text/css',
19
- '.csv': 'text/csv',
20
- '.gif': 'image/gif',
21
- '.htm': 'text/html; charset=utf-8',
22
- '.html': 'text/html; charset=utf-8',
23
- '.jpeg': 'image/jpeg',
24
- '.jpg': 'image/jpeg',
25
- '.js': 'application/javascript',
26
- '.json': 'application/json',
27
- '.markdown': 'text/markdown; charset=utf-8',
28
- '.md': 'text/markdown; charset=utf-8',
29
- '.mds': 'text/plain; charset=utf-8',
30
- '.png': 'image/png',
31
- '.smd': 'text/plain; charset=utf-8',
32
- '.svg': 'image/svg+xml',
33
- '.tif': 'image/tiff',
34
- '.tiff': 'image/tiff',
35
- '.webp': 'image/webp'
36
- }
37
- MARKDOWN_EXTS = ('.md', '.markdown')
38
- HTML_EXTS = ('.html', '.htm')
39
- INDEX_FILES = ('index.html', 'index.htm')
40
-
41
-
42
16
  class MarkdownUpApplication(chisel.Application):
43
17
  """
44
18
  The markdown-up back-end API WSGI application class
@@ -46,6 +20,7 @@ class MarkdownUpApplication(chisel.Application):
46
20
 
47
21
  __slots__ = ('root',)
48
22
 
23
+
49
24
  def __init__(self, root):
50
25
  super().__init__()
51
26
  self.root = root
@@ -54,9 +29,28 @@ class MarkdownUpApplication(chisel.Application):
54
29
  self.add_requests(chisel.create_doc_requests())
55
30
 
56
31
  # Add the markdown-up application
57
- self.add_request(MARKDOWN_UP_HTML)
58
32
  self.add_request(markdown_up_index)
59
33
 
34
+ # Add the markdown-up statics
35
+ self.add_static(
36
+ 'index.html',
37
+ 'text/html; charset=utf-8',
38
+ (('GET', None), ('GET', '/')),
39
+ 'The MarkdownUp index HTML'
40
+ )
41
+ self.add_static(
42
+ 'markdownUpIndex.bare',
43
+ 'text/plain; charset=utf-8',
44
+ (('GET', None),),
45
+ 'The MarkdownUp index application'
46
+ )
47
+
48
+
49
+ def add_static(self, filename, content_type, urls, doc, doc_group='MarkdownUp Statics'):
50
+ with importlib.resources.files('markdown_up.static').joinpath(filename).open('rb') as fh:
51
+ self.add_request(chisel.StaticRequest(filename, fh.read(), content_type, urls, doc, doc_group))
52
+
53
+
60
54
  def __call__(self, environ, start_response):
61
55
  request_method = environ['REQUEST_METHOD']
62
56
  path_info = environ['PATH_INFO']
@@ -105,67 +99,31 @@ class MarkdownUpApplication(chisel.Application):
105
99
  return [content]
106
100
 
107
101
 
108
- MARKDOWN_UP_HTML = chisel.StaticRequest(
109
- 'markdown_up_html',
110
- b'''\
111
- <!DOCTYPE html>
112
- <html lang="en">
113
- <head>
114
- <title>MarkdownUp</title>
115
- <meta charset="UTF-8">
116
- <meta name="description" content="MarkdownUp is a Markdown viewer">
117
- <meta name="viewport" content="width=device-width, initial-scale=1">
118
- <link rel="stylesheet" href="https://craigahobbs.github.io/markdown-up/app.css">
119
-
120
- <!-- Preloads -->
121
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/data.js" as="script">
122
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/library.js" as="script">
123
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/model.js" as="script">
124
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/options.js" as="script">
125
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/parser.js" as="script">
126
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtime.js" as="script">
127
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtimeAsync.js" as="script">
128
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/value.js" as="script">
129
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/element-model/lib/elementModel.js" as="script">
130
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/app.js" as="script">
131
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataTable.js" as="script">
132
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataUtil.js" as="script">
133
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/lineChart.js" as="script">
134
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/script.js" as="script">
135
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/scriptLibrary.js" as="script">
136
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/elements.js" as="script">
137
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/parser.js" as="script">
138
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown-doc/lib/schemaMarkdownDoc.js" as="script">
139
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/encode.js" as="script">
140
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/parser.js" as="script">
141
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schema.js" as="script">
142
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schemaUtil.js" as="script">
143
- <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/typeModel.js" as="script">
144
- <link rel="preload" href="https://craigahobbs.github.io/markdown-up/app.css" as="style">
145
- <link rel="preload" href="https://craigahobbs.github.io/markdown-up/markdown-model/static/markdown-model.css" as="style">
146
- </head>
147
- <body>
148
- </body>
149
- <script type="module">
150
- import {MarkdownUp} from 'https://craigahobbs.github.io/markdown-up/lib/app.js';
151
- const app = new MarkdownUp(window, {
152
- 'markdownText': `\\
153
- ~~~ markdown-script
154
- include 'https://craigahobbs.github.io/markdown-up/launcher/app.mds'
155
-
156
- markdownUpIndex()
157
- ~~~
158
- `
159
- });
160
- app.run();
161
- </script>
162
- </html>
163
- ''',
164
- content_type='text/html; charset=utf-8',
165
- urls=(('GET', '/'),),
166
- doc='The MarkdownUp launcher index application',
167
- doc_group='MarkdownUp'
168
- )
102
+ # The map of static file extension to content-type
103
+ STATIC_EXT_TO_CONTENT_TYPE = {
104
+ '.bare': 'text/plain; charset=utf-8',
105
+ '.css': 'text/css',
106
+ '.csv': 'text/csv',
107
+ '.gif': 'image/gif',
108
+ '.htm': 'text/html; charset=utf-8',
109
+ '.html': 'text/html; charset=utf-8',
110
+ '.jpeg': 'image/jpeg',
111
+ '.jpg': 'image/jpeg',
112
+ '.js': 'application/javascript',
113
+ '.json': 'application/json',
114
+ '.markdown': 'text/markdown; charset=utf-8',
115
+ '.md': 'text/markdown; charset=utf-8',
116
+ '.mds': 'text/plain; charset=utf-8',
117
+ '.png': 'image/png',
118
+ '.smd': 'text/plain; charset=utf-8',
119
+ '.svg': 'image/svg+xml',
120
+ '.tif': 'image/tiff',
121
+ '.tiff': 'image/tiff',
122
+ '.webp': 'image/webp'
123
+ }
124
+ MARKDOWN_EXTS = ('.md', '.markdown')
125
+ HTML_EXTS = ('.html', '.htm')
126
+ INDEX_FILES = ('index.html', 'index.htm')
169
127
 
170
128
 
171
129
  @chisel.action(spec='''\
@@ -0,0 +1,56 @@
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <title>MarkdownUp</title>
5
+ <meta charset="UTF-8">
6
+ <meta name="description" content="MarkdownUp is a Markdown viewer">
7
+ <meta name="viewport" content="width=device-width, initial-scale=1">
8
+ <link rel="stylesheet" href="https://craigahobbs.github.io/markdown-up/app.css">
9
+
10
+ <!-- MarkdownUp Preloads -->
11
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/data.js" as="script">
12
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/library.js" as="script">
13
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/model.js" as="script">
14
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/options.js" as="script">
15
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/parser.js" as="script">
16
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtime.js" as="script">
17
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/runtimeAsync.js" as="script">
18
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/bare-script/lib/value.js" as="script">
19
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/element-model/lib/elementModel.js" as="script">
20
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/app.js" as="script">
21
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataTable.js" as="script">
22
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/dataUtil.js" as="script">
23
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/lineChart.js" as="script">
24
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/script.js" as="script">
25
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/lib/scriptLibrary.js" as="script">
26
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/elements.js" as="script">
27
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/markdown-model/lib/parser.js" as="script">
28
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown-doc/lib/schemaMarkdownDoc.js" as="script">
29
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/encode.js" as="script">
30
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/parser.js" as="script">
31
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schema.js" as="script">
32
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/schemaUtil.js" as="script">
33
+ <link rel="modulepreload" href="https://craigahobbs.github.io/markdown-up/schema-markdown/lib/typeModel.js" as="script">
34
+ <link rel="preload" href="https://craigahobbs.github.io/markdown-up/app.css" as="style">
35
+ <link rel="preload" href="https://craigahobbs.github.io/markdown-up/markdown-model/static/markdown-model.css" as="style">
36
+
37
+ <!-- Application preloads -->
38
+ <link rel="preload" href="https://craigahobbs.github.io/markdown-up/include/args.mds" as="fetch" crossorigin>
39
+ <link rel="preload" href="markdownUpIndex.bare" as="fetch" crossorigin>
40
+ </head>
41
+ <body>
42
+ </body>
43
+ <script type="module">
44
+ import {MarkdownUp} from 'https://craigahobbs.github.io/markdown-up/lib/app.js';
45
+ const app = new MarkdownUp(window, {
46
+ 'markdownText': `\
47
+ ~~~ markdown-script
48
+ include 'markdownUpIndex.bare'
49
+
50
+ markdownUpIndex()
51
+ ~~~
52
+ `
53
+ });
54
+ app.run();
55
+ </script>
56
+ </html>
@@ -0,0 +1,71 @@
1
+ # Licensed under the MIT License
2
+ # https://github.com/craigahobbs/markdown-up/blob/main/LICENSE
3
+
4
+ include <args.mds>
5
+
6
+
7
+ #
8
+ # The MarkdownUp launcher index application main entry point
9
+ #
10
+ async function markdownUpIndex():
11
+ # Parse arguments
12
+ arguments = argsValidate(arrayNew(objectNew('name', 'path')))
13
+ args = argsParse(arguments)
14
+ path = objectGet(args, 'path')
15
+
16
+ # Fetch the index files/directories/parent API
17
+ index_url = 'markdown_up_index' + if(path != null, '?path=' + urlEncodeComponent(path), '')
18
+ index = jsonParse(systemFetch(index_url))
19
+
20
+ # Set the document title
21
+ title = 'MarkdownUp - ' + objectGet(index, 'path')
22
+ documentSetTitle(title)
23
+
24
+ # Menu and title
25
+ parent = objectGet(index, 'parent')
26
+ markdownPrint( \
27
+ if(path == null, 'Root', argsLink(arguments, 'Root', objectNew('path', null))) + ' |', \
28
+ if(path == null, 'Parent', if(parent == null, \
29
+ argsLink(arguments, 'Parent', objectNew('path', null)), \
30
+ argsLink(arguments, 'Parent', objectNew('path', parent)))) + ' |', \
31
+ '[MarkdownUp](https://github.com/craigahobbs/markdown-up#readme)', \
32
+ '', \
33
+ '# ' + markdownEscape(title) \
34
+ )
35
+
36
+ # Render file links
37
+ files = arrayNew()
38
+ markdownFiles = objectGet(index, 'files')
39
+ if markdownFiles != null:
40
+ arrayExtend(files, markdownFiles)
41
+ endif
42
+ if objectHas(index, 'htmlFiles'):
43
+ arrayExtend(files, objectGet(index, 'htmlFiles'))
44
+ endif
45
+ if arrayLength(files):
46
+ markdownPrint('', '## Files')
47
+ for file in arraySort(files):
48
+ fileURL = if(path != null, path + '/', '') + file
49
+ if markdownFiles != null && arrayIndexOf(markdownFiles, file) != -1:
50
+ markdownPrint('', '[' + markdownEscape(file) + '](#url=' + urlEncodeComponent(fileURL, true) + '&var=&' + argsTopHeaderId + ')')
51
+ else:
52
+ markdownPrint('', '[' + markdownEscape(file) + '](' + urlEncode(fileURL, true) + ')')
53
+ endif
54
+ endfor
55
+ endif
56
+
57
+ # Render directory links
58
+ directories = objectGet(index, 'directories')
59
+ if directories != null:
60
+ markdownPrint('', '## Directories')
61
+ for directory in arraySort(directories):
62
+ directoryURL = if(path != null, path + '/', '') + directory
63
+ markdownPrint('', argsLink(arguments, directory, objectNew('path', directoryURL)))
64
+ endfor
65
+ endif
66
+
67
+ # Empty path?
68
+ if !arrayLength(files) && directories == null:
69
+ markdownPrint('', 'No Markdown files or sub-directories found')
70
+ endif
71
+ endfunction
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: markdown-up
3
- Version: 1.7.5
3
+ Version: 1.8.0
4
4
  Summary: The MarkdownUp launcher
5
5
  Home-page: https://github.com/craigahobbs/markdown-up-py
6
6
  Author: Craig A. Hobbs
@@ -11,7 +11,6 @@ Classifier: Development Status :: 5 - Production/Stable
11
11
  Classifier: Intended Audience :: Developers
12
12
  Classifier: License :: OSI Approved :: MIT License
13
13
  Classifier: Operating System :: OS Independent
14
- Classifier: Programming Language :: Python :: 3.8
15
14
  Classifier: Programming Language :: Python :: 3.9
16
15
  Classifier: Programming Language :: Python :: 3.10
17
16
  Classifier: Programming Language :: Python :: 3.11
@@ -36,11 +35,6 @@ launcher.
36
35
  is a Markdown viewer.
37
36
 
38
37
 
39
- ## Links
40
-
41
- - [Source code](https://github.com/craigahobbs/markdown-up-py)
42
-
43
-
44
38
  ## View Local Markdown Files
45
39
 
46
40
  To view local Markdown files, run the markdown-up command-line application from a terminal prompt:
@@ -11,4 +11,6 @@ src/markdown_up.egg-info/SOURCES.txt
11
11
  src/markdown_up.egg-info/dependency_links.txt
12
12
  src/markdown_up.egg-info/entry_points.txt
13
13
  src/markdown_up.egg-info/requires.txt
14
- src/markdown_up.egg-info/top_level.txt
14
+ src/markdown_up.egg-info/top_level.txt
15
+ src/markdown_up/static/index.html
16
+ src/markdown_up/static/markdownUpIndex.bare
@@ -1,2 +0,0 @@
1
- # Licensed under the MIT License
2
- # https://github.com/craigahobbs/markdown-up-py/blob/main/LICENSE
File without changes
File without changes