Copyright: @tk0miya License: BSDL
#pyconjp2020
See https://docs.google.com/presentation/d/1GzGae1_uB05-8tJZChOJdTuuP4XFJWuak7etHKEvJqQ/edit?usp=sharing
| # リテラルスタイルのアンカーを作る | |
| # | |
| # 使い方: | |
| # * :codehref:`blah blah blah <http://path.to/anywhere>` | |
| # * :codehref:`blah \`\`blah\`\` blah <http://path.to/anywhere>` | |
| # | |
| from docutils import nodes | |
| from sphinx.util.docutils import ReferenceRole | |
| # リテラルスタイルのアンカーを作る | |
| # | |
| # 使い方: :codehref:`blah blah blah <http://path.to/anywhere>` | |
| # | |
| from docutils import nodes | |
| from sphinx.util.docutils import ReferenceRole | |
| class CodeHref(ReferenceRole): | |
| def run(self): |
| # extension testbed | |
| import re | |
| from docutils import nodes | |
| from docutils.nodes import Element, Node | |
| from sphinx.util.docutils import SphinxDirective | |
| from sphinx.writers.html5 import HTML5Translator | |
| # frozen_string_literal: true | |
| module Ransack | |
| module Nullable | |
| # Ransack で NULL を含む IN クエリを組み立てるためのヘルパ | |
| # | |
| # 利用方法: | |
| # Ransack::Nullable.build(User, params[:q], nullable: %i[user_id]) | |
| # | |
| # 注意点: |
| # frozen_string_literal: true | |
| # ActiveYaml の association を Ransack で検索可能にする | |
| module ActiveHash | |
| module Ransackable | |
| def ransackable_attributes(_auth_object = nil) | |
| data.first.keys | |
| end | |
| def ransortable_attributes(auth_object = nil) |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - db/schema.rb | |
| - .tbls.yml | |
| permissions: | |
| contents: write |
Copyright: @tk0miya License: BSDL
#pyconjp2020
See https://docs.google.com/presentation/d/1GzGae1_uB05-8tJZChOJdTuuP4XFJWuak7etHKEvJqQ/edit?usp=sharing
| $ python | |
| Python 3.8.2 (default, Mar 2 2020, 00:44:41) | |
| [Clang 11.0.0 (clang-1100.0.33.17)] on darwin | |
| Type "help", "copyright", "credits" or "license" for more information. | |
| >>> foo = lambda x = 1: 1 | |
| >>> help(foo) | |
| Help on function <lambda> in module __main__: | |
| <lambda> lambda x=1 | |
| >>> import inspect |
| {% extends "!layout.html" %} | |
| {% block content %} | |
| <div class="notice" style="width: 100%; height: 24px; background-color: #ffe761; padding: 8px 20px 8px 20px;"> | |
| このページは新しめのやつなので気をつけておくれやす。 っ[ぶぶづけ] | |
| </div> | |
| {{ super() }} | |
| {% endblock %} |
| From 551ad9efa5cc60a50e6f280e9aecdd12220693f1 Mon Sep 17 00:00:00 2001 | |
| From: Takeshi KOMIYA <i.tkomiya@gmail.com> | |
| Date: Mon, 16 Mar 2020 00:38:21 +0900 | |
| Subject: [PATCH] doc: Fix messages in extensions are not translated | |
| So far, custom extensions for python-doc have accessed internal data | |
| structure of sphinx.locale module directly. But, it does not work at | |
| present because the structure has changed since Sphinx-1.8 release. | |
| This uses public translation APIs of Sphinx instead to get translated | |
| messages. |