Skip to content

Commit

Permalink
Merge branch 'master' of github.com:mmagnus/geekbook
Browse files Browse the repository at this point in the history
* 'master' of github.com:mmagnus/geekbook:
  Update quickref.rst
  Update quickref.rst
  Update quickref.rst
  Update rna.rst
  Update requirements.txt
  Update quickref.rst
  Update quickref.rst
  Update find_files.py
  Update view.rst
  Update getstarted.rst
  Update CHANGELOG.md
  start & test: it should go with --update to generate html page
  webserverflask.py: remove some prints
  Fix a bug, not public is not public now
  conf: fix, FIND_FILES_PLUGIN should go before conf_local
  corrected version, no alert if file is found
  new way to open files
  Update README.md
  slides: fix missing lib
  workshop: prepare a presentation for workshops

# Conflicts:
#	CHANGELOG.md
#	docs/source/quickref.rst
#	engine/plugins/find_files.py
#	engine/webserverflask.py
#	geekbookapp.py
  • Loading branch information
mmagnus committed Aug 24, 2019
2 parents 927dd2a + 7f7f24e commit 959dfd5
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 85 deletions.
3 changes: 1 addition & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Pre-release]
(TODO)
## 2.2 Last Python2 version!
- Introduce ``#short`` to make it shorter 190719

