# -*- coding: utf-8 -*-
r""" tkAskString.py uses TK to ask the user for a string & prints it out
Usage: ./tkAskString.py
Sample: ./tkAskString.py
see:
1. ["Example 2" - Python tkinter.simpledialog.askstring() Examples](https://www.programcreek.com/python/example/100669/tkinter.simpledialog.askstring)
2. [How do I get rid of Python Tkinter root window?](https://stackoverflow.com/questions/1406145/how-do-i-get-rid-of-python-tkinter-root-window)
3. [Tkinter Dialogs (Python3.10)](https://docs.python.org/3/library/dialog.html)
4. google: tkinter simpledialog set width | tkinter simpledialog keyword arguments
5. ["add extra tabs at the end of your prompt"](https://stackoverflow.com/a/69396488/601770)
"""
import tkinter as tk
from tkinter import simpledialog
# root = tk.Tk()
def main():
root = tk.Tk()
root.withdraw()
uname = simpledialog.askstring("My Title", "Enter username:\t\t\t") # Tabs make it wide as i want
print(uname)
return uname
if __name__ == "__main__":
main()
Recent Updates
Python Main NUM_ARGS = 1
N.B. Replace ‘example’ with ‘myFileNameWITHOUT.py’ creates a RUNNING Python Program.
# -*- coding: utf-8 -*-
r"""example.py DoesSomethingTo INFILEPATH (FILE CONTENTS DESCRIPTION) Producing FILL_IN_HERE
Usage: ./example.py INFILENAME
Sample: ./example.py myInFileName
"""
import sys, os, fnmatch, shutil, json
def example(infilename):
indirpath = 'outPDFparseJSON'
infilepath = os.path.join(indirpath, infilename)
infilename_root, infilename_ext = os.path.splitext(infilename)
print()
print (infilepath)
print (indirpath)
print (infilename)
print (infilename_root)
print (infilename_ext)
outdirpath = 'outPyObjList'
outfilename = infilename_root + '_filled' + infilename_ext
outfilepath = os.path.join(indirpath, outfilename)
print(outfilepath)
NUM_ARGS = 1
def main():
args = sys.argv[1:]
if len(args) != NUM_ARGS or "-h" in args or "--help" in args:
print (__doc__)
sys.exit(2)
example(args[0])
if __name__ == '__main__':
main()
timeStampDelta.py
# -*- coding: utf-8 -*-
""" timeStampDelta.py
Copies datetime deltas to clipboard each time user presses enter
"""
import win32clipboard
from datetime import datetime, timedelta
def main():
""" ["Code #3:" Python | datetime.timedelta() function](https://www.geeksforgeeks.org/python-datetime-timedelta-function/) """
dt0 = datetime.now()
print ("dt0 = %s\n Hit ENTER to UPDATE \nHit q & press enter to quit!\n"%(dt0))
while True:
instr = input("\n")
# tdelta = time.time() - t0
dtn = datetime.now()
tdelta = dtn - dt0
if instr.startswith('q'): break
outStr = "dtn = %s tdelta = %s"%(dtn,tdelta)
to_clipboard(outStr)
print(outStr)
def to_clipboard(txt):
""" https://stackoverflow.com/a/68563250/601770 """
win32clipboard.OpenClipboard()
win32clipboard.EmptyClipboard()
win32clipboard.SetClipboardText(txt)
win32clipboard.CloseClipboard()
if __name__ == '__main__':
main()
lxml insights
posted again because WordPress is BBBBBaddddd! at posting code!
I GIVE UP!!! I needto find someplace else to post code!
I am VERY SAD!
# "wordpress.com" "posting source code" "2021" - Google Search # https://wordpress.com/tag/programming # wordpress.com >> editor >> Block >> [HTML, HTML] import sys, lxml.html, lxml.cssselect # For more insights see [The lxml.etree Tutorial](https://lxml.de/tutorial.html) def main(): htmltree = lxml.html.fromstring(html_fragment) # type(htmltree) => lxml.html.HtmlElement # There is no element.text() function INSTEAD lxml.html.tostring(element) print(lxml.html.tostring(htmltree)) # => b'<div><div class="chart_header">\n ...' # lxml Converts the tree ===> to lists of lists # [Elements are lists](lxml.de/tutorial.html#elements-are-lists) print(len(htmltree)) # 3 print(len(htmltree[0])) # 3 print(len(htmltree[1])) # 4 print(len(htmltree[1][0])) # 0 print(lxml.html.tostring(htmltree[1][0])) # b'<div class="chart_tabletitle1">CPU</div> ' print(lxml.html.tostring(htmltree[1][1])) # b'<div class="chart_tabletitle2">CPU Value (Mark/Price)</div> ' print(lxml.html.tostring(htmltree[1][2])) # b'<div class="chart_tabletitle4">CPU Mark</div> ' print(lxml.html.tostring(htmltree[1][3])) # b'<div class="chart_tabletitle3">Price (USD)</div> ' # [Elements carry attributes as a dict](https://lxml.de/tutorial.html#elements-carry-attributes-as-a-dict) print(htmltree[1][2].attrib['class']) # chart_tabletitle4 print(htmltree[1][3].attrib['class']) # chart_tabletitle3 html_fragment = ''' <!-- at about line 2030 in view-source:https://www.cpubenchmark.net/high_end_cpus.html --> <div class="chart_header"> <div class="chart_title">PassMark - CPU Mark</div> <div class="chart_subtitle">High End CPUs</div> <div class="chart_subtitle" style="font-size: small;">Updated 31st of May 2021</div> </div> <div class="chart_subheader"> <div class="chart_tabletitle1">CPU</div> <div class="chart_tabletitle2">CPU Value (Mark/Price)</div> <div class="chart_tabletitle4">CPU Mark</div> <div class="chart_tabletitle3">Price (USD)</div> </div> <div class="chart_body"> <ul class="chartlist"> <li id="pk4207"><span class="more_details" onclick="p(event, '87,767', 1, 12, 64, 2, 'NA');"><a class="name" href="cpu.php?cpu=AMD+EPYC+7763&id=4207"></a></span><a href="cpu.php?cpu=AMD+EPYC+7763&id=4207"><span class="prdname">AMD EPYC 7763</span><div><span class="index pink" style="width: 0%">(0%)</span></div><span class="count">NA</span><span class="mark-neww">87,767</span><span class="price-neww">NA</span></a></li> <li id="pk3837"><span class="more_details" onclick="p(event, '86,096', 2, 19, 64, 2, '$5,489.99');"><a class="name" href="cpu.php?cpu=AMD+Ryzen+Threadripper+PRO+3995WX&id=3837"></a></span><a href="cpu.php?cpu=AMD+Ryzen+Threadripper+PRO+3995WX&id=3837"><span class="prdname">AMD Ryzen Threadripper PRO 3995WX</span><div><span class="index yellow" style="width: 46.5%">(46.5%)</span></div><span class="count">15.7</span><span class="mark-neww">86,096</span><span class="price-neww">$5,489.99</span></a></li> <li id="pk4206"><span class="more_details" onclick="p(event, '85,887', 3, 16, 64, 2, 'NA');"><a class="name" href="cpu.php?cpu=AMD+EPYC+7713&id=4206"></a></span><a href="cpu.php?cpu=AMD+EPYC+7713&id=4206"><span class="prdname">AMD EPYC 7713</span><div><span class="index green" style="width: 0%">(0%)</span></div><span class="count">NA</span><span class="mark-neww">85,887</span><span class="price-neww">NA</span></a></li> <li id="pk3674"><span class="more_details" onclick="p(event, '81,206', 4, 112, 64, 2, '$5,729.00*');"><a class="name" href="cpu.php?cpu=AMD+Ryzen+Threadripper+3990X&id=3674"></a></span><a href="cpu.php?cpu=AMD+Ryzen+Threadripper+3990X&id=3674"><span class="prdname">AMD Ryzen Threadripper 3990X</span><div><span class="index light-purple" style="width: 44.8%">(44.8%)</span></div><span class="count">14.2</span><span class="mark-neww">81,206</span><span class="price-neww">$5,729.00*</span></a></li> <li id="pk4205"><span class="more_details" onclick="p(event, '77,101', 5, 3, 48, 2, 'NA');"><a class="name" href="cpu.php?cpu=AMD+EPYC+7643&id=4205"></a></span><a href="cpu.php?cpu=AMD+EPYC+7643&id=4205"><span class="prdname">AMD EPYC 7643</span><div><span class="index red" style="width: 0%">(0%)</span></div><span class="count">NA</span><span class="mark-neww">77,101</span><span class="price-neww">NA</span></a></li> <li id="pk3719"><span class="more_details" onclick="p(event, '71,686', 6, 14, 64, 2, '$8,499.00');"><a class="name" href="cpu.php?cpu=AMD+EPYC+7702&id=3719"></a></span><a href="cpu.php?cpu=AMD+EPYC+7702&id=3719"><span class="prdname">AMD EPYC 7702</span><div><span class="index turquoise" style="width: 36.0%">(36.0%)</span></div><span class="count">8.4</span><span class="mark-neww">71,686</span><span class="price-neww">$8,499.00</span></a></li> <li id="pk3555"><span class="more_details" onclick="p(event, '68,213', 7, 2, 64, 2, '$4,650.00*');"><a class="name" href="cpu.php?cpu=AMD+EPYC+7702P&id=3555"></a></span><a href="cpu.php?cpu=AMD+EPYC+7702P&id=3555"><span class="prdname">AMD EPYC 7702P</span><div><span class="index orange" style="width: 45.4%">(45.4%)</span></div><span class="count">14.7</span><span class="mark-neww">68,213</span><span class="price-neww">$4,650.00*</span></a></li> </ul> ''' if __name__ == '__main__': main()
Simple Python CLI
# see https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/ # -*- coding: utf-8 -*- from jsnippets import snippets CUR_SNIP_IX = 0; CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX] def main(): while True: cmd = (input ('?&gt; ')).lower() if cmd == 'exit': break elif cmd == 'print': printCurrentSnippet() elif cmd == 'printa': printAllSnippets() elif cmd == 'next': bumpCUR_SNIP_IX() elif cmd == 'zero': zeroOutCUR_SNIP_IX() def zeroOutCUR_SNIP_IX(): global CUR_SNIP_IX, CUR_SNIP_KEY CUR_SNIP_IX = 0; CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX] def bumpCUR_SNIP_IX(): global CUR_SNIP_IX, CUR_SNIP_KEY CUR_SNIP_IX = ( (CUR_SNIP_IX + 1)%(len(snippets.keys())) ); CUR_SNIP_KEY = list(snippets.keys())[CUR_SNIP_IX] def printCurrentSnippet(): print(snippets[CUR_SNIP_KEY]) def printAllSnippets(): print(snippets) if __name__ == '__main__': main()
Post code with new WP.com
See How to post source code on WordPress
URL https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/https://pythonconquerstheuniverse.wordpress.com/2011/11/06/posting-sourcecode-on-wordpress/
Help for ember cli
GitBash listing of ember — help
to edit with markdown,
- click 3-dots top right
- at middle select Tools >>Block Manager
- [X] Markdown was checked.
- Question just use markdown?
- experiment -> just use markdown in a new block
GB …/~/ $ ember –help
Usage: ember
Markdown Experiment
Code Listing
Available commands in ember-cli
> ember addon # Generates a new folder structure for building an addon, complete with test harness.
> ember asset-sizes # Shows the sizes of your asset files.
> ember build # Builds your app and places it into the output path (dist/ by default).
> ember destroy # Destroys code generated by generate command.
> ember generate # Generates new code from blueprints.
> ember help # Outputs the usage instructions for all commands or the provided command
> ember init # Reinitializes a new ember-cli project in the current folder.
> ember install # Installs an ember-cli addon from npm.
> ember new # Creates a new directory and runs ember init in it.
> ember serve # Builds and serves your app, rebuilding on file changes.
> ember test # Runs your app’s test suite.
> version # outputs ember-cli version
> # Available commands from @ember/optional-features:
> ember feature # Prints the USAGE.
> ember feature:list # List all available features.
> ember feature:enable # Enable feature.
> ember feature:disable # Disable feature.
Ember’s built-in blueprints as of 4/3/2021 10:19 AM PDT
Ember’s built-in blueprints are here
- N.B. According to Creating blueprints
Here’s a list of their names from GitHub
acceptance-test
component-addon
component-class-addon
component-class
component-test
component
controller-test
controller
helper-addon
helper-test
helper
initializer-addon
initializer-test
initializer
instance-initializer-addon
instance-initializer-test
instance-initializer
mixin-test
mixin
route-addon
route-test
route
service-test
service
template
util-test
util
-addon-import.js
edition-detector.js
test-framework-detector.js
I filed an issue with wp.com
GIT bash Available commands in ember-cli:
ember addon
Generates a new folder structure for building an addon, complete with test harness.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String) (Default: addon)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–skip-git (Boolean) (Default: false)
aliases: -sg
–yarn (Boolean)
–directory (String)
aliases: -dir
–lang (String) Sets the base human language of the addon’s own test application via index.html
ember asset-sizes
Shows the sizes of your asset files.
–output-path (Path) (Default: dist/)
aliases: -o
–json (Boolean) (Default: false)
ember build
Builds your app and places it into the output path (dist/ by default).
aliases: b
–environment (String) (Default: development) Possible values are “development”, “production”, and “test”.
aliases: -e , -dev (–environment=development), -prod (–environment=production)
–output-path (Path) (Default: dist/)
aliases: -o
–watch (Boolean) (Default: false)
aliases: -w
–watcher (String)
–suppress-sizes (Boolean) (Default: false)
ember destroy
Destroys code generated by generate
command.
aliases: d
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
ember help
Outputs the usage instructions for all commands or the provided command
aliases: h, –help, -h
–verbose (Boolean) (Default: false)
aliases: -v
–json (Boolean) (Default: false)
ember init
Reinitializes a new ember-cli project in the current folder.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–welcome (Boolean) (Default: true) Installs and uses {{ember-welcome-page}}. Use –no-welcome to skip it.
–yarn (Boolean)
–name (String) (Default: “”)
aliases: -n
–lang (String) Sets the base human language of the application via index.html
ember install
Installs an ember-cli addon from npm.
aliases: i
–save (Boolean) (Default: false)
aliases: -S
–save-dev (Boolean) (Default: true)
aliases: -D
–save-exact (Boolean) (Default: false)
aliases: -E, –exact
–yarn (Boolean) Use –yarn to enforce yarn usage, or –no-yarn to enforce npm
ember new
Creates a new directory and runs ember init in it.
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–blueprint (String) (Default: app)
aliases: -b
–skip-npm (Boolean) (Default: false)
aliases: -sn
–skip-bower (Boolean) (Default: false)
aliases: -sb
–skip-git (Boolean) (Default: false)
aliases: -sg
–welcome (Boolean) (Default: true) Installs and uses {{ember-welcome-page}}. Use –no-welcome to skip it.
–yarn (Boolean)
–directory (String)
aliases: -dir
–lang (String) Sets the base human language of the application via index.html
ember serve
Builds and serves your app, rebuilding on file changes.
aliases: server, s
–port (Number) (Default: 4200) To use a port different than 4200. Pass 0 to automatically pick an available port.
aliases: -p
–host (String) Listens on all interfaces by default
aliases: -H
–proxy (String)
aliases: -pr , -pxy
–proxy-in-timeout (Number) (Default: 120000) When using –proxy: timeout (in ms) for incoming requests
aliases: -pit
–proxy-out-timeout (Number) (Default: 0) When using –proxy: timeout (in ms) for outgoing requests
aliases: -pot
–secure-proxy (Boolean) (Default: true) Set to false to proxy self-signed SSL certificates
aliases: -spr
–transparent-proxy (Boolean) (Default: true) Set to false to omit x-forwarded-* headers when proxying
aliases: –transp
–watcher (String) (Default: events)
aliases: -w
–live-reload (Boolean) (Default: true)
aliases: -lr
–live-reload-host (String) Defaults to host
aliases: -lrh
–live-reload-base-url (String) Defaults to baseURL
aliases: -lrbu
–live-reload-port (Number) Defaults to same port as ember app
aliases: -lrp
–live-reload-prefix (String) (Default: _lr) Default to _lr
aliases: –lrprefix
–environment (String) (Default: development) Possible values are “development”, “production”, and “test”.
aliases: -e , -dev (–environment=development), -prod (–environment=production)
–output-path (Path) (Default: dist/)
aliases: -op , -out
–ssl (Boolean) (Default: false) Set to true to configure Ember CLI to serve using SSL.
–ssl-key (String) (Default: ssl/server.key) Specify the private key to use for SSL.
–ssl-cert (String) (Default: ssl/server.crt) Specify the certificate to use for SSL.
–path (Path) Reuse an existing build at given path.
ember test
Runs your app’s test suite.
aliases: t
–environment (String) (Default: test) Possible values are “development”, “production”, and “test”.
aliases: -e
–config-file (String)
aliases: -c , -cf
–server (Boolean) (Default: false)
aliases: -s
–host (String)
aliases: -H
–test-port (Number) (Default: 7357) The test port to use when running tests. Pass 0 to automatically pick an available port
aliases: -tp
–filter (String) A string to filter tests to run
aliases: -f
–module (String) The name of a test module to run
aliases: -m
–watcher (String) (Default: events)
aliases: -w
–launch (String) (Default: false) A comma separated list of browsers to launch for tests.
–reporter (String) Test reporter to use [tap|dot|xunit] (default: tap)
aliases: -r
–silent (Boolean) (Default: false) Suppress any output except for the test report
–ssl (Boolean) (Default: false) Set to true to configure testem to run the test suite using SSL.
–ssl-key (String) (Default: ssl/server.key) Specify the private key to use for SSL.
–ssl-cert (String) (Default: ssl/server.crt) Specify the certificate to use for SSL.
–testem-debug (String) File to write a debug log from testem
–test-page (String) Test page to invoke
–path (Path) Reuse an existing build at given path.
–query (String) A query string to append to the test page URL.
–output-path (Path)
aliases: -o
ember version
outputs ember-cli version
aliases: v, –version, -v
–verbose (Boolean) (Default: false)
GB …/~/ $
ember generate –help
GB …/~/ $ ember generate –help
Requested ember-cli commands:
ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
Available blueprints:
ember-cli:
addon
The default blueprint for ember-cli addons.
addon-import
Generates an import wrapper.
app
The default blueprint for ember-cli projects.
blueprint
Generates a blueprint and definition.
http-mock
Generates a mock api endpoint in /api prefix.
http-proxy
Generates a relative proxy to another server.
in-repo-addon
The blueprint for addon in repo ember-cli addons.
lib
Generates a lib directory for in-repo addons.
server
Generates a server directory for mocks and proxies.
vendor-shim
Generates an ES6 module shim for global libraries.
GB …/~/ $
ember generate component –help
GB …/~/ $ ember generate component –help
Requested ember-cli commands:
ember generate
Generates new code from blueprints.
aliases: g
–dry-run (Boolean) (Default: false)
aliases: -d
–verbose (Boolean) (Default: false)
aliases: -v
–pod (Boolean) (Default: false)
aliases: -p, -pods
–classic (Boolean) (Default: false)
aliases: -c
–dummy (Boolean) (Default: false)
aliases: -dum, -id
–in-repo-addon (String) (Default: null)
aliases: –in-repo , -ir
–in (String) (Default: null) Runs a blueprint against an in repo addon. A path is expected, relative to the root of the project.
The ‘component’ blueprint does not exist in this project.
GB …/~/ $
JCW COVID-19 County Compare Plugin
Joe Codeswell’s “JCW COVID-19 County Compare Plugin” for WordPress is currently under development.
This is the Plugin Uri.
This plugin allows the user to display COVID-19 County Data Comparison Charts.
Stay tuned for more info.
Here is the short link: https://wp.me/p1zI3Z-xD
web2py genericIndexJoe.html & layoutJoe.html
genericIndexJoe.html
{{extend 'layoutJoe.html'}} {{response.menu}} {{# uncommented, makes the menu appear }} {{ #=BEAUTIFY(response._vars) }} {{ =response._vars['message'] }}
layoutJoe.html
<!DOCTYPE html> <!-- copied from ordersarrive >> layoutJoe.html which may be crappy --> <!--[if (gt IE 9)|!(IE)]><!--> <html class="no-js" lang="{{=T.accepted_language or 'en'}}"> <!--<![endif]--> <head> <meta charset="utf-8"> <!-- www.phpied.com/conditional-comments-block-downloads/ --> <!-- Always force latest IE rendering engine (even in intranet) & Chrome Frame Remove this if you use the .htaccess --> <meta http-equiv="X-UA-Compatible" content="IE=edge{{=not request.is_local and ',chrome=1' or ''}}"> <!-- Mobile Viewport Fix j.mp/mobileviewport & davidbcalhoun.com/2010/viewport-metatag device-width: Occupy full width of the screen in its current orientation initial-scale = 1.0 retains dimensions instead of zooming out if page height > device height user-scalable = yes allows the user to zoom in --> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>{{=response.title or request.application}}</title> <!-- http://dev.w3.org/html5/markup/meta.name.html --> <meta name="application-name" content="{{=request.application}}"> <!-- Speaking of Google, don't forget to set your site up: http://google.com/webmasters --> <meta name="google-site-verification" content=""> <!-- include stylesheets --> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"/> <link rel="stylesheet" href="{{=URL('static','css/bootstrap.min.css')}}"/> <link rel="stylesheet" href="{{=URL('static','css/web2py-bootstrap4.css')}}"/> <link rel="shortcut icon" href="{{=URL('static','images/favicon.ico')}}" type="image/x-icon"> <link rel="apple-touch-icon" href="{{=URL('static','images/favicon.png')}}"> <!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects --> <a href="http://=URL('static','js/modernizr-2.8.3.min.js')">http://=URL('static','js/modernizr-2.8.3.min.js')</a> <!-- Favicons --> {{include 'web2py_ajax.html'}} <!-- this includes jquery.js, calendar.js/.css and web2py.js --> {{block head}}{{end}} </head> <body> <div class="w2p_flash alert alert-dismissable">{{=response.flash or ''}}</div> <!-- Navbar ======================================= --> <nav class="navbar navbar-light navbar-expand-md bg-faded bg-dark navbar-dark justify-content-center"> <!-- <a href="http://web2py.com" class="navbar-brand d-flex w-50 mr-auto">web2py</a> --> <a href="http://JoeCodeswell.com" class="navbar-brand d-flex w-50 mr-auto">JoeCodeswell.com</a> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> <div class="navbar-collapse collapse w-100" id="navbarNavDropdown"> <ul class="navbar-nav w-100 justify-content-center"> {{for _item in response.menu or []:}} {{if len(_item)<4 or not _item[3]:}} <li class="nav-item {{if _item[1]:}}active{{pass}}"> <a class="nav-link" href="{{=_item[2]}}">{{=_item[0]}}</a> </li> {{else:}} <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="{{=_item[2]}}" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">{{=_item[0]}}</a> <div class="dropdown-menu"> {{for _subitem in _item[3]:}} <a class="dropdown-item" href="{{=_subitem[2]}}">{{=_subitem[0]}}</a> {{pass}} </div> </li> {{pass}} {{pass}} </ul> <form class="form-inline my-2 my-lg-0"> <input class="form-control mr-sm-2" type="text" placeholder="Search"> </form> {{if 'auth' in globals():}} <ul class="nav navbar-nav ml-auto w-100 justify-content-end"> <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> {{if auth.user:}}{{=auth.user.first_name}}{{else:}}LOGIN{{pass}} </a> <div class="dropdown-menu dropdown-menu-right"> {{if auth.user:}} <a class="dropdown-item" href="{{=URL('default','user/profile')}}">{{=T('Profile')}}</a> {{if 'change_password' not in auth.settings.actions_disabled:}} <a class="dropdown-item" href="{{=URL('default','user/change_password')}}">{{=T('Change Password')}}</a> {{pass}} <a class="dropdown-item" href="{{=URL('default','user/logout')}}">{{=T('Logout')}}</a> {{else:}} <a class="dropdown-item" href="{{=URL('default','user/login')}}">{{=T('Login')}}</a> {{if 'register' not in auth.settings.actions_disabled:}} <a class="dropdown-item" href="{{=URL('default','user/register')}}">{{=T('Sign up')}}</a> {{pass}} {{if 'retrieve_password' not in auth.settings.actions_disabled:}} <a class="dropdown-item" href="{{=URL('default','user/retrieve_password')}}">{{=T('Lost Password')}}</a> {{pass}} {{pass}} </div> </li> </ul> {{pass}} </div> </nav> <!-- Masthead ===================================== --> {{block header}} {{end}} <!-- Main ========================================= --> <!-- Begin page content --> <div class="container-fluid main-container"> {{include}} {{=response.toolbar() if response.show_toolbar else ''}} </div> {{block footer}} <!-- this is default footer --> <footer class="footer container-fluid"> <div class="row"> <div class="col-md-12"> <div class="copyright pull-left">{{=T('Copyright ')}} © {{=request.now.year}} Joseph P. Dorocak, Sacramento, CA. All rights reserved.</div> <div id="poweredBy" class="pull-right"> {{=T('Powered by')}} <a href="http://www.web2py.com/">web2py</a> </div> </div> </div> </footer> {{end}} <!-- The javascript =============================== --> <a href="http://=URL('static','js/bootstrap.bundle.min.js')">http://=URL('static','js/bootstrap.bundle.min.js')</a> <a href="http://=URL('static','js/web2py-bootstrap4.js')">http://=URL('static','js/web2py-bootstrap4.js')</a> {{block page_js}}{{end page_js}} {{if response.google_analytics_id:}} <!-- Analytics ==================================== --> <a href="http://=URL('static','js/analytics.min.js')">http://=URL('static','js/analytics.min.js')</a> <script type="text/javascript"> analytics.initialize({ 'Google Analytics':{trackingId:'{{=response.google_analytics_id}}'} }); </script> {{pass}} </body> </html> <!-- original stuff below here --> {{#extend 'layout.html'}} <!-- <h1>This is the layoutJoe.html template</h1> --> {{#=BEAUTIFY(response._vars)}}
web2py Markdown Usage Example
web2py Markdown Usage Example
from gluon.contrib.markdown import WIKI as markdown def index(): """ ## [see](web2py.com/examples/static/sphinx/gluon/gluon.contrib.markdown.html) [Markdown see](https://groups.google.com/g/web2py/c/om9aXi3xg3Y/m/jE4t-KwpBQAJ) """ # response.view = 'genericIndexJoe.html' response.flash = T("Welcome!") my_md = '''## Welcome to the cov19cty App! ### To generate County Comparison Charts: 1. Click Menu >> Gen Chart >> Multi-County Input Form 1. Add Your Counties to compare (state, county, typeOfData) 2. Define Your Time Series 2. Click Menu >> Gen Chart >> Show Multi-County Chart ''' my_html = markdown(my_md) # return dict( message=my_html ) return my_html