Browse Source

update todo

main
clemtre 8 months ago
parent
commit
23d18164ea
  1. 25
      LISEZMOI.md
  2. 61
      README.md
  3. 8
      TODO.md
  4. 2
      script.js

25
LISEZMOI.md

@ -66,12 +66,6 @@ firefox insatisfaisant, autant dans sa forme que dans le format utilisé
(sqlite). Ce script et les utilitaires autours proposent une
alternative pour archiver ses navigations internet.
Lecture en lien :
* FR
*
* EN
* https://www.inkandswitch.com/local-first/
## Format de la base de donné
Seule une Url est requise, le reste des champs sont
facultatifs, on compte les champs suivants :
@ -79,7 +73,7 @@ facultatifs, on compte les champs suivants :
* Name : Par défaut la balise </title> de la page
* Description : ...
* Tags : mots-clés séparés d'une virgule
* Date : heure posix de l'ajout du lien
* Date : date au format ANNÉE/MOIS/JOUR de l'ajout du lien
* Color : couleur css (nom, hex, rgb etc...)
## structure de la page index.html générée par signet.sh
@ -88,16 +82,14 @@ facultatifs, on compte les champs suivants :
<html>
<head>
<title>⛵ → YY-MM-DD, H:M</title>
<script defer src="jquery-3.6.4.js"></script>
<script defer src="script.js"></script>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8" />
</head>
<body>
<div id="cc"></div>
<textarea autofocus></textarea>
<nav>
<p>tag (amount)</p>
<p>tag (quantité)</p>
</nav>
<ol>
<li>
@ -201,24 +193,17 @@ la tentative de curl pour passer au prochain champs du script :/ sorry !
* index.html → C'est la page html générée. Elle est composée de :
* \<textarea> pour chercher dans les marque-pages (ctrl + f)
* \<section> de tags \<p> et leurs quantités rangés dans l'ordre décroissant
* liste ordonnée croissante \<ol> en flex column-reverse de liens <\li>
* OBSOLÈTE → liste ordonnée croissante \<table> en flex column-reverse de liens <\li>
* \<a> lien (href)
* \<h1> Name
* \<h2> Description
* \<h3> Tags
* \<h4> Date
* \<h5> lien (texte)
* script.js → Un peu de javascript pour:
* rechercher dans la \<textarea>
* ajouter les couleurs de fond aux entrées qui en ont
* si le champs de description est vide, ne pas
l'afficher
* formater les dates du temps posix au format AA-MM-JJ
/!\ Prochainement /!\
starred.sh → Un curl des repos de l'api github
https://api.github.com/users/[user]/starred , formaté de json à une
liste html sans jq !
# Autres gestionnaires de marque-pages :
- nb https://xwmx.github.io/nb/ (AGPL-3.0)
@ -229,6 +214,4 @@ liste html sans jq !
https://psb1558.github.io/Junicode-font/
* dmenu (MIT/X)
https://tools.suckless.org/dmenu/
* jquery (MIT)
https://jquery.com/

61
README.md

@ -79,14 +79,7 @@ curl -O https://martinlemaire.fr/fonts/Junicode-CondensedLight.otf
curl -O https://martinlemaire.fr/fonts/Junicode-CondensedLightItalic.otf
```
4. jquery
Signet.sh webpage requires jquery, you can curl the 72Kb slim, minified
version over :
```
curl -O https://code.jquery.com/jquery-3.7.1.slim.min.js
```
5. dmenu
4. dmenu
https://askubuntu.com/questions/828450/how-to-install-dmenu
@ -116,7 +109,6 @@ Only a Url is required, the rest of the fields are optional :
<html>
<head>
<title>⛵ → YY-MM-DD, H:M</title>
<script defer src="jquery-3.6.4.js"></script>
<script defer src="script.js"></script>
<link rel="stylesheet" href="style.css">
<meta charset="utf-8" />
@ -163,7 +155,7 @@ Super + i because in my window manager (awesomewm) configuration file
located in ~/.config/awesome/rc.lua, I have the following lines:
```
awful.key({modkey}, "i", function()
awful.util.spawn_with_shell("edit_bookmarks_dmenu.sh ~/BOOKMARKS") end,
awful.util.spawn_with_shell("interface_dmenu.sh ~/BOOKMARKS") end,
{description = "Add a bookmark to my database of bookmarks"}),
```
## Edit a bookmark :
@ -176,7 +168,7 @@ B and it will save a mark to the file you can then access with ' + B
# Installation
Works on Ubuntu 20 LTS, it should work on POSIX
compliant machines, macOS, linux* or bsd*. I'm curious to know how it
compliant machines, macOS, linux* or \*bsd. I'm curious to know how it
goes on windows :^)
# Dependency :
@ -185,7 +177,8 @@ To add a link via the proposed interface, we will need
to install dmenu ~~and htmlq~~.
* dmenu https://tools.suckless.org/dmenu/ (MIT/X)
* ~~htmlq https://github.com/mgdm/htmlq (MIT)~~ replaced by one
awk command
awk command, this was needed in order ot retrieve the <title> tag from
the grabbed page
* xclip ?
## dmenu
Dmenu is an interactive menu that allows us to select and write
@ -200,55 +193,19 @@ In our script, to store the given tags in a variable, we can do:
tags=$(echo "" | dmenu -p "Enter comma-separated tags:")
```
## ~~htmlq~~
Htmlq is an HTML parser written in Go. It doesn't matter which parser we
use, it seems that each language has its own.
We give to the program an html string and it filters through it using css
selectors returning the found html elements
Using javascript, retrieving all the \<h1> children of a \<section> can
be done with :
```
document.querySelectorAll('section h1')
```
In shell, it's more complicated since we don't have document object
model we can query. Htmlq is made for that:
```
cat fichier.html | htmlq 'section h1'
```
And to output only the text -- the javascript equivalent of .innerHTML:
```
cat fichier.html | htmlq 'section h1' --text
```
We use it to retrieve the title tag of the page to add:
```
curl page.html | htmlq 'title' --text
```
Pre-release patch:
```
curl $url | awk -v RS='</title>' \
'/<title>/ {gsub(/.*<title>/, ""); print}' |\
tr -d '\n'
```
For the moment this step is blocking. In case internet cuts while
bookmarking a link, you will have to wait for the end of the curl
attempt to move to the next field in the script :/ sorry!
# Repository structure :
* BOOKMARKS → A textual database of bookmarks
* edit_bookmarks_dmenu.sh → A script to add a link to the database using
* interface_dmenu.sh → A script to add a link to the database using
dmenu
* Usage : ./edit_bookmarks_dmenu.sh BOOKMARKS
* Usage : ./interface_dmenu.sh BOOKMARKS
* signet.sh → The shell script itself
* It generates a new html page from the database of bookmarks
* Usage : ./signet.sh BOOKMARKS > index.html
* style.css → Stylesheet for index.html
* script.js → A bit of jquery for:
* script.js → A bit of vanilla javascript in order to:
* search in the \<textarea>
* add background colors to entries that have them
* if the description field is empty, do not display it
* format posix time dates to YY-MM-DD format
# Naming
The name is subject to change.
@ -265,6 +222,4 @@ https://www.cnrtl.fr/definition/signet
https://psb1558.github.io/Junicode-font/
* dmenu (MIT/X)
https://tools.suckless.org/dmenu/
* jquery (MIT)
https://jquery.com/

8
TODO.md

@ -2,8 +2,8 @@ unsorted list of things that would be nice to have
* *make a make*file in order to variabilize language in add.sh prompts
and make overall config easier
* write more structured css
* pin links
* ~write more structured css~
* ~pin links~
→ add an optional boolean to the records implictly false if absent.
if true, the link sits on top of the pile
* search select tags for filtering
@ -11,8 +11,8 @@ unsorted list of things that would be nice to have
the links accordingly
* a better way to capture url
→ something that grabs current page to clipboard
* hardcode bookmark ids in awk rather than css so that ids are
persistant and don't slide if a link is removed
* ~hardcode bookmark ids in awk rather than css so that ids are
persistant and don't slide if a link is removed~
→ add.sh id++
* make other ways to edit and generate bookmarks if dmenu is too much of
a struggle to install.

2
script.js

@ -2,7 +2,7 @@ const textarea = document.querySelector('textarea')
function updateValue(e) {
let val = textarea.value.toLowerCase()
document.querySelectorAll('.signets tr').forEach((e) => {
document.querySelectorAll('table tr').forEach((e) => {
var listItemText = e.innerHTML.toLowerCase();
listItemText.includes(val) ?
e.classList.remove('hidden') : e.classList.add('hidden')

Loading…
Cancel
Save