## 2.1
### Added
- Insert files (drag and drop) from Apple Photos
Expand Down
1 change: 1 addition & 0 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ markdown==2.6.11
py-gfm==0.1.3
Flask
pandas
pygments
2 changes: 0 additions & 2 deletions docs/source/getstarted.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,3 @@ open your browser and copy-paste the ```html path``` (in my case is ```file:///p
To make a new note, create a file in ```<path to your geekbook>/notes/<notes here>```.

Remember to keep geekbookapp.py running all the time, it will detect a new note and compile it for you.

**To force your browser to refresh html files whenevery there is a change on you drive (when geekbook compiles something new) please use something like this Auto-load (https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api) (this works for me in Firefox).**
32 changes: 25 additions & 7 deletions docs/source/quickref.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,39 @@ Quick Reference

::

find a full path to your file and insert it in the given place in a generated html
[ff:<file>]
[ff:uniq-name.pse]
find a full path to your file and insert it in the given place in a generated html

::

insert an external file
[if:<file>]
[if:/Users/magnus/work-src/fenzymes/examples/readme.txt]
insert an external file

::
insert the table of content in here
[tableofcontent] or {{TOC}}

to get the current date 2017-01-13
[date]

define only width for a image:
![](imgs/Screen_Shot_2017-02-12_at_1.17.04_AM.png =500x)

only height:
![](imgs/Screen_Shot_2017-02-12_at_1.17.04_AM.png =x400)

and both:
![](imgs/Screen_Shot_2017-02-12_at_1.17.04_AM.png =400x400)

you can put to images next to each other and sqeeze them to the left
<div style="width:300px">
![](imgs/190409_L4yjm119T5aONVO9BVeCTQ_thumb_7a17.jpg)![](imgs/190409_thumb_7a18.jpg)
</div>

#short - set for image (``max-height:400px``) to make it shorter

[tableofcontent] or {{TOC}}
insert the table of content in here

Images::

#short - set for image (``max-height:400px``) to make it shorter
add description of a note in the Index page
[desc:info on TN]
4 changes: 2 additions & 2 deletions docs/source/rna.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
RNA-pdb-tools
mmagnus/rna-tools
============================================================

You need to install rna-pdb-tools (http://rna-pdb-tools.readthedocs.io/en/latest/) first.
You need to install rna-tools (http://rna-tools.readthedocs.io/en/latest/) first.

Draw VARNA-based image of RNA secondary structure
------------------------------------------------------------
Expand Down
16 changes: 1 addition & 15 deletions docs/source/view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,4 @@ Out | Read
.. image:: ../imgs/view.png
**Fig**. The index in Safari.

Of course you can browser your notes in any browser. I'm using (mmagnus) Firefox with following addons to improve the experience, and Safari for screenshots ;-)

Auto-reload
--------------------------------------------------------------

To force your browser to refresh HTML files whenever there is a change on you drive (when geekbook compiles something new) please use something like this Auto-load (https://addons.mozilla.org/en-US/firefox/addon/auto-reload/?src=api)

Old default image style
--------------------------------------------------------------

To get "old default image style" (white background) in Firefox install this add-on (https://addons.mozilla.org/en-US/firefox/addon/old-default-image-style/)

.. image:: ../imgs/firefox_img_old.png


Of course you can browser your notes in any browser. I used to use Firefox, then Chrome, and now Safari :-)
1 change: 0 additions & 1 deletion engine/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

SCREENSHOT_INBOX = None


# find files plugin off/on
FIND_FILES_PLUGIN = False

Expand Down
56 changes: 1 addition & 55 deletions engine/plugins/find_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,6 @@
JSON_DB = os.path.dirname(os.path.abspath(__file__)) + os.sep + 'find_file.json'


## def file_search(filename, verbose):
## """Search for filename. Returns dirname of the filename's path, and the full path.

## 181120 Test on my OSX. I might work on Linux as well. But this requires further
## testing.

## 170107 add cache. If the db is not found, create an empty pandas df
## and populate this df with append later. If the filename is not in the db
## run g/locate. Then, save the found path to the db (using pandas, via df, to json)"""
## import pandas as pd
## # cache
## if os.path.isfile(JSON_DB):
## df = pd.read_json(JSON_DB, orient='records')
## #filename = 'x.pse'
## pathdf = df[df['fn'] == filename]['path']
## # test if the file still exists there
## path = pathdf.to_string(index=False)
## if not pathdf.empty and os.path.isfile(path):
## logger.info('[from the db]:' + filename)
## return os.path.dirname(path), path
## # ok, here the function will finished if the results were cashed and
## # file still exists there
## else:
## df = pd.DataFrame()

## # if filename is not found in the db
## logger.info('find file:' + filename)

## if platform.system() == "Linux":
## out = commands.getoutput('locate ' + filename)
## if platform.system() == "Darwin":
## # out = commands.getoutput('glocate ' + filename)
## out = commands.getoutput('mdfind -name ' + filename)
## first_hit = out.split('\n')[0]
## logger.info('# of hits ' + str(len(out.split('\n'))) + " " + out.replace('\n',', '))
## if not first_hit:
## logger.info('not found')
## return ('Not found', '~~' + filename + '~~')
## else:
## logger.info('hit ' + first_hit)

## # update cache
## dffile = pd.DataFrame([[filename, first_hit],], columns=['fn', 'path'])
## if verbose: print(df)
## try:
## df[df['fn'] == filename]['path']
## except KeyError:
## pass
## df = df.append(dffile, ignore_index=True)
## # save to json
## df.to_json(JSON_DB, orient='records')
## return os.path.dirname(first_hit), first_hit


def find_files(text, verbose=False):
"""
The search was completely re-written in a way that now the files
Expand All @@ -92,7 +38,7 @@ def find_files(text, verbose=False):
if verbose: print '# file_finder.search()', output
# remove for now folder link, it does not work @todo
#output += l.replace('[ff:' + filename + ']',' <a href="' + folderpath + '"><code>[+]</code></a> ' + '<a target="_blank" href="/open' + filepath + '"> <span class="mantext">' + os.path.basename(filepath) + '</span></a>')
output += l.replace('[ff:' + filename + ']', '<a href="#" address="' + filepath + '" id="openfile"> <span class="mantext">' + os.path.basename(filepath) + '</span></a>\n')
output += l.replace('[ff:' + filename + ']', '<a href="#" address="' + filepath + '" id="openfile"> <span class="mantext">' + os.path.basename(filepath) + '</span></a>\n') # or without '\n
else:
output += l + '\n'
output = output.replace('[files-not-found]', msg_listofnotfoundfiles)
Expand Down
1 change: 0 additions & 1 deletion engine/webserverflask.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,6 @@ def view(note_title):
"""Open a note with your edit
http://flask.pocoo.org/snippets/76/
"""
print(note_title)
if request.remote_addr not in ['127.0.0.1', '0.0.0.0']:
if note_title not in OPEN_ACCESS:
return 'Hmm...'
Expand Down

0 comments on commit 959dfd5

Please sign in to comment